Sign in to follow this  
jballaban

Path Mapping

Recommended Posts

Should object paths be calculated by both the client and the server? Just the client or just the server? Both seems unecessary duplication of code, server seems best but that means the client has to wait for a response from the server before setting the object path, client seems the best but which client decides what object takes what path (i.e. when two objects collide and need to move around each other). So basically my questions are, how is an objects path decided, where are the collisions detected and how are they resolved. Note in my specific setup the client is very lightweight and I'm trying to push as much processing as possible to the server.

Share this post


Link to post
Share on other sites
One common technique is for both the client and the server to calculate physics and game logic, using identical code-paths. This allows the client to "predict" the game state. Then the server updates the client every so often (~20 time a second) with the real game state, keeping both of them in sync. The allows the client to be responsive on slower connections, and as long as nothing drastic happens in-between updates the predicted game state and the real game state won't be that different. The real and predicted states might diverge more on slower connections, causing jerkiness, but this is the type of system used in Half-Life 1/2 and with great success. There's actually an article someone describing the prediction used in the Source engine, but I can't remember where I read it.

Share this post


Link to post
Share on other sites
doesnt this belong in Multiplayer and Network Programming ?
anyways the server should always be the head -> the one who does all the computations. The client, instead of doing calculations, it would just interpolate to the positions given by the server (dead reckoning).
IF a collision occurs, the server should inform the client it has collided and not vice versa, so all clients would be in sync with the server.

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