timeframe
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.
API
createTimeline([ maxSnapshots=10 ])
- Create a Timeline instanceTimeline#takeSnapshot( state[, elapsedMs ] )
- Record state on timeline historyTimeline#at( elapsedMs[, interpolate=true ] )
- GetProxy
object containing interpolated values between recorded states.Timeline#offset( elapsedMs[, interpolate=true ] )
- Same as#at
, but from the last snapshot taken.
Example
var timeline = // first game state snapshottimeline
To execute this example run the following command:
node --harmony --harmony-proxies example/usage.js
References
License
MIT