AI systems by FSM ideas

As I’m finding out, AI can be pretty difficult to do, but isn’t too terrible if you understand the principles and work in a modular fashion. I’m completely in the dark and have started working on AI just this week, been reading about ideas on how to approach it and I’d like to start a discussion about the specific direction I’m heading.

Figured there would be at least a couple of dev’s here with some experience with it. From what I gather, this may be hard for with what im working on because it is a 3d physics based flight game and I need active, flying, physics based AI… but I think it could be simplified enough to work without waypoints, navmeshes or constant pathfinding. I’m incapable of coding so I’ve been wiring everything up in PlayMaker, as all of my systems are also wired up.

Sources:

Steering Behaviors For Autonomous Characters
http://red3d.com/cwr/steer/

AI FSM Summary/Tutorial
http://research.ncl.ac.uk/game/mastersdegree/gametechnologies/aifinitestatemachines/AI%20Finite%20State%20Machines%20Tutorial.pdf

States and Behavior Trees
http://aigamedev.com/open/articles/bt-overview/

These sources have got me a little more familiar with some concepts behind designing the AI system, but I’m still not clear on how to directly approach it. I started so far by outlining a set of states that the AI could be in (Idling, Pursuing, Evading, Wandering, Following, Etc…) but I now wonder about conditionals that would trigger these states, and also the execution of movement and where to place it.

The movement system may be too complex to compress into a single state, and I want to separate it in another FSM then just feed it target data and have it compute how to get there. This would be the Motor FSM. It will also have to figure priorities on the fly but for navigational issues such as a giant object in the way and finding a path around it, but still taking full control of the thrust and navigation… Maybe there needs to be a Navi FSM or something to prioritize where the Motor should be pushing the ship to get to the target…?

The Behavior FSM should be dictated by a Priority System FSM which is checking conditional data, objective flags and things like that, then the Behavior FSM reads this information and decides which state it should be in and moves the target point(s) for the Motor FSM which just figures out how much thrust and torque to apply to the vectors to get to the target point.

So it would flow like… [Priority FSM] ↔ [Behavior FSM] → [Motor FSM].

Is this a good approach? Too expensive? Fundamental flaws? Missing critical elements?

Any AI designer should be familiar with FEAR’s ai mechanics. It is the basis for modern AAA AI. http://web.media.mit.edu/~jorkin/gdc2006_orkin_jeff_fear.pdf

The basics of it is that your AI has a planner that has more information about the world, and the actions available to the actor. Then the planner can string together actions (like finding a path through the available actions) and make decisions about what to do. Then a simple FSM actually carries out the actions. It sounds like you’re heading in that direction already.

Is it really? I thought the AI was pretty bad in FEAR, but perhaps the underlying methodology was sound and it was just a bad implementation.

Edit: I’ve now read the paper and it does seem pretty solid but then I know very little of AI.

That is a pretty interesting paper.

I wasn’t on that same track, I planned something much simpler as their implementation seems too complicated for me to manage on my own but I had intended to have the AI react to flags and conditions being thrown during the game and compare them against its own personal stats like health to decide which state it would be in. Its just a matter of dividing the FSM systems coherently.

Thanks for the link, it was a good read.

Well, that’s not true. At the beginning of that paper they tell you what the basis for modern AAA AI is: most commonly people use A* for pathfinding and FSM’s for state control. Fear’s planning method isn’t used very much; I don’t know of any game other than FEAR that uses FEAR’s method.

There’s no one best way to do AI; it depends on your game. A lot of FPS’s use Behavior Trees instead of FSM’s since they allow more complexity in a simpler layout. You can get RAIN for Unity for free which is a pretty good Behavior Tree implementation. RTS’s tend to use hierarchical master/squad/unit AI’s, and modern RPG’s and sims tend to make use of Smart Objects and agents… I don’t know of any Unity plugins that focus on those aspects though.