playMaker

Author Topic: Is it ok to have multiple FSM's?  (Read 2596 times)

Omninorm

  • Playmaker Newbie
  • *
  • Posts: 33
Is it ok to have multiple FSM's?
« on: November 02, 2016, 07:50:51 AM »
I know one can put multiple FSM's on a GameObject but how many is ok? I mean, is this a good way of doing it if one takes into consideration performance?

I often find it's the best way of keeping things organized.

For instance I have now one FSM that handles the Animations. Then another that handles the actual movement vectors for those animations and the transform/movement of the charachters (No root animation) and yet another that rotates the character based on the direction the player is going. i.e if he presses down the character flips 180 degrees down.

Just wondering if this is ok?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Is it ok to have multiple FSM's?
« Reply #1 on: November 02, 2016, 08:08:38 AM »
Hi,
That's fine to have multiple fsms as long as you don't go crazy with it.

In most of my projects i have a 'GameManger' fsm where most of the flow from my game is..that one tend to become big with a lot of states.
So what i do is use colors to group things together.
Here's a sample from i find it game i am working on :


Omninorm

  • Playmaker Newbie
  • *
  • Posts: 33
Re: Is it ok to have multiple FSM's?
« Reply #2 on: November 02, 2016, 09:21:09 AM »
Great tip! Thanks, Will start using colors as well, although so far it's still very basic compared to yours.
 :D

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Is it ok to have multiple FSM's?
« Reply #3 on: November 02, 2016, 12:14:32 PM »
Hi,
Also name all your states and use the descriptions.
If you want to change thing later it say way easier if you have documented it.

Before i did not do that much and learned it  the hard way, rebuilding some apps back from scratch...

You can also change action names but personally i do not like to do that i think it is better to use more states when needed and use the description.

Omninorm

  • Playmaker Newbie
  • *
  • Posts: 33
Re: Is it ok to have multiple FSM's?
« Reply #4 on: November 03, 2016, 05:41:11 AM »
Yeah, I'm starting to also realize this. I'm starting to make use of the comments a lot more now since if you get into something else and go back it can become a bit of an issue to understand exactly what you did again. :)


gregacuna

  • Full Member
  • ***
  • Posts: 142
Re: Is it ok to have multiple FSM's?
« Reply #5 on: November 04, 2016, 11:47:44 AM »
Thanks for sharing that djaydino. I found it very helpful and learned some important stuff in just a few moments. Cheers.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Is it ok to have multiple FSM's?
« Reply #6 on: November 04, 2016, 06:23:04 PM »
Hi,
happy to help!

btw you can find several tutorials on the User Tutorials Wiki

gregacuna

  • Full Member
  • ***
  • Posts: 142
Re: Is it ok to have multiple FSM's?
« Reply #7 on: November 04, 2016, 11:01:46 PM »
Wow, thanks for the link to those tutorials. I didn't know about them. Going to finish one course I'm doing which uses Playmaker and get started on those.

Cheers!