I Wanna Community

Some observations about Event Order and other Studio mechanics

0 Members and 1 Guest are viewing this topic.

Offline Kanaris

  • 5
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 54.0.2840.99 Chrome 54.0.2840.99
  • Playstyle: Keyboard
Some observations about Event Order and other Studio mechanics
« on: November 15, 2016, 12:09:51 PM »
The following was tested in Gamemaker: Studio (v1.4.1763) on Windows 7.
Most of the important aspects of Event Order in Studio are covered in Klazen's tutorial, but I had some issues related to Event Order and couldn't find anything useful on google, so I decided to run some experiments. Most of the info here isn't new, or is nigh useless. Nevertheless, I wanted to collate the information so that maybe I can help people.
Each event is run for every object in your game before moving on to the next event, and from previous research, which object runs first seems to be determined by its order in the Objects folder in your project.

Initialisation Events:


  • Create Event
  • Instance Creation Code
  • Game Start
  • Room Creation Code
  • Room Start


Step Events:

  • Begin Step
  • Timeline Moment (object order)
  • Alarm[0 .. 11] (lowest alarm, earliest object -> lowest alarm, latest object -> next highest alarm, earliest object.. etc..)
  • Keyboard state check
  • Keyboard pressed
  • Keyboard release
  • Mouse state check
  • Global Mouse state check
  • Mouse Pressed
  • Global Mouse pressed
  • Mouse release
  • Global Mouse released
  • Normal Step
  • Movement and Collision events (Gravity applied to speed, speed applied to position. No idea about friction.)
  • Other – Outside Room
  • Other – Intersect Boundary
  • End Step


Draw Events:

  • Pre-draw
  • Draw begin
  • Draw normal
  • Draw end
  • Post-draw
  • Draw GUI begin
  • Draw GUI normal
  • Draw GUI End


Some observations..


  • Due to the positioning of the Alarm Event, if you set an alarm to 1 in the Begin Step Event, it will execute its code immediately after the Begin Step Event.

  • When you use instance_create, the Create Event of the instance you’re creating is run immediately. However, the instance is not included in the list of current instances until the event is over for all current instances. This means that if instance_create was called during the Normal Step Event, the created instance won’t run its Normal Step Event, but will run all subsequent events such as End Step and Collision Events.

  • If you press and release A/D once every step you can actually run at 4 pixels/frame instead of 3 :O

  • The key/mouse events can seemingly only run once per step, regardless of how many times you press and release them.

  • A timeline can be used by multiple instances. Each instance reads a duplicate that is completely independent of the duplicates each other reads.

  • You can set an instance’s depth variable during the draw events, but it won’t update until after the draw events, because GM only reads it once at the beginning (not exactly sure where, but definitely before Begin Draw) and uses that depth to order the draw events for each instance.


Thanks for reading. I hope this helps someone.

Offline KingThe SlendyKiller

  • 25
  • I'm the King owo
  • OS:
  • Windows 10 Windows 10
  • Browser:
  • Chrome 54.0.2840.71 Chrome 54.0.2840.71
  • Playstyle: Keyboard
Re: Some observations about Event Order and other Studio mechanics
« Reply #1 on: November 15, 2016, 12:21:02 PM »
Thanks for doing this, maybe it'll be useful to me :atkHappy:

Offline L4Vo5

  • 59
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 54.0.2840.87 Chrome 54.0.2840.87
  • Playstyle: Keyboard
Re: Some observations about Event Order and other Studio mechanics
« Reply #2 on: November 16, 2016, 08:29:49 AM »

  • If you press and release A/D once every step you can actually run at 4 pixels/frame instead of 3 :O

What? why?
I have to admit, i still haven't beaten IWBTG

Offline BaronBlade

  • 140
  • bees?
  • OS:
  • Windows 10 Windows 10
  • Browser:
  • Chrome 54.0.2840.87 Chrome 54.0.2840.87
  • Playstyle: Keyboard
Re: Some observations about Event Order and other Studio mechanics
« Reply #3 on: November 16, 2016, 09:02:26 AM »
That only applies if you have a/d align enabled; since pressing a or d moves you a pixel, doing so every frame effectively moves you 1 pixel/frame. depending on which, you can add this speed to either arrow key to move at either 2 pixels/frame or 4 pixels/frame.
bean!