Skip to content
Sign upLog in

socket io multiplayer movement

Profile icon
rafrafraf

playing around with socket io and made this so far.

its definitely not done and is quite laggy but i think its a cool start

try opening it in 2 tabs and see the movement update on both :)

You are viewing a single comment. View All
Profile icon
realTronsi

@rafrafraf
???

Afaik you're handling movement on the client side, which is a big no-no for these kind of applications. Instead, give each player an array for their key presses on the server side, and on a set interval, move the player. If the player releases the key, send over another message.

That way all players will move at the same speed. Since you're handling movement on the client side right now, players with powerful computers will move faster than players with slower computers.