Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Kanaris

Pages: [1]
1
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.

Pages: [1]