I'm currently developing a HTML5 Canvas Multiplayer Game using NodeJS and Socket.IO. My current setup using a logic loop on the NodeJS Server-end and sending update information to all Clients in this loop 60x a second. For obvious reasons, this isn't feasible, and even with one player, it doesn't work as I'd like it to.
I'm not a networking genius nor am I an experienced Game Dev, but is there any way for Node and my Client(s) to "share" variables so that I'd have no need to send packets like this? Or any way in which I could improve my current situation?
Current workflow:
- Client sends keypress action to the Server via a packet
- Server adds it to a queue and in the Logic loop will calculate movement and update the server-side Player Entity accordingly
- Game loop also sends these updates to all other Players in the same Socket.IO Room at 60x a second
- Client takes their finger off the movement key(s) and sends this action to the server
- Logic loop removes the movement from the queue
Thanks in advance, please let me know if there is anymore information you'd need