playMaker

Author Topic: Best Practise: More than one FSM or child objects with one FSM each?  (Read 2776 times)

FlapFail

  • Playmaker Newbie
  • *
  • Posts: 15
Hi guys,

I'm wondering what is the best practise to use multiple FSM's on one GameObject.
Currently I've got a Player with several managers in my game.

Quote
-The Player GO is the Root Object
-- A GO with the Playermesh
-- Movement Manager with a single FSM on it
-- Collision Manager, also a single FSM
-- ...

I guess the advantage of multiple GO's parented to the root player is that I can make prefabs out of them and f.ex use the same Movement Manager for a different Player. If I make any changes a just apply this to the prefab and every Movement Manager on every object will update.

To keep the scene clear I would rather prefer to put all the FSM's on the Player root object. I know that I can make templates out of every manager to use it on a different GO but if I now make any changes, the templates will not update everywhere right?

Thanks!

Rob



jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Best Practise: More than one FSM or child objects with one FSM each?
« Reply #1 on: July 05, 2012, 03:18:22 AM »
Hi,

 templates are just there as snippets, you simply copy paste them. Prefabs are much better to create reusable codes that are dynamic.

 "Divide and conquer" is a good approach, I often create dummy gameObject to host particular features and its related Fsms, I also create "META" Fsm hosting only variables ( to avoid creating global variables), then any interested fsm can simply poll into that "META" fsm, everything is centralized for a particular feature, yet the logic is spreaded out into several fsm, it's very convenient.

So, yes your tactic is the right one in my opinion. Simply don't hesitate to create empty gameObjects, it's a lot more manageable than dozens of fsm on one gameObject, not need really.

bye,

 Jean