playMaker

Author Topic: FSM driven AI setup  (Read 2875 times)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
FSM driven AI setup
« on: September 18, 2013, 08:29:38 AM »
I'm starting in on some more complicated AI for Oomph and wanted to start a discussion on FSM driven AI in general. 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 Oomph because of the 3D nature but I think it could be simplified enough to work without waypoints, navmeshes or constant pathfinding.

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.

Stipulations..
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?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FSM driven AI setup
« Reply #1 on: September 20, 2013, 03:18:04 AM »
Hi,

 imo, Divide and Conquer is the right approach most of the time. At least it's easier to bring back features into one then the opposite, AND you benefit from mayn level of inderection to insert more feature as your system evolves.

you will have to divide into many fsm, simply because the must run their features concurrently , and a given fsm can only have one active State. so that's already a mandatory design pattern to have many Fsm dealing with one complex feature implementation.

I think you should layout something a bit more complex, to see how things can be organized. So can you come up with a typical simple tree with several elements? just on paper, But I think your got your initial Manager-Behavior-Motor quite right. The key here is how they will communicate and what they expect from each other. Typically, you need to design their respective "interface", what events are needed, how to pass/set/get variable back and forth in that chain ( if and when required)

bye,

 Jean