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.useTimeline();
        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?

    cheers!


  • 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.


Log in to reply
 

Looks like your connection to Colyseus Forum was lost, please wait while we try to reconnect.