i have had a new train of thought for a multiplayer pong game that uses SFS server and its server side extensions.
this will help to control the possibility of cheating (which in the case of pong is not really that much, but i figured that experimenting with this “server-side protection” would be a good idea at the most simple level)
Here are the steps taken:
(1) the server initializes the players’ starting paddle positions
(2) the server generates the ball and its starting direction or force
(3) the server receives inputs from both players for their requested paddle positions
…
(4) if the requested positions and the ball position (or maybe you give it collision bounds) collide, then the server will calculate a new direction for the ball
(5) if the ball’s position falls outside a certain bounds then one of the players has scored a point
…
(6) give the correct player a point and re-initialize the ball
…
(7) if one of the player’s scores reaches maybe 5 points, then the game is over
…
my main question is how can i update that ball’s position every “Update” so that i can send that information to the clients? is that even possible? i do not want the clients to control the ball at all, then ball should just react on the server’s calculations for collision, scoring, ect.