Sign in to follow this  
lgmcben

Question about Counter Strike's Client/Server synchronization method.

Recommended Posts

I'd like to hear from experts out there about the method of data synchronization used in Counter Strike. Do every clients send data to each other? Or the one hosting the game do all the synchronization? Any links to the site with the info would be great. Thank you. /bow

Share this post


Link to post
Share on other sites
it's a client-server architecture. one game (the server) calculates all the physics, object states, bullet trajectories, explosions, damage, then send them back to all the connected clients, so thy can play sounds, do animations and so on.

Each client also run prediction code on the local player physics, to avoid lag in the controls, and server verifies that the client isn't cheating by moving too fast or too slow. Also, with other players around, a client can't predict accurately where another player will be (because of lag), so the server corrects your position when you are running into another player. You can see that happening when two player run side by side, and the movement isn't smooth anymore but it stutters (as the server 'corrects' both players' positions while you bump into him in the wrong predicted position).

Also prediction is run on weapon controls, so you don't have hickups in the rate of fire of machine guns and so on. In the old CS, you can turn that off and sync the gun with server messages (can't remember the command), and you will see the gun firing with (obviously) added latency, and random rates of fire. You will also see times when rounds don't go off, hence the 'missing' bullet effect, due to packet loss (the 'fire bullet' message sent by the client to the server has been lost along the line). It could also be the server's 'do fire effect' message getting lost as well (which is less of a problem).

for ragdolls in CS:S, each client runs its own ragdoll physics locally (the server doesn't even have to), since it's expensive to synchronise ragdolls (several limbs with position and orientation changes, a lot of data to send). This is why ragdolls in CS:S (and other games, like UT2004) don't actually interact with anything but the static environment, so the fact that they become out of sync doesn't create problems. They are not synchronised, but they don't stop bullets, and players moving about, and don't interfere with the game play, so that's all right.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this