Wobbles Futsal Game v0.09a

After a lot of trial and error (and plenty of pain and suffering), I managed to get the two clients to share the server-controlled ball whilst looking and feeling lag free. In reality, only the server knows the true state of the game and position of the ball, but with a small sprinkling of fairy dust you can make it appear that a client is playing with a local ball.

Basically, this is achieved by switching to a local ball whenever the client takes possession. If you don’t do this the ball will feel very laggy when you try to run with it as there is always a delay in what you see coming from the server.

The client and the server each use their own physics engine when kicking the ball. Now, in extreme circumstances this will lead to a desynchronization of the ball position between the client and the server. However for this type of game it is extremely unlikely that there will be enough of a difference for it to be noticeable. Particularly since whenever someone takes possession synchronization is restored.

The client will continue to see the local ball until another player takes possession. At that point, the client will turn off it’s local ball and start viewing the server ball once again. So, when you are out of possession you are seeing what’s actually happening on the server, all be it with a slight delay which will be approximately as long as your ping to the server.

Here’s a short video of this in action.

Leave a Reply

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.