GitHub | Documentation | Become a Patron

Lag compansation example using @gamestdio/timeline in client

  • Hey everyone!

    I'm just experimenting with the framework and have implemented a simple example which moves an object to a random point on the screen.

    onInit(options) {
        // set state
        // ...
        this.setSimulationInterval(() => this.tick(), 1000/30);

    My question is how i can use the Timeline class in client to interpolate the object movement?
    In other words how can i use the timeline snapshots from server in the client?


  • administrators

    Hi @shortid,

    The Timeline is an experimental feature only present for lag compensation on the server-side. I personally haven't seen anybody using it yet. You can add it as a dependency in your client-side and take the snapshots whenever the state updates if you'd like to.

    There's a big difference between lag compensation and client prediction techniques, though. I think you're looking for client-prediction. Unfortunately, the framework doesn't provide an easy way of doing either.