playMaker

Author Topic: How does "Action sequence" work?  (Read 6916 times)

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
How does "Action sequence" work?
« on: December 13, 2013, 07:36:18 AM »
I dont understand what its good for? I cant find any documentation about it...

Only from the release notes: "Action Sequences. State setting to play each action in a state in turn. Each action must finish before the next one will start."

Sounds like the usual behaviour of states to me????

Andy22

  • Junior Playmaker
  • **
  • Posts: 99
Re: How does "Action sequence" work?
« Reply #1 on: December 13, 2013, 08:23:09 AM »
Sounds like the usual behaviour of states to me????

Similar, but with a important difference, normally all actions execute in order directly after the state is entered. "In order" here means each OnEnter() function is directly sequentially entered for all actions on a state and the state only "finishes" if all actions did finish.

With sequence enabled, the next action is only executed (OnEnter) after the previous action did already "Finish" via Finish().

This allows u to write a sequence of actions that execute over several frames, like PlayAnimation/Tween/PlaySound. Before u had to split this sequence logic up in several states.

Example: PlayAnimation (wait for Finish)--> PlaySound (wait for Finish)--> SendEvent

Without the sequence feature the animation/sound/event would all fire at the beginning/entering of the state.

bye Andy
« Last Edit: December 13, 2013, 08:27:44 AM by Andy22 »

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: How does "Action sequence" work?
« Reply #2 on: December 13, 2013, 08:36:50 AM »
uhh thats important info. I always thought that states work this way without needing the "sequence" feature. Actually my hole game is based on this expectation....

Thanks for clarification!


Andy22

  • Junior Playmaker
  • **
  • Posts: 99
Re: How does "Action sequence" work?
« Reply #3 on: December 13, 2013, 08:53:13 AM »
I always thought that states work this way without needing the "sequence" feature.

States do, but not actions.
This means if u use the default "FINISHED" event as transition all is fine.
The problem is, u would need 3 different states all wired up with the "FINISHED" event to get my above example running, without the action sequence feature.

This is a very important design difference, it can make FSM's much more easy to setup and maintain, while it can also make them more rigid and inflexible. So its up to u to decide how to "sequence" game logic.

bye Andy

lukew

  • Playmaker Newbie
  • *
  • Posts: 34
Re: How does "Action sequence" work?
« Reply #4 on: November 03, 2015, 04:42:11 AM »
Sorry for bumping old thread but I have a related question.

Are actions in sequence always executed with "one action per frame" rule? Or maybe it's possible that some actions would be executed faster than 'one per frame' but the sequence order will still be used? So, for example, a sequence with 10 actions would be finished in less than 10 frames?

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: How does "Action sequence" work?
« Reply #5 on: November 03, 2015, 08:54:55 AM »
Action sequences are not frame bound afaik. They are executed as fast as non action sequences in my experience and i use them a lot. Of course if you use an action which will need some time to finish ( e.g. A tween of 1 second) it will take longer than frame .
I wonder what get you to the assumption that there is a one action per frame rule?

Just for your interest: there can even be multiple states executed in one frame (actually i wonder where the limit is)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: How does "Action sequence" work?
« Reply #6 on: November 03, 2015, 09:09:33 AM »
Action Sequence tells the current state that before you tell the next action in the stack to 'go'... wait for the current action to be finished completely.

Think of it like foot racers in a line, but some Overseer walks across the starting line and says "ok, you go" then that racer runs all the way around the track and back to the start and says "ok, I'm back", then the Overseer steps to the next racer and says "alright, your turn, go"... Until all of the racers have gone. The actions take turns and only one can run at any given time.

This means that any action that has "every frame" turned on will stop the sequence since it never finishes.

It can also happen just as fast as normal, so it could appear that there is no difference technically, but there is indeed.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 6511
    • jinxtergames
Re: How does "Action sequence" work?
« Reply #7 on: November 03, 2015, 05:29:32 PM »
Hi,
the easiest way to see how Sequence work is: create a state and add 5x a "wait" action and leave it to 1 sec, add a FINISH Transition and create another state and connect FINISH to it,

Then play it with and without Sequence to see the difference

try also setting one wait action in between to 5 and without Sequence.
Ecosystem might not work at the moment
here are direct Github Links to the custom actions :
https://github.com/PlayMakerEcosystem
https://github.com/jeanfabre


Join the PlayMaker Discord Channel!