Advertisement

AI Circles

Started by August 22, 2002 04:59 PM
4 comments, last by csolar 22 years, 3 months ago
I was sitting at my computer reading up on some game programming information when I thought of an interesting way to do AI. I thought about using circles for the NPCs to respond to certain events. I thought that you could set up an imaginary circle of perception for each NPC. Example: In a FPS, you sneak up about 10 feet behind two guards that are standing about 2 feet from each other. You don''t know that there is another bot inside the house that you are taking cover by. You fire at one bot and he goes down. With that the program sends 2 messages. First, it scans a circle with a specific radius centered on the dead bot. The guy probably let out a yell of some kind that the other guard would of heard. The program scans the circle for the point that that guard is standing on. If that point is inside that circle, then the guard heard his falling buddie and acts. Second, the gun let off a sound so now the program scans the circle around the main character for the guard that was hiding in the building. If the guards point is inside the circle then he heard it. Also, you could use this concept for RPGs, setting up a sphere of perception that the NPC/monster is likly to hear/see/smell something. Of course some creatures hearing will be worse then there sight so you could offset the circle by a few feet or more either way. Some might have better hearing. Then, when the character steps inside this circle, the creature either smells, hears, or sees the character and attacks. ( ) ( ) C ( M-> ) ( ) ( ) In this example, the monster has better eye sight then he does hearing, so he won''t know that the character is sneaking up on him until he gets to close. I just felt like adding my 2 cents to this huge concept of AI. I''m not a professional game programmer, so I don''t know if anyone else has thought of this. Please don''t send an flaming emails saying that I stole your idea. I havn''t thought a lot about AI so I don''t know what concepts have already been tested.
They can write what they like, so long as I get the royalties.
It looks like you''ve formulated one way of determining awareness of the player for the AI, which, as you stated, can take place a number of ways:

* Line of sight - straight line only
* Hearing and smell (varying sizes of circles)

Here''s another way:

* Ally awareness - an AI calls out and any AI within hearing range now knows what the first AI knows.

I guess in your example the AI that got shot called out, but that might have only prompted another AI to investigate and see what happened. Another kind is, "Hey, he''s over there!!"

And then you get all the problems of path finding to the player, which attack to use, when to flee, etc. whew.
It's not what you're taught, it's what you learn.
Advertisement
Unfortunately csolar, while the idea is a good one, it''s not original. Be happy though that you worked it out yourself though!

This method has been used in many games. Recent examples include Return to Wolfenstein, NeverWinter Nights and the Baldur''s Gate titles... I could go on, but there''s little need. Basically the perceptions of the characters are limited to spatial regions, circles being one example.

Now what I''d like to see is a more realistic use of the physics engine for sound and light propogation. So a PC standing behind a thick wall shouldn''t be heard on the other side... and an NPC looking at a mirror should see objects reflected in the mirror! Now THAT would create some fun situations!

Cheers,

Timkin
Yea, I thought that someone had probably already thought of that. My second example got kindof screwed up so heres a new one:

------------(--)
-----------(----)
----C-----(-M----)
-----------(----)
------------(--)
They can write what they like, so long as I get the royalties.
Deus Ex 2 is rumored to have realistic sound propogation, closing a door will make it harder for ai''s outside the room to hear you etc. It also will have a realistic dynamic lighting model that the ai base their sight on, so as different objects block their view, or lights are moved around, their perception is based on that new lighting set up.

Dont see why it wouldnt make more sense, to just turn out a light instead of moving it, but I digress.
Well, I''m sure some lights will be toggled on and off, but some others (like a flashlight) move around, and if they go farther, even gunshots make light. It would be interesting to see enemies near you react to silenced fire because of the muzzle flash and not the sound =-)

"The Requested Information Is Unknown Or Classified" -Anonymous
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk

This topic is closed to new replies.

Advertisement