AI sensory system and chase

Started by
1 comment, last by Dan Violet Sagmiller 11 years, 1 month ago

So I have this mediocre sensory system for my AI agents. Its attached to the face of the character, and moves along with animation. Has a frustum for main sight, another wider one for peripheral vision, and sphere for audial perception. I use the standard raycast to all perceivable relevant objects (mostly just the player(s)), at a specified slower than frame-rate frequency.

So this give me a range of confidence in my detections.

How do people typically deal with this range of confidence (or do most people not have it at all)?

I have my behavior tree implementation I wrote (which is my only decision system) that essentially just does variable look ups into what I call a perception black board (which has more things in it than just what the sensory system is putting in it: alertness, fear, am I being shot at, etc).

Do people typically deal with the confidence levels of some perception types, within the logic laid out by the BT, or is that better dealt with by more custom code that deciphers and emits a detect or not detect? Typically i mean. I find my BTs getting pretty complex dealing with confidence levels along with everything else they need to do.

And then there is also my chase system. So say I'm an enemy melee AI. I perceive the player. I immediately rotated my head (with sensory system attached) as fast as is believable, to focus (center sight frustum) on the player. Then i path plan and give chase. Btw is it customary to continuously re-plan from you current position to the player current position, at a particular frequency?

So as I chase the player to get up to melee distance, the player somehow gets out of sight (perception). What i was thinking is that I know the player's last position and velocity, so i can extrapolate where i think he will be in a certain max time delta, then re-plan path to that location (if it hasn't hit something first). While or when I get there, if I see him again then i go back into basic chase mode, if I don't then I transition into a search mode (randomly choosing nearby points on navmesh?). Does that sound reasonable? Or do people mostly just get a first perception then chase with perfect knowledge of where the player is, for certain amount of time?

I have built basic systems like this before, but without the confidence perception system, and a perfect knowledge chase. But it kind of didn't seem believable (could be my lack of other factors).

Also this is not necessarily a stealth game.

Any suggestions/experiences?

And yes I have looked at the Thief perception system page, a diff is my logic is handled almost exclusively by the BT right now.

Advertisement

(Cleared this post, it didn't show up on my side originally, so I rewrote/expanded on it in the next one.)

Moltar - "Do you even know how to use that?"

Space Ghost - “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer."

Dan - "Best Description of AI ever."

is it customary to continuously re-plan from you current position to the player current position, at a particular frequency?

Presuming your NPC has a target/list of waypoints/path generated:

during the updates, check if the target has moved farther than X distance from the last waypoint( destination ).

If they haven't, don't reprocess.

Also, only reprocess if you can see the target. (check after the other checks)

If you can't see the target, continue till you reach the last way point.

The allowable distance from the way point can often be determined by the range of the NPC's weapons.

Another thing you can do for difficulty of different NPC's, in addition to a larger randmoizer when determining the value of way points, is to add a counter to reprocess. The counter should only start once the player has gone outside the boundary of the last way point. Then once the counter is done, it will reprocess. On a straight away chase, this would never be noticed, except for a close range enemy, who keeps 'stumbling' as it stops just before getting to you before taking off again. Weaker/earlier npc's should have higher counter values.

What i was thinking is that I know the player's last position and velocity, so i can extrapolate where i think he will be in a certain max time delta, then re-plan path to that location (if it hasn't hit something first).

For this, I would simplify it down:

If the player goes out of site. Record the location and last direction headed. the NPC completes its chase at the last point of site, creates a straight path in the direction that was headed for a certain distance. say 50 meters in the game, or until it comes up to the first blocker, and then looks around for the PC again.

As for perception checks, I would only do that when reprocessing the way points. (to minimize its need)

One small glitch with this is when the player goes out of perception, that is when you should do the last check on location/direction, not by doing perception checks the whole time. In a sense, this would give the NPC about one corners worth of intuition. More skilled chasing NPC's could increase that Intuition to a farther distance or time, but it should be dropped sooner or later.

In a Sandbox area, you could also make sure that an NPC no longer in chase returns using a different passage, to their original post/area, so as to cover more area where the player might be.

You could also consider other chase NPC's in hearing range of the current chasing NPC will follow the NPC until they see you, and then begin a complete chase after you.

Additionally, once multiple NPC's are chasing the same target, give their ranges a push away. For instance, One AI will want to chase directly, or as close to 0 degrees variation as reasonable. While the two other chasers would be pressured to add 15 degrees to either side, in a bit of a surrounding tactic. (four chasers would be something like 20, 5, -5, -20 degrees in alteration.

These additions could be added to tougher areas. You could also set guard spawn points with an ear, in a spot behind wall. if the ear is triggered, it generates the additional NPC's to make the chase more interesting. but it should also limit the number as well, for both processing and simplicity, increasing the number with higher difficulty settings.

Moltar - "Do you even know how to use that?"

Space Ghost - “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer."

Dan - "Best Description of AI ever."

This topic is closed to new replies.

Advertisement