playMaker

Author Topic: Understanding "Every Frame"[SOLVED]  (Read 5238 times)

cdutoit

  • Playmaker Newbie
  • *
  • Posts: 28
Understanding "Every Frame"[SOLVED]
« on: August 14, 2015, 07:31:17 PM »
Hi -

I've really gotten myself confused...and I can't seem to find any documentation on the "every frame" option.

First - I sort of understand Every Frame to be the equivalent of putting code in the Update loop - is this correct or flawed?

Second - Many actions don't have the Every Frame option - so what really happens when I have a state with multiple actions and only one action has the Every Frame checked?

Finally - When I'm developing in playmaker I don't really think in terms of update loops etc, so what is the rule of thumb or guidance on when to use Every Frame. Happy to read any documentation if you have some links.

Thanks much!
« Last Edit: August 15, 2015, 05:36:32 PM by jeanfabre »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Understanding "Every Frame"
« Reply #1 on: August 15, 2015, 12:34:35 AM »
There is an overview of the action life cycle here:
https://hutonggames.fogbugz.com/default.asp?W174

Quote
I sort of understand Every Frame to be the equivalent of putting code in the Update loop - is this correct or flawed?

This is basically correct. An action has discretion to interpret the Every Frame setting differently (e.g. run in FixedUpdate), but most of the time it means run the action in Update.

Quote
Many actions don't have the Every Frame option - so what really happens when I have a state with multiple actions and only one action has the Every Frame checked?

Hopefully the action life cycle document helps answers this.

An action does not have an Every Frame option if:
  • It only makes sense that it should run once (in OnEnter) then finish.
  • The lifetime of the action is implicit in the parameters (e.g., Time in the Wait Action) or the action itself (e.g., Move Towards).
  • The action needs to run every frame to be useful (e.g., Any Key)
  • We forgot to add one :P

Quote
When I'm developing in playmaker I don't really think in terms of update loops etc, so what is the rule of thumb or guidance on when to use Every Frame.

Usually the context makes it clear if an action needs to run Every Frame. Does the action need to update continuously, or can it run once when the State is entered?

Do you have a scenario where the Every Frame flag is confusing? We could work through an example...

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Understanding "Every Frame"
« Reply #2 on: August 15, 2015, 05:32:11 AM »
Finally - When I'm developing in playmaker I don't really think in terms of update loops etc, so what is the rule of thumb or guidance on when to use Every Frame. Happy to read any documentation if you have some links.

Thanks much!

HI,
When you use a "Every Frame" on an action you need the other actions in your state to be above that action or they might not work,
if you have more than 1 action with "Every Frame" selected they will all work in the same state

cdutoit

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Understanding "Every Frame"
« Reply #3 on: August 15, 2015, 08:50:05 AM »
There is an overview of the action life cycle here:
https://hutonggames.fogbugz.com/default.asp?W174

Thank you for the explanation and the link above. It did help (both the link and the explanation. Armed with that knowledge, I'm going to go back and look at the FSM I was struggling with and see if I make more progress.