• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Instance Order != Event Order?

obscene

Member
I've been experimenting with my in-game debugger trying to see if I can measure the impact of code in each Begin/Step/End/Alarms etc. Everything I know about GM says this is impossible to do accurately, but I just wanted to see where I could take it.

Basically this is done by using get_timer() in each of these events in the debugger. Importantly, the debugger object is the first instance created in the game through creation code in the first room, though I've also tried placing them in the room and using the instance creation order in the room editor.

I have no events in the Begin Step or End Step in any instance in the game (except the debugger itself), I'm only using Step or repeating Alarm[1] events.

upload_2019-3-15_10-6-31.png

A few issues I wanted some feedback on. First, the Begin Step time is calculated in Alarm[0].If I place any code in a repeating alarm[0] for any other instances in the game, the Begin Step graph jumps up So despite the fact my debugger is the first instance in-game, it's alarm[0] isn't running before the others. This is why I use alarm[1] for other instances. Apparently alarms execute in order.

End Step is harder though. Like I said, I have nothing in the End Step and you can definitely see some action on the graph. I am generating waves of particles in the Step Event. At first I thought this must be GM internally calculating particle movements in the End Step? Not sure. However, another issue. I tried moving several instances into the End Step to see if the graph shifted from Step to End. It didn't. So again it looks like the debugger may not be executing its events first despite the fact it's the first instance.

So.... fool's errand?
 
Last edited:

FrostyCat

Redemption Seeker
Anything that depends on instance ordering is a fool's errand in my book. You can't win when your design creates race conditions and makes the user experience depend on which horse wins. Beyond what's stated in the Manual's entry for Event Order, don't make any assumptions on what comes first.
 

TheouAegis

Member
Instance order has been somewhat Irrelevant for years now. I'm not even sure if it was even relevant in GM 8. Top priority is the event. GM will go through each event, then going through every object to see if that object has the corresponding event, then going through all of the instances of that object according to instance order to run that event. The draw event is the difference, where GM will compile a list based on the depth first, but even then I think it's still depth-object-instance. instance order was only ever really dominant in studio during the room generation event.

And if you are using studio 2, well, don't rely on anything. LOL
 
Top