Timelines implementation for lag compensation techniques in networked games. Use it both on server and/or client-side according to your needs.
- Take snapshots of game state
- Interpolates and extrapolates values based on snapshots taken.
createTimeline([ maxSnapshots=10 ])- Create a Timeline instance
Timeline#takeSnapshot( state[, elapsedMs ] )- Record state on timeline history
Timeline#at( elapsedMs[, interpolate=true ] )- Get
Proxyobject containing interpolated values between recorded states.
Timeline#offset( elapsedMs[, interpolate=true ] )- Same as
#at, but from the last snapshot taken.
var timeline =// first game state snapshottimeline
To execute this example run the following command:
node --harmony --harmony-proxies example/usage.js
- Timelines: simplifying the programming of lag compensation for the next generation of networked games