Skip to content
Sign upLog in

socket io multiplayer movement

Profile icon

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


On the client side do something like this:

When key press: send message to server when key release: send message to server

And in the server:

When client joins: {"id": some id, "keyPresses": []} When client presses a key: client.keyPresses.append(key pressed) When client releases a key: Remove key from client.keyPresses Main loop: if(client pressed w is true) move up etc.

I didn't write any exact code since I don't have time to do that and it's up to you to figure that out, but that's the general outline