playMaker

Author Topic: global states sanity check[SOLVED]  (Read 204 times)

abend

  • Playmaker Newbie
  • *
  • Posts: 25
    • View Profile
global states sanity check[SOLVED]
« on: November 08, 2019, 08:57:12 AM »
I have created a list of overarching states for my game:

   1. Before hole creation
   2. Hole Creation
   3. Hole Decoration
   4. Player positioned
   5. Playing Hole
   6. Hole Completion
   7. Hole Cleanup

My idea here is to set these up as a loop on one FSM and have various events move the current state around the ring. then other FSMs can check back to see where we are in the main loop above to make additional checks for what they can do. This helps to block the player from doing something before it's been set up. I just want to make sure I'm not reinventing the wheel here. Any alternate suggestions? Is there a more common practice? I'm not going to have these events doing things in the FSM, rather be a reference for other FSMs. I have a few global bools that I use now, but may be porting over to this based on feedback from you folks.
« Last Edit: November 12, 2019, 11:17:12 PM by jeanfabre »

abend

  • Playmaker Newbie
  • *
  • Posts: 25
    • View Profile
Re: global states sanity check
« Reply #1 on: November 11, 2019, 08:39:42 AM »
*Update:

These are all global transitions. they don't flow to each other. I can send event from other FSMs, and then when pinged, each one would then broadcast all that the state has started. I haven't got far enough to have other objects check which state it's in to see if they are allowed, but I had the idea to maybe disable things upon state enter, then the checks may be unnecessary, but I'd have to write out a matrix for that first to see when things should be turned on or off. The complications of this are that it's disconnected in a way that there isn't lines of code to follow to see where things are coming from.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
  • Official Playmaker Support
    • View Profile
Re: global states sanity check
« Reply #2 on: November 11, 2019, 10:43:46 PM »
Hi,

 It's actually a good idea to do that. But I would use them as actual state name.

 make an meta fsm with all these states, and other fsm can check which is the current active state. and that meta fsm will receive global event that will make it transition to the next step or else.

another way that could be even more flexible is to create a set of global events like:

BEFORE CREATION / START
BEFORE CREATION / END
HOLE CREATION / START
HOLE CREATION / END

etc..

and then you can actuall have fsm simply waiting for them global event to know what to do, they don't need to check anywhere, and it's the sum of all your fsm that will then become the sequence, because they all catch and send these events somehow.

Bye,

 Jean


abend

  • Playmaker Newbie
  • *
  • Posts: 25
    • View Profile
Re: global states sanity check
« Reply #3 on: November 11, 2019, 11:51:18 PM »
Thanks Jean!

I also color coded my calls that go out to the global states, much easier to see! And I found the FSM timeline log today, exactly what I need to keep track of whats going on!

Appreciate the reply!