Fangames > Game Design

Some observations about Event Order and other Studio mechanics

(1/1)

Kanaris:
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.

KingThe SlendyKiller:
Thanks for doing this, maybe it'll be useful to me :atkHappy:

L4Vo5:

--- Quote from: Kanaris on November 15, 2016, 12:09:51 PM ---

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

--- End quote ---
What? why?

BaronBlade:
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.

Navigation

[0] Message Index

Go to full version