playMaker

Author Topic: What is a optimal FSM vs a Bad FSM ?  (Read 3293 times)

mrminico

  • Full Member
  • ***
  • Posts: 129
What is a optimal FSM vs a Bad FSM ?
« on: September 09, 2016, 02:38:57 AM »
I'm new to playmaker and I'm a big performance head. I've learned some C# here and there but I'm mainly an artist and I decided to go with playmaker. My only issue is that i've been on the edge of my seat every time I use it since I don't know what is most optimal in terms of designing these FSM's. If anyone can give me advice on some things to avoid and any other workflows that'll get me great performance and not as much bottle necks, ill be very thankful! So far I've been avoiding globals till I need them but I'm currently making a player controller and i've been trying to fit as much functionality in one FSM pertaining to the players movement. Example( Jump, running, getting axis, physics), Is this a bad practice?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: What is a optimal FSM vs a Bad FSM ?
« Reply #1 on: September 09, 2016, 06:12:17 AM »
Hi,
I think to have as much as possible into limited fsm's is a good thing.
I always have an fsm called gamemanger where most of the magic happens for my game :)

for your player controller it depends on how you want it to work,
i would separate  jumping and check if the player is grounded.
also if could shoot (for example) i would also have that in a separate fsm.
if there are some collision events i would set those also separately

So if you have several thing you want to be able to do at the same time i would suggest to separate them.

mrminico

  • Full Member
  • ***
  • Posts: 129
Re: What is a optimal FSM vs a Bad FSM ?
« Reply #2 on: September 15, 2016, 02:01:11 AM »
Hi,
I think to have as much as possible into limited fsm's is a good thing.
I always have an fsm called gamemanger where most of the magic happens for my game :)

for your player controller it depends on how you want it to work,
i would separate  jumping and check if the player is grounded.
also if could shoot (for example) i would also have that in a separate fsm.
if there are some collision events i would set those also separately

So if you have several thing you want to be able to do at the same time i would suggest to separate them.

I see, but is there a general rule of thumb for having optimal FSM? Like a list you would reccomend me or some stuff I should avoid doing?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: What is a optimal FSM vs a Bad FSM ?
« Reply #3 on: September 15, 2016, 03:49:08 AM »
Hi,
Not really, but what i definitely suggest is that you always document as much as you can.
So always name your states and use comments, when your fsm does something to another fsm (for example a send event) also document that.
You can also change the Action names but personally i do not like to do that (and i never do) because if ever someone else will work on my project it is way harder to edit/update en even for myself if i needed to update it a year later.

Create and destroy things is also something you want to avoid.
You can use pools or arrays and activate/deactivate objects.

mrminico

  • Full Member
  • ***
  • Posts: 129
Re: What is a optimal FSM vs a Bad FSM ?
« Reply #4 on: September 16, 2016, 12:19:57 AM »
Thank you! you seem to know what you're doing hahaha, how long have you been using playmaker for?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: What is a optimal FSM vs a Bad FSM ?
« Reply #5 on: September 16, 2016, 06:57:57 AM »
Hi,
I think about 4 years now, but still as a hobby :)
I hope one day i can do this full time and quit my job