• Content Count

  • Joined

  • Last visited

About undisputed

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I'm trying to make synchronisation (WASD movement) for MMO game. I read these tutorials: http://buildnewgames.com/real-time-multiplayer/, http://www.gabrielgambetta.com/client-side-prediction-live-demo.html and this is what I got: Client: -player is sending movement info to the server in the update method public update(time: number, delta: number) { if (isPlayerMoving) { var info= { up: this.cursors.up.isDown, down: this.cursors.down.isDown, left: this.cursors.left.isDown, right: this.cursors.right.isDown, timestamp: Date.now(), movementSequenceNumber: player.sequenceNumber++; }; .. if (isMovingLeft) { player.setVelocityX(100); } .. socket.emit('movement', info); } } Server: -authoritative -there are 2 loops (first for physics - position update 60 fps, second for broadcasting other players) -saves received movement inputs from players and then process them in physics loop That would work if the both client and server are running on same frequency (like in those tutorials - there's fixed loop on client). But in Phaser 3 update loop might lag so the delta time is not always 16.67, but it can be higher. This is a problem because physics is still running on Phaser so the player is moving faster than he has to (or the server is moving too slow?). I'm not sure what should I do because if I change the update method just to update the position (not velocity), I would break FPS independency.. So the question is: How and where should I tell the server that the player is moving? Isn't the update method the right place for it?