I want to make a 2 player pong game that uses websockets and node.js server. socket.io is used on both client and server. So far, my only experience is creating a chat application.
This is my first attempt at a multiplayer game so I'm not so familiar with network gaming. Should the server keep track of:
- Every position the ball is at and how often or when?
- player movement, player move left or right, what if I press and hold for awhile, how do I handle this? Should I send like a
pressHoldStartPosition
andpressHoldStopPosition
? I guess this is easy if I only allow pressing but not holding down.
My thoughts:
- When the ball hits a player, the client calculates velocity, start and end position and the other client should perform the correct animation from that.
- No idea.