playMaker

Author Topic: Is there to way to have a Sub FSM run even if the Host changes States?  (Read 1458 times)

MikeTelly

  • Playmaker Newbie
  • *
  • Posts: 40
I'm trying to make my FSMs more compact. Is there a way to have a Sub FSM keep running even if I change states in the host?

If not, is it reasonable to have an FSM that just has 1 State, and that one States has multiple Sub-FSMs running?

Stuksgens

  • Playmaker Newbie
  • *
  • Posts: 9
As far as I know, not how to create sub FSMs
But if you want to make the FSM smaller. I would recommend you break your FSM into several smaller ones. Because the FSP improves, besides being easier to organize
My FSMs usually have between 5 and 10 stocks at most. This helps you to have control and better stability.

Hope this helps :D

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi.
Indeed splitting up is a good thing, and also (depending on your game) reusable which means less 'coding' and smaller files.

You can 'Feed' an fsm with get/set fsm actions  then send a event to that fsm to do something.

And if you need it to return some values , you can feed the game object, fsm name and the variable name and use again the get/set fsm actions and then a send 'event by name' as you can use a string to redirect the target.

MikeTelly

  • Playmaker Newbie
  • *
  • Posts: 40
Hi.
Indeed splitting up is a good thing, and also (depending on your game) reusable which means less 'coding' and smaller files.

You can 'Feed' an fsm with get/set fsm actions  then send a event to that fsm to do something.

And if you need it to return some values , you can feed the game object, fsm name and the variable name and use again the get/set fsm actions and then a send 'event by name' as you can use a string to redirect the target.

Would having 1 FSM that just has 1 State with several Run FSM actions creating multiple Sub-FSMs be a good strategy though? It's just I have 3ish FSMs that control movement (along with forces acting on the Player) and a lot of entities in the game would have these 3 FSMs. It would be nice to just slap 1 FSM on the gameobject to cover it.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi.
3ish fsms is about my minimum on characters and AI :)

I don't think that it is a good strategy for this case, but i never tested it.
But creating things @ runtime in most cases is not a good thing.

i would rather go with using templates.
And depending on the project :

Have different fsms that can be enabled/disabled on an object.
and/or
Have a few version object for different AI behaviour.
and/or
Feed certain data to manipulate the actions/states inside the templates.
(for example with weapon classes /damage)