[racket] universal Pong question

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Sun Jul 25 15:29:46 EDT 2010

> Obviously, each world needs to report on the position of the paddle
> (left or right) that its player controls, but what about the ball?
> Should I just let the worlds handle that with on-tick, or should I
> check that the ball is in the same spot on both worlds every so often,
> or should I have the universe server control the ball and tell the
> world everything except their own paddle position each time something
> changes?

In terms of generic network programming, you should only send 
non-deterministic events (movement of the paddle) and let the clients 
figure out the movement of the ball.

I would send all paddle movements between clients and an extra message 
for when the ball hits a paddle that contains the position of the paddle 
and ball, to ensure that the other client starts from the right state 
when the ball bounces.


Posted on the users mailing list.