playMaker

Author Topic: On Awake Mimic  (Read 1883 times)

Thore

  • Sr. Member
  • ****
  • Posts: 480
On Awake Mimic
« on: October 04, 2018, 10:51:56 AM »
Hello,

Maybe there is already a way to do this. I look for a good, elegant and robust way to initialize FSMs, to set them up before they can be interrupted by incoming events. Ideal would be an AWAKE global transition that is called on awake, and before START. Another way would be a fake Awake Mimic. It would also be added as a global transition, but would priotize the actions in its state, and only opens the global event transitions once it's done (or perhaps a closing global event is called, similar to Finish();

If there's already a good method that doesn't involve spaghetti, null-check loops etc all over the place etc, or wait-actions and hoping for the best, please let me know :)

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: On Awake Mimic
« Reply #1 on: October 04, 2018, 11:42:55 AM »
Agreed, more global system events like "AWAKE" and various others would really come in handy.

If possible it would be great to have these implemented.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: On Awake Mimic
« Reply #2 on: October 05, 2018, 03:05:36 AM »
Hi,

 the problem is that it can lead to a lot of race conditions that would be worse even than having simple start states.

 when I have to deal with early initialization, I always leave my Start Fsm empty, and use my own INIT state that act as my entry point. and I always have my fsm disable by default, and then I use a manager to enable things up and programmatically call INIT when Iam sure it's the right time.

 even with regular script, awake is sometime not enough, and you have to resort to a custom solution for init procedures.


 Jean