Four player udp game, experiences wanted :)

BlitzMax Forums/BlitzMax Programming/Four player udp game, experiences wanted :)

Semar uses a good technique but remember to use a custom random function- I'm not sure if its still true in Max, but in Blitz3D, the rand() functions wouldn't always return the same values on different machines.

One thing I do is something I dubbed keyframing. Each game counts how many frames of logic have passed- and clients may vary from this value by N frames (the clients who are ahead of the server wait for the server and all over clients to catch up before continuing).

The higher N is, the larger the lag is but the smoother the game runs. If you are close to the server then 0 or 1 frames are good enough.

Our racer send the positional and orientational data of every object *every frame* (not the best method but it worked) and using it with the above "keyframing", I was able to race with our teammates, who live over in the USA, with a value of 3.

For the technique to work you will need to boot players with a weak internet connection- which is fine by me as it solves lag problems, though it might be annoying to the player. The player who has a weak connection will however, likely experience lag anyway, so its for the best.

*sigh* I want to make a networked demo again. In fact, i'm going to go and think some up. It was great fun! :)