Networking Pong

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.

if this is not a reasonable route, someone please let me know. i have not started anything on this project because I am trying to lay the groundwork in my head, so I do not waste time getting a whole lot of nowhere. The main reason/difference between the tutorials for SFS server extensions and this one is, I do not believe that any of the SFS serverside extension tutorials show how to sync state information every frame for something that takes place purely on the server like the pong ball.

Maybe asking another question can spur some posts on this thread. Is it possible to create an Update or “Game Loop” on the server with an extension? In other words, can SFS create something like Unity where there is an Update loops as well as other functions that may be called based on other events such as InternalEvents like OnUserJoinRoom, etc. and also ExternalEvents or requests from clients?