playMaker

Author Topic: Complex state blending  (Read 1389 times)

Micktu

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Complex state blending
« on: January 04, 2016, 06:05:59 AM »
Hello, I'm about to pick up Playmaker, it looks like an invaluable tool, great job on it.

The question is: let's say we have this kind of a main menu.

https://youtu.be/zFzo1UawEO8?t=55

Every menu screen is an FSM state, and a screen can transition into another screen with a camera animation.

The most obvious solution for this example is that the animation is also a state, considering every animation in the video is unique.

But what if the animation is shared between multiple screens? Let's say, all screens transition with a screen fading out, playing a sound, and a screen fading in. In this case you don't want to duplicate the same state multiple times, and you still want to preserve the visual control flow in an FSM. How to do it correctly?

Sorry it the answer is trivial, please point me to documentation or a video in this case.

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • View Profile
    • Assets
Re: Complex state blending
« Reply #1 on: January 04, 2016, 06:28:58 AM »
You could have the repeatable action in a separate FSM that you send an event to each time you play the animation.

Micktu

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: Complex state blending
« Reply #2 on: January 04, 2016, 06:34:08 AM »
You could have the repeatable action in a separate FSM that you send an event to each time you play the animation.

This is definitely a solution, but you lose the visual representation of control flow (and possibly, some debugging capabilities?)

With most states loosely coupled this is no longer an FSM.
« Last Edit: January 04, 2016, 06:39:32 AM by Micktu »

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • View Profile
    • Assets
Re: Complex state blending
« Reply #3 on: January 04, 2016, 06:04:13 PM »
True, you could set an ID to each screen (0 = main menu, 1 = character select etc) your FSM will check to see if that int value changes, when it does, it will do the standard actions and then an int switch would send it to the correct animation state.