luxkun / ReGoap

Generic C# GOAP (Goal Oriented Action Planning) library with Unity3d examples
Apache License 2.0
1.02k stars 149 forks source link

Why you need FSM? #32

Closed dimmduh closed 3 years ago

dimmduh commented 6 years ago

Thanks for great framework! Can you describe more detailed why you add FSM to example? How FSM can be used and helps?

OneManMonkeySquad commented 5 years ago

Goap creates a plan like MoveToTarget, AttackTarget, ReloadGun. These are high level tasks. When one is executed it's translated into low level tasks. Note how each of these actions is either movement, animation or both. A FSM or a queue can be used to implement this.

The first 2 pages go into more detail: https://alumni.media.mit.edu/~jorkin/gdc2006_orkin_jeff_fear.pdf

shayneoneill commented 4 years ago

Its not the only way to implement the execution of goals. It would be perfectly possible (maybe even preferable?) to use a Behavior tree (Ie have a big selector task that looks at what the current plan step is and then executes the behavior tree branch. But yeah Jeff Orkins original version used a surprisingly simple tri-state FSM for the task, although those states where definately hiding a lot of complexity underneath them