playMaker

Author Topic: Use "next frame event " With another event  (Read 3517 times)

Abdou23

  • Playmaker Newbie
  • *
  • Posts: 30
Use "next frame event " With another event
« on: August 08, 2014, 11:39:09 PM »
Hello

A Playmaker newbie here, trying to create my first game. I get this error " loop count exceeded maximum 1000" did some search and turns out i have to use the " next frame event action " but what if i already have an action that sends event like " float compare " ?

I am just trying to move a platform right and left.

Edit: Right now i am using "Wait" to accomplish that.
« Last Edit: August 09, 2014, 12:01:11 AM by Abdou23 »

cmonroy

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Use "next frame event " With another event
« Reply #1 on: August 09, 2014, 10:48:41 AM »
Next Frame Event is used to guarantee that the flow from one state goes to the following one. The error you have is probably due to a bad logic in your FSM: check for an infinite loop, for example.

Having a listener state where you check user input (which has the user pressed) would go to a move left or move right state. In each of those two states, you perform the required action and then return to the listener state, which should do nothing else than listen for the keyboard input.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Use "next frame event " With another event
« Reply #2 on: August 11, 2014, 11:36:37 AM »
As a beginner it might be a little confusing to get the infinite loop exception error because you think "well.. I want a loop, so whats the problem?".. But there are good and bad ways to go about repeating and looping.

In most actions that are useful to run every frame there is an Every Frame checkbox. This makes the script/action continue to execute once every frame... Now, if you had a loop where you put Float Compare in the first state, then did a FINISHED event into another empty state, then directly back into the first state it would seem like its doing the same thing, right? Nope. The engine will process that whole entire loop thousands of times per second and be extremely inefficient. It hasn't been told to ever stop. With the Every Frame checkbox it is told to limit its execution to only once per frame so it runs it at the start of the frame, then waits until the next frame to do it again rather than blazing through an unchecked loop.

The key is basically just controlling the rate of things so the computer doesn't get out of hand processing things thousands of times when it shouldn't be.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D