[Request] Condition "On loop finished"

0 favourites
  • 9 posts
From the Asset Store
For Adventure, Action, Heroes, Sci-fi and Action-RPG games.
  • Hi,

    Some loops take longer then 1 tick to complete, therefore would like to request a condition "On Loop Finished".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Which loops? All event-based loops finish synchronously in the same tick. There's no need for a condition for when they finished, because you can just put an event after it and that will run when the above loop finishes.

  • Which loops? All event-based loops finish synchronously in the same tick. There's no need for a condition for when they finished, because you can just put an event after it and that will run when the above loop finishes.

    It's about system loops. They actually seam to take longer then one tick. I'm using 3 "For" loops, to loop trough 96x96x10 array. Takes about a second for results to appear. For now I'm used condition that checks if each loop has reached max field in array to trigger next stage. But in test from month ago, when I used condition that was adding 1 every tick, to change the states of the event's chain, I maybe managed to get dozen of rows with results and the rest was empty. Therefore I assumed it takes longer for loop to run then one tick. Maybe I'm doing it not the right way?

  • No, system loops always complete in the same tick. You must be making a mistake (or, probably very rarely, it's a bug) if it looks like it takes a few ticks to complete, that should never happen and would make loops far more difficult to use usefully.

  • No, system loops always complete in the same tick. You must be making a mistake (or, probably very rarely, it's a bug) if it looks like it takes a few ticks to complete, that should never happen and would make loops far more difficult to use usefully.

    Maybe I've made a mistake. Have no way of checking now. But not so long ago I've seen other topic here with some people having same issue. If I encounter the issue again, will let you know. For now, I'm just switching variables at the end of loops.

  • If you make a very intensive loop, it can cause the game to freeze whilst it does its processing. This freeze means it is making sure that the entire loop completes in 1 tick, and when completed, it will go to the next tick and the game should unfreeze. If your game is not freezing when using big loops, then yeah that's pretty weird lol

  • I do think it's highly unlikely there is an engine bug here because the loops are very widely used and if there were any problems like you describe they would surely have turned up by now already.

  • Iterating 96*96*10 might take a little while.

  • Well, my original code from month ago was something like this

    -State = 0

    -- For "X" Loop, For "Y" loop --> do stuff on array

    -- Set varState to 1

    And it did only show up small percentage of the array results.

    Since then I've came up with new solution, where if all For loop results are equal to all array dimensions, then change varState. And it's working

    Also, this array processing is not an in game event, as it's a map generation chain, so it's ok to wait a bit. But I did made a version that could be run real time, for loop just going trough several rows per tick only, so it doesn't stop the game at all, if I'd want to use some massive array when doing an infinite world for example. Just a tip if anyone would want to know ^^

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