Jump to content

real time multiplayer with sockets.io


druphoria
 Share

Recommended Posts

I've recently started developing a real-time multiplayer bomberman clone using Phaser and sockets.io. In order to reduce the effects of latency, I've used a simple version of the entity interpolation algorithm described here: http://www.gabrielgambetta.com/fpm3.html

 

The TLDR of that article is basically this: when updating remote players positions on the client, you don't just update their position to equal the snapshot from the server. Instead, you interpolate between the last known position and the most recent snapshot.

 

I've implemented this in my game. In my server I'm sending out updates of remote player locations at a frequency of once every 100ms. Every time my client receives one of these snapshots, it begins interpolating from the previous known position to this just-received snapshot.

 

Right now, it's only working somewhat. It's playable, but it's definitely not anywhere near as smooth as I would like it. I uploaded it to heroku so that you could check it out:

 

https://limitless-brook-9339.herokuapp.com/

 

Does anyone have any advice on how I could enhance my current strategy of interpolating? Has anyone else here had success getting smooth motion in real time multiplayer?

Link to comment
Share on other sites

To clarify - the jitters are occurring with remote players only. You won't see jitters with your own player's movement because right now I'm using a client-authoritative model (since cheating is not a concern at this point. might move over to doing client-side prediction later on). So to witness the jitters that I'm talking about, you'd want to open the game in two tabs or windows, and then move the player on one window and watch its movement on the other one.

Link to comment
Share on other sites

Have you checked this article?

 

http://gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking/

 

Small quote:

 

… the best of both worlds: In all cases, the server remains completely authoritative. Nearly all the time, the client movement simulation exactly mirrors the client movement carried out by the server, so the client’s position is seldom corrected. Only in the rare case, such as a player getting hit by a rocket, or bumping into an enemy, will the client’s location need to be corrected.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...