• Advertisement
Sign in to follow this  

who does the physics?

This topic is 4273 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Say we have a multiplayer game like quake. How is game physics simulated? I would assume it must be done on one players computer (a host) and the others connect to it? Or is it somehow distributed between them? I am asking this because I guess if each player used the physics engine then there would be problems. As a physics engine is kind of like a server in that its all in one place. Like a black box. You put the forces in and the object positions come out. I can't see how this would be distributed. So one player simulates the physics right? hmm :O

Share this post


Link to post
Share on other sites
Advertisement
Usually, yes. If each machine has to handle it's own physics for some reason, you can send info that will sync the two every once in a while, but often you will just simulate on one machine and then send the data to all of the clients.

Of course, IANANP (I am not a network programmer)

Share this post


Link to post
Share on other sites
Well in a game like quake, the physics can be divided up into pretty much 2 catagories.

1: Things that effect the player[s] directly, and their ability to navigate the map
2: Extra graphical junk.

The server handles and distributes the state of things in catagory 1, and everyone but the server handles catagory 2, thus removing the load on the server for processing extra garbage [since it doesn't matter THAT much if a pebble flying away from a freshly shot up wall, falls in the exact same spot at the exact same time on all players]

Anything that actually effects players, like switches being activated, doors opening, ect, gets done on the server. Anything that doesn't effect players, stays off the server :D

Share this post


Link to post
Share on other sites
In quake, if the server is lagging, you can still move your player (also without hitting walls etc). So some physics must be done on the players machine.

And with more advanced physics, say half life 2, there are boxes and stuff which are simulated.

So during some lag time the player will still be able to move, so what if they hit a box? The box will fly off... But since they were not synchronised to the server, in that time another player might have moved the box.

Actually i've just tried quake, and it seems with lag the entire game freezes. So is the solution just to freeze the player when it does not synchronise?

Edit: but then how is smooth movement maintained as the player would not be able to synchronise 60 times a second... :/ would they simulate physics themselves between synchronising?

[Edited by - xDan on May 7, 2006 6:07:44 AM]

Share this post


Link to post
Share on other sites
I believe in Q2 collision with static objects (walls) is done by the client too, so if you have a ping of 500 you don't go half way through a wall then bounce back. The server is authoritative, though, obviously, and for non-static collisions (rocket blasts etc) you can get nasty jerks on resync. If it doesn't get any game state information for ~5s then it assumes the connection has gone missing and suspends the client-side game, as it knows your experience doesn't any longer match the real game and the extra messages your movement tries to send reduces the chances of the connection clearing up.

Share this post


Link to post
Share on other sites
The client does the same physics calculations that the server does, but the server is authorative and will correct the client simulation if they differ.

In simple terms.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement