Skip to content

Version 1.0.29

Compare
Choose a tag to compare
@NotTimTam NotTimTam released this 02 Oct 02:06
· 96 commits to main since this release

Among other changes, this update adds much needed Web Worker support!

Core Changes

Canvas 2D context, as opposed to WebGL context, is notoriously inefficient, due to (among other things) its single-thread CPU-only render method. This library was started as an exercise in fully utilizing 2D context despite its inefficiencies.

Web Worker support removes one of the two main inefficiencies of 2D context, single-thread rendering. For now, web workers are only utilized in the Renderers drawFrame method, but this means rendering is entirely decoupled from the game logic stack, freeing up the main thread for the rest of the logic.

Web Workers are enabled by default, but can be disabled by setting the Runtime constructor's config.renderer.useWebWorkers property to false. This is useful if your target platform/browser doesn't support web workers, or you want your application to be compatible with a wider range of devices.

Additional Changes

  • Removed requirement for Behavior constructors to be passed the active scene. They now get the scene from their parent GameObject.
  • Added config.overwriteObjectRenderable property and resetObjectRenderable method to Animate behavior. These allow the management of a GameObject's renderable property by its Animate behavior.
  • Added a tests directory and a webworkers test to demonstrate the new Web Worker support.
  • Updated documentation to reflect these changes.

Migration

  • Remove the scene argument from all Behavior instances and classes. Example:
    • From: new Behavior(scene, gameObject, true)
    • To: new Behavior(gameObject, true)

Full Changelog: v1.0.28...v1.0.29