Why does the order of the events affect the program?

0 favourites
  • 11 posts
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • I have many events in my event sheet. Many of them are connected with each other and they cause bugs when they are in a certain order. If I try moving their places (like, more closer one to another), they work properly, just as I want them to. But, if they are further one from another, they cause very stupid problems for which I waste hours examining my events, even though everything's in the right place.

    So why does the order of the events affect their actions?? Is there a solution for this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It all depends....on many things.

    Are they sub-events? Conditions?

    Events/actions are read from top down.

    Think of throwing a ball at a window. The window can't and won't break unless the ball is thrown first. And then if there are other things preventing the ball from hitting the window. Such as a person walks in between the ball being thrown and the window. The ball won't ever hit the window because it hit the person first.

    It took me a long time to understand this. Even now, i have to look over my logic to make sure everything is in its right order.

    Maybe you could upload a capx or screenshot, we'd be able to better help.

  • And what about events that occur every tick, but can't be merged into one event?

    I have used many softwares but this is something new for me.

    And yes, I'm not talking about sub-events or conditions, I'm talking about separate events.

  • It is because the engine logic is sequential and based on a single core. Which means the code reading have a start and an end. Using multiple cores to read the same code would cause many logic problems. For everything else though It already uses multiple cores but not for the events.

    Ashley posted about this a while ago.

    https://www.scirra.com/blog/ashley/20/w ... n-one-core

  • Just remember that things are executed top down in the event sheets and there shouldnt be any problems. If things dont work properly because they are spaced too far apart it just means you have events in between that affect your conditions.

  • What can affect an "Every Tick" condition?

  • What can affect an "Every Tick" condition?

    Not sure your question make a lot of sense?

    An every tick condition is what happens by default if an event in C2 doesn't have any conditions that would change the rate at which it is checked. By default this is 60 times a second. So when you ask what can affect an "Every tick" condition, the obvious answer would be nothing, as it have nothing that can be affected . But im pretty sure that weren't what you meant with the question, can you elaborate?

  • Just remember that things are executed top down in the event sheets and there shouldnt be any problems. If things dont work properly because they are spaced too far apart it just means you have events in between that affect your conditions.

    The question was refered to GenkiGenga's post.

  • All root events execute on every tick (without extra conditions), whether you specify "Every Tick" or not.

    Just remember that things are executed top down in the event sheets and there shouldnt be any problems. If things dont work properly because they are spaced too far apart it just means you have events in between that affect your conditions.

    I don't think this is true.

    The only synchronous events are those underneath a global event. All of the global events execute asynchronously every tick, so you have no guarantee of execution order for non-conditioned global events.

    EDIT: Although, I can't seem to build a basic Construct capx that shows this... so, it may be true.

    They definitely execute every tick though (or as quickly as possible).

  • It's true, events are run top to bottom. However triggers (they have a green arrow to the left) are only run when they are triggered, but if there is more than one of the same trigger they are run top to bottom. Basically you could move the triggers around and the game will run the same as long as they have the same order. "on collision" and the gampad triggers are the exceptions. They are not real triggers, and are run in order with everything else in the event sheet.

  • Good points guys.

    Sorry for not replying I didn't get a notification till now. My response was more aimed at the general "why does the order of my events break my game" than the every tick question.

    To clarify I just mean that if things are working as intended when the code is in one formation and then you simply change the order of the logic and it stops working - then obviously a condition has changed that prevents it from playing out properly.

    Even with every tick events you can see the nature of the top down execution. Create two every tick events, one above the other. In the top one set a variable to 1, in the bottom event set that same variable to 2 - it will always come out as the bottom event at the end of each pass of the event sheet, but things can happen inbetween these everytick events.

    Here is a capx that shows that shows what I mean pretty clearly:

    https://dl.dropboxusercontent.com/u/133 ... %20op.capx

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