Skip to content

Main loop

  1. prestep event. Global Managers like Input and Sound update.
    1. trigger game.sound.update()
  2. step event. User-land code and plugins
    • Register event'step', function(time, delta){
      }, scope);
  3. Update the Scene Manager and all active Scenes
    1. preupdate event
      • Register event'preupdate', function(time, delta){
        }, scope);
      • InputPlugin.preUpdate()
      • TweenManager.preUpdate() to arrange active targets
      • UpdateList.preUpdate(), to arrange game objects in UpdateList
    2. update event
      • Register event'update', function(time, delta){
        }, scope);
      • TweenManager.update(), to run active tweens
      • UpdateList.update
        • gameObject.preUpdate
      • Update arcade world
    3. scene.update()
    4. postupdate event
      • Register event'postupdate', function(time, delta){
        }, scope);
  4. poststep event. Final event before rendering starts.
    • Register event'poststep', function(time, delta){
      }, scope);
  5. game.renderer.preRender()
  6. prerender event
    • Register event'prerender', function(renderer, time, delta){
      }, scope);
  7. SceneManager.render()
    1. Sort display list
    2. prerender event
      • Register event'prerender', function(renderer){
        }, scope);
    3. Render cameras
    4. render event
      • Register event'render', function(renderer){
        }, scope);
  8. game.renderer.postRender()
  9. postrender event. Final event before the step repeats.
    • Register event'postrender', function(renderer, time, delta){
      }, scope);


Each scene is a standalone system.

Flow chart

Game loop

graph TB

subgraph Render
GameEventPreRender>" prerender"]
SceneManagerRender["SceneManager.render()<br>...See 'Scene steps'..."]
GameEventPostRender>" postrender"]

subgraph Step
GameEventPreStep>" prestep<br><br>sound.update()"]
GameEventStep>" step"]
SceneManagerUpdate["SceneManager.update()<br>...See 'Scene steps'..."]
GameEventPostStep>" poststep"]

GameEventPreStep --> GameEventStep
GameEventStep --> SceneManagerUpdate
SceneManagerUpdate --> GameEventPostStep
GameEventPostStep --> GameRenderPreRender
GameRenderPreRender --> GameEventPreRender
GameEventPreRender --> SceneManagerRender
SceneManagerRender --> GameRenderPostRender
GameRenderPostRender --> GameEventPostRender
GameEventPostRender --> GameEventPreStep

Scene steps

graph TB

subgraph Render
SceneEventPreRender>" prerender"]
SceneEventRender>" render"]

subgraph Update
SceneEventPreUpdate>" preupdate<br><br>InputPlugin.preUpdate()<br>TweenManager.preUpdate()<br>UpdateList.preUpdate()"]
SceneEventUpdate>" update<br><br>TweenManager.update()<br>UpdateList.update()<br>gameObject.preUpdate()"]
SceneEventPostUpdate>" postupdate"]

SceneEventPreUpdate --> SceneEventUpdate
SceneEventUpdate --> SceneUpdate
SceneUpdate --> SceneEventPostUpdate

SceneEventPostUpdate -.-> SceneEventPreRender
SceneEventPreRender --> SceneCameraRender
SceneCameraRender --> SceneEventRender

Rendering order

  • For each scene from bottom to top, in game
    • For each camera from bottom to top, in scene
      • For each game object from bottom to top in scene's displayList
        • Render this game object
          • Render children game objects, if game object is a container or a layer


A game object can be seen by all cameras of this scene, therefore game object could be rendering more than one times.

See also Ignore game object