0 Favourites

Non-Deterministic Sequential Loop Problem

  • Hello

    I have a For Loop that runs without his pack of different animation to multiple objects of the same type operations. The problem is that I need to ensure that the next iteration of For Loop attached is performed when all animations of all objects of the body have the For Loop is closed.

    After developing the whole game, I got in this situation in the next iteration of the object depends on the state previous animation or type of the object. If I use Wait, I have not determinism, because I can not guarantee the amount of time the body will use the For Loop iteration.

    Any suggestions?

    Thank you.

  • Err... Could you please explain it with more detail, probably with an example I couldn't make out what exactly you are asking for...

    For every object, you can have an instance variable, that turns 0 when loop is running and 1 when loop is not running.

    Then, after the completion of each loop, you can loop through the objects and count the number of 1's. When none of them is 1, you can do next iteration... I think...

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I have something like below in "Loop Event"

    |---loop 1---|
         |---loop 2---|
              |---loop 3---|
                   |---loop 4---|
                        |---loop 5---|
    [/code:3an33utc]
    But the problem is that I need the first loop has been executed completely for the next iteration is executed correctly. As the second loop may start is starting parallel to the first loop, the second loop the result will be incorrect as the result of the first loop has not been fully calculated, and therefore, is also wrong.
    
    I need some loop like (sequentially)
    [code:3an33utc]
    |---loop 1---||---loop 2---||---loop 3---||---loop 4---||---loop 5---|
    [/code:3an33utc]
    one after one;
    
    But the problem is that I need the first loop has been executed completely for the next iteration is executed correctly. As the second loop may start is starting parallel to the first loop, the second loop the result will be incorrect as the result of the first loop has not been fully calculated, and therefore, is also wrong. 
    
    Added two cases where only changed the runtime of these two loops with Wait 1.0. 
    Suppose that is 1.0 Wait time processing and some other function that may last varying time. 
    
    If the loop were sequential, the result would always be correct regardless of the time that each block of the loop had. 
    As these blocks of shares of loops are executed in parallel, it can not guarantee determinism, ie, the result will always be correct for a given system configuration.
    
    =D
  • The C2 events don t work concurently, having one loop in an event, and another loop the event under it, will make it so the first loop is entirely done before the second (I don't have C2 right now so I cannot open your capx files).

  • [quote:2iwzuk2s]

    C2 does not run the loops one after another, waiting for the previous iteration to finish. As a matter of fact, this is not even technically a loop. A loop is usually understood as something that runs to the end and then 'loops'.

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