Fandom

CraftStudio Wiki

Game loop

56pages on
this wiki
Add New Page
Comments0 Share

The game loop is the repeating chain of events that runs your game.

It's still rough and will most likely evolve in future versions to be more reliable / consistent.

Deprecated wikiEdit

1379540211 519791-101 Warning

This wiki is no longer updated Edit

Go check out the new wiki at learn.craftstud.io

Execution OrderEdit

A few things to consider:

  • Currently, the game loop walks through the game object tree depth-first and updates each component of each object in the order they were created. It might make more sense to update all components and scripts of the same type together, both for performance (better cache coherence) and consistency reasons.
  • Starting with Runtime 0.1.6.0, a Camera's transform is properly computed just before rendering happens so cameras won't lag behind other objects anymore, even if the Camera component is located before a Scripted Behavior component that updates the transform in a game object.
  • The Behavior:Update() function is currently called 60 times a second and the game loop will try to catch up by skipping rendering and doing updates several times in a row if the game is laggy. This might change in the future so that Update() is called as often as possible with the elapsed time as an argument and a Tick() or FixedUpdate() function would then be added with the current behavior. This would of course be added with a new API version to avoid breaking existing scripts.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.