Version 1.0.29
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 Renderer
s 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 parentGameObject
. - Added
config.overwriteObjectRenderable
property andresetObjectRenderable
method toAnimate
behavior. These allow the management of aGameObject
'srenderable
property by itsAnimate
behavior. - Added a
tests
directory and awebworkers
test to demonstrate the new Web Worker support. - Updated documentation to reflect these changes.
Migration
- Remove the
scene
argument from allBehavior
instances and classes. Example:- From:
new Behavior(scene, gameObject, true)
- To:
new Behavior(gameObject, true)
- From:
Full Changelog: v1.0.28...v1.0.29