playMaker

Author Topic: Multiple fsm  (Read 2677 times)

biohazard18

  • Playmaker Newbie
  • *
  • Posts: 5
Multiple fsm
« on: September 23, 2013, 11:30:15 PM »
Could someone please explain to me how multiple fsms work with a single object, and when that would be useful? I'm still trying to figure out the basics here. This is my first visual scripting program. Thank you.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Multiple fsm
« Reply #1 on: September 24, 2013, 05:53:46 AM »
Hi,

 Multiple Fsm is key indeed.

the main thing to understand here is that a given fsm can only have ONE state active at a time. Which means, only one fsm can not run concurrent logics.

 Typical example: user input and character animation.

This area is most of the time a butchery because we are trying to do this in one fsm, but that's nearly impossible, because you want to watch the user input and detect what to do with it, and at the same time control the character animation.

Instead, create two fsm. One that watch User input and fires global events to itself. and another fsm ( or multiple) that are responsible for listening to these global events and trigger animations.

for example, you may want to move your character around, AND jump. this is difficult, almost impossible with one fsm. While if each fsm is responsible for one precise task, and the then communicatte via global events, it becomes very powerful and feasible.

 Does that make sense?

I would encourage you to study the M2H game samples I ported to Playmaker. this is great source to learn some tricks and see how fsm can communicate together and why it's powerful.

https://hutonggames.fogbugz.com/default.asp?W890

bye,

 Jean

biohazard18

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Multiple fsm
« Reply #2 on: September 24, 2013, 10:32:51 AM »
Thank you, that helped a ton. Now I'm wondering if I was going about setting up the puzzle I had in my scene the wrong way since it had so many components to it. I had been trying to have a piece run a play animation, and check to see whether the piece before it had been activated.