playMaker

Author Topic: Playmaker's general rule  (Read 1236 times)

TVISARL

  • Junior Playmaker
  • **
  • Posts: 50
Playmaker's general rule
« on: December 25, 2019, 05:46:05 AM »
Hi, all !

Most of you will find this post ridiculous, but please consider that I am only a Frenchman. As such, I am crazy and I NEED to be given the general rule. After which, applying it to different cases is my own affair.

As I understand it, when an FSM starts, the Start event fires and every single subsequent action is subordinated to it.

Every single subsequent action ? No. The actions that have "Every frame" checked are in fact carried out in the Update loop and they MUST be part of an actual loop in the FSM.

Correct ? If so, I have another question.

I may need FSMs that are run only once. So, they don't have anything for the Update loop, everything is for the Start event. What is the correct way to terminate them ? Just stop adding actions or using a special one ? Because some of them just freeze the game and prompt me to post strange messages in the forum.

To solve these problems I usually check "Every Frame" everywhere, a brute force solution, and the game no longer freezes. But I'm not happy about that.

Thanks in advance.
« Last Edit: December 25, 2019, 06:14:57 AM by TVISARL »

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Playmaker's general rule
« Reply #1 on: December 25, 2019, 03:45:04 PM »
Put finished and let the last state send the event to controller fsm which will disable it?
Available for Playmaker work

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Playmaker's general rule
« Reply #2 on: December 25, 2019, 04:06:00 PM »
The START event fires, then “entering” the connected state. Actions have typically an OnEnter function. These are executed one action after another, from the top down when entering the state. When the action is done, it returns Finished(). When all actions did this, and the state has a finished event, the finish event is fired, leaving the state. When actions have everyFrame, that code is executed on update, and every frame. Then, this action does not return finished, and cannot trigger the finish event. When you switch the state to sequence (right click), then each action must first be finished before the next in the list is started.

When you want to use every frame for a limited time, you must leave the state. To do this, you just need to make a custom event  that is triggered through some condition. The easiest is probably the wait action.

Let’s say your state has a few every frame actions, and one wait action, then the actions runs every frame for a duration, until the wait action moves the fsm to the connected state.
« Last Edit: December 25, 2019, 04:10:46 PM by Thore »

TVISARL

  • Junior Playmaker
  • **
  • Posts: 50
Re: Playmaker's general rule
« Reply #3 on: December 26, 2019, 01:34:20 AM »
Many thanks :-)