• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0

AI sensory system and chase

2 posts in this topic

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.

Edited by Ender1618

Share this post

Link to post
Share on other sites

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

Edited by Dan Violet Sagmiller

Share this post

Link to post
Share on other sites

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.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0