Advertisement

Managing AI...?

Started by March 04, 2009 08:34 PM
1 comment, last by wodinoneeye 15 years, 8 months ago
I'm writing a game with the potential for several dozen objects with simple AI. what is a good way to manage the AI? Every cycle seems over kill. Is staggering it better or FPS independent time step? Or is there a better method I haven't thought of? Thanks in advance.
It depends on the type of decisions you are making. Processor-wise, running 20 or so agents every frame won't kill you. Is it the right thing to do? Depends.

For the most part, look at what your agent is thinking about and base it on that, however. If it is a targeting decision, once per shot is a good idea. If it is a pathfinding decision, update occasionally (once per second?). If it is steering, update it more often.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Advertisement
It also depends on how the actions the object take are broken up timewise.

The high level AI choses the action for the current situation and and that action takes a certain amount of time to execute. Some higher level actions like 'Move to X' can be broken down into steps which could be interrupted by world events -- but the steps are 'atomic' uninteruptable, during which running the AI need not be done.

Usually the atomic actions (and subactions) are tied to animations which take fixed times to execute. The object really cant change course while the action is in progress. Once its through then decisions can be made again.

Sometime the AI has part of its processing running continuously (like taking in sensory events fed it by the simulation and accumulating them for when the decisionmaking is to be done). Simple games you can have an object look directly at the sim data, but more complex systems have more involved filtering/interpretation of situational data and have each object maintain its own symbolic representation of the world.


One system method runs the AI for objects when a player is near enough to see activities and stops or slows down (or generalizes) the behavior processing when out of sight. Behaviors which are just for show can be stopped when out of view and only the logic for the results of the actions need be calculated.
The simulation would run in 'generalized' mode in all places the player isnt and it doesnt have to run as often. Some systems stop execution entirely and then 'catchup' when the player nears -- but it depends on how objects interact because you want them to resume activity looking like they were working all the time (some games Ive seen its very obvious that the objects 'reset' when the player moves back into range).

--------------------------------------------[size="1"]Ratings are Opinion, not Fact

This topic is closed to new replies.

Advertisement