The Elm Architecture, specialized for games.
Key points:
- Instead of reacting to events, application state is updated on regular intervals
- The engine collects all input events (keys up/down, mouse movement, button clicks, possibly joysticks, game pads)
- User of this library specifies how to translate diffs in input events to game actions
- Instead of a single "update" function, there are several specialized functions
- physics update
- given a current state (which should include things like position and velocity) and a time delta, provide a new state
- run on regular intervals, as often as possible
- input update
- given changes in user input, update the state
- physics update
- instead of drawing virtual dom in response to events...
- draw on a canvas
- at intervals that are synced with animation frames