construct 2 is not so fast after all

  • Can you please explain, how firing actions in the end of the event sheet can avoid skipping? When you developing your games you put "Wait 0" everywhere? Really? I can't even find any info about skipped actions on the forums. Can you show where it's discussed?

    The skipping is not directly mentioned in the manual but the performance and optimization is, and its suggesting the slow downs might skip 1 action or the actions might not perform as well as they should. And thats why Wait 0 was implemented.

    I've re-read all Ashley's tutorials and blog posts about performance and optimisation and events. No suggestions or anything else about action skip. I really think that if a thing like action skip is possible Ashley would have written something about it anywhere, but there's not a word about it.

    Because 1 condition in blank its another maybe 0.001 % tick delay based on the amount of conditions and actions we have in our event sheet, and on large scale games that 0.001% can get pretty high stacking.

    Can't get your point here, blank condition is the same as Every Tick condition, it's even stated in Ashley's blog post.

  • My usage of wait (0):

    In the same event, to make sure previous actions are completed before the next actions after the wait(0) is processed.

    Example:

    event condition = true

    -action set variable x = call function meh (y,z)

    -action wait (0)

    -action set variable a = variable x

    In this example, variable x is set by means of the process in function meh.

    the wait (0) forces the process of the function in order to set the variable x to be completed before moving on to the next action.

    Thus variable a will always be set with the result of function meh which was moved into variable x before the wait.

    In short, the wait(0) allows the previous actions of the same event to be completed prior to moving to the next actions after the wait(0).

    I avoid relying on the wait(0) when it involves a different event, or even a sub event of the event using the wait(0) as its unreliable and merely makes the entire event sheet wait 1 tick before processing further where it was, making it loose data and information or picked objects.

    At least that's how I always see it.

  • lennaert Yeah, when you need to postpone actions till the end of event sheet it's okay, but what about skipped actions mentioned by ? Have you ever noticed this?

  • lennaert Yeah, when you need to postpone actions till the end of event sheet it's okay, but what about skipped actions mentioned by ? Have you ever noticed this?

    I never noticed missed/skipped actions really.

    But I think this has to do with the approach and intended use.

    Like, the following example:

    Global variable x = 1

    -event: Trigger once

    sub event 1 condition x = 1

    -action wait(0)

    -action set x = 2

    -sub event 2 condition x = 2

    -action browser plugin execute js "alert('x is now 2');"

    with the wait(0) disabled, the popup shows.

    Enabled, it might look like it is missing actions

    Toggle the Wait(0) for clarification and restart app.

    example capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Um, if you ever find that variables aren't set instantly, then that is a bug.

    Please report it.

    Just sayin...

  • lennaert Yes, the second event is not firing because with wait(0) x sets to 2 after the event, great example.

    For everyone, who get confused over the skipped actions, no matter the framerate, actions can't be skipped, i made a .capx demonstrating this. The heavy and laggy function is called and increase "var2" variable by one for 8797899 times (to hang the game for 5-10 seconds), then another function is called and set "var3" variable to "var2", and both values are always equal to 8797899, no action is skipped, no bad values written, when a function is called, the game hangs and the following actions are not even happening before it finishes (If you not using actions that don't give a result immediately, like destroying object, but even if using, this action will not be skipped, it will fire, but the system can destroy objects only in the end of tick, that's why you need to use Wait(0) after them to fire the following actions after destroy.).

    .capx

  • lennaert Your examples are poor. There is no reason a Wait 0 is needed in your function example, and the reason Wait 0 doesn't work in this example is because the Trigger once, which is an abuse of Trigger once, will prevent x=2 from being evaluated. The X=2 condition would nee to be a subevent of x=1 to work with Wait.

    Wait 0 is rarely required.

  • Sisyphus

    Yep, i am guessing the whole missed actions is a bit of a myth which finds it's origin in incorrect expectations.

    lennaert Your examples are poor. There is no reason a Wait 0 is needed in your function example, and the reason Wait 0 doesn't work in this example is because the Trigger once, which is an abuse of Trigger once, will prevent x=2 from being evaluated. The X=2 condition would nee to be a subevent of x=1 to work with Wait.

    Wait 0 is rarely required.

    That depends on whats in the function meh, blackhornet.

    But you are right, the examples might seem poor to a more advanced developer as they would not need it nor require it.

    But there are quite a few here which do not understand the use and mis-use it....

    The trigger once execution was actually a very good example in demonstrating the working of wait(0) .... whether it is useful or not was not really the point.

  • blackhornet He just wanted to show, how not to use Wait 0

  • lennaert

    newt

    well as i said in the above post its not happening everytime depends on how cluttered the project is and depends on the hardware that runs on.

    for example i had run some projects on mobile that was basically unusable because the system was skipping or reading the events sheet with delays.

    Sisyphus

    here is a example capx with multiple empty events filtered trough functions.

    you will notice a 0.1 -0.2 cpu utilization fluctuation depending on your system, instruction can be found in template

    Edited: And that example is only using 50 objects moving 1 px and thats it... imagine having 100 or 300 moving jumping or adding effects on it... the cpu wold "explode" or app wold crash on most of mobiles/browsers [/code:33n4anit]
    
    when you start the test leave it 1-2 seconds to get a stable point
  • Well, you can use any other condition not just empty, and there'll be even more lags. But it doesn't matter how laggy the project is, the actions never can be skipped, if you are having your actions skipped then you should report this as a bug for sure. You can check my .capx above with a heavy and laggy function, it frozes the game for 5-10 seconds, but no following actions are skipped and no wrong values.

  • Well, you can use any other condition not just empty, and there'll be even more lags. But it doesn't matter how laggy the project is, the actions never can be skipped, if you are having your actions skipped then you should report this as a bug for sure. You can check my .capx above with a heavy and laggy function, it frozes the game for 5-10 seconds, but no following actions are skipped and no wrong values.

    well yes but your capx that repeats "8797899" its not a actual "laggy example" caused by the function filtering but mostly cause you used repeating that action to many times. which of course wold freeze or delay the system until the "8797899" repeats are finished and then the right value wold be written.

    but on my capx you dont have no repeats and cpu increases ... on higher amount of objects (bigger projects) that type of unoptimization wold cause a freeze or cpu spikes that wold make the game/app act like skipping and you will start seeing objects going haywire or objects passing trough walls, or objects just not doing nothing or reacting to late. by "skipping" i meant not responding in the same order it should no matter the browser fps or delay of system.

    and of course im not using that type of event hierarchy i just said most people do use them and its a bad example of usage that may lead to freezes that visually look as a action or event is "skipped".

    maybe "skipping" is not the best term to use here.

    let me create a type of example infinity run like where i encountered the "skip of a action"..(edited: but i dont think you wold face any skippings nor i at the moment on my current rig) this types of so called skipping where happening on a older rig i had a few months back. now even if i manage to replicate it i wont notice it since my current rig its just awesome lol... i have some projects i could share and you could run as a test on mobiles or ur pc but requires premium plugins so... need to basically replicate those in a free way.

    anyway im not complaining about it cause by this time i learnt to work around those issues. but you asked

  • You can set a time to be 0.001 I believe.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)