[gameprogrammer] Networking

Hi!

I've finally come to the point where I have to put real-time networking into a 
game. My test project for this (and some other technologies, mainly Ogre3D) 
is a simple arcade racing game where you race a bubble over a straight track 
of coloured tiles (a concept I vaguely recall playing on the C64).

The idea is to have two players on the same track. The first player to cross 
the finish line wins. The players may bounce into each other and thus hinder 
the opponent or throw him off the track.

How do I go about implementing the network communication for this? It's not a 
question of libs for me (I've looked through some), but rather of general 
approach. I expect that every logical frame, I send the relevant data to the 
other player. When I receive data from the other side, I update the opponent 
accordingly.

I see two problems here (I have read several articles and tutorials on the 
net, and some of them raise the points I'm about to mention, but none of them 
seem to provide actual ideas how to solve them):

1) I suppose things get out of sync. I can wait for opponent data each frame, 
so the game blocks until this data arrives, but I suppose this would harm the 
overall performance. But if I don't go for complete synchronisation, how can 
I expect player collisions to be detected correctly and, most importantly, in 
the same way on both machines?

2) What is "relevant data" I have to send? Ideally, I would just put the 
changes in player controls (if any) into a message. However, I imagine that 
requires exact sync so the other machine applies these updates at the right 
time. More importantly, I believe I cannot expect both machines to handle 
floating point calculations with the same precision (and I'm trying to use a 
physics engine here as well, meaning I don't have much control over the whole 
precision issue). Should I send exact player data (coordinates, velocity 
etc.) every frame to keep this reliable? Or should I send "simple" updates as 
describe before, and only send exact data for "key frames"?

Obviously I'm new to this (my networking experience so far comes from 
non-gaming apps and a multiplayer Tetris version, which obviously doesn't 
need exact sync), so any help would be welcome.

Thx,
Marian.

-- 
http://www.musgit.com
http://marian.musgit.com

Hofstadter's law: "It always takes longer than you think,
even when you take account of Hofstadter's law".


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: