Jump to content
  • Advertisement
Sign in to follow this  
StarikKalachnikov

Physics & Networking

This topic is 4525 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

Hi again, I'd like some expert opinion from you all for this little problem/challenge I have. I was thinking about a MMORPG where alot of players venture their way in areas. What if you have an area and inside it, you have a wall build by a couple of bloks. There are a alot of players connected and the base level for every player is the same, but what if a player was able to knock down the wall? I think you'd have to send some physics state information about the individual blocks to every player so the change is visible in the environment. But since in a MMORPG the world is persistent would it be viable to apply some physics like this into a game? Hope you all can catch my drift, Starik Kalachnikov -out

Share this post


Link to post
Share on other sites
Advertisement
What you're talking about is known as a persistent virtual world. There are several 3D virtual worlds currently running that allow players to change the world (and thus the physics); There and Second Life use two different approaches to solving that problem.

Share this post


Link to post
Share on other sites
Assuming there isn't wind and all of the clients are using a uniform physics engine, wouldn't you just have to register the collision of the object that knocked the wall down, and send that information across the network to all the clients? Since every player's copy would process the information identically, they'd all see the wall topple the same exact way. Shouldn't be more difficult than sending a force vector and the spatial coordinates for the impact.

Adding wind in would be more difficult (as you'd have to start sending wind vector information), but it can be taken care of as well.

Share this post


Link to post
Share on other sites
As long as you're not trusting the client to do physics and return you the results for anything important you should be ok with ciroknight said. This sort of thing could be a server sends to each client to process, where movement commands are sent from the client to the server, server checks for collisions then returns the results to the client to process.

Hope that made sense...

Share this post


Link to post
Share on other sites
Hmm I see what you mean Mike2343, I never thought about making the physics server-side... :)

Since is saw a demo of the Tokamak physics engine and everytime I run the demo you see different results. So I thought if you implement the physics engine, you have to synchronise the clients. Leaving the physics up to the server eliminates such issues.

Does anybody have some other thoughts about this, I would love to hear it!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If physics for certain objects are important to gameplay, I would say have the server do it..

BUT understand that simulating physics for all objects in a world (especially an MMORPG) can become EXTREMELY processor intensive, as well as bandwidth intensive for clients!!

For Example:

Say I have a brick wall made of 20 bricks, that can be smashed by players. if the server simulates the physics, then it must relay the position of all of the bricks to all of the clients (lets say there are 10 clients watching this happen), and we want response time to be fairly good, so we update at 10 times per second.

Assuming we send over a quaternion for orientation (16 bytes)
A 3d point for position (12 bytes)
A velocity vector(12 bytes)
An identifier to identify the object(4 bytes)

we have 44 bytes per object update(Obviously this can be compressed depending on the datatypes you choose, but for this example i'll use full 32 bit values)

we take those 44 bytes and multiply them by the 20 bricks we have, and we get 880 bytes per update.

Now we update 10 times per second and we get approx 8.8k/sec, or approx 70kbps.

More than a dial-up modem's bandwidth, just for simulating the physics of this single wall, and this does not include player movement, or anything else happening.

now on the server side, we are sending these updates to 10 players, which would make the bandwidth 700kbps, or about half of the bandwidth of a full T1. Just for simulating this smashed wall on 10 machines.

You could obviously tweak numbers, send out less updates, etc. But it becomes very important to see how quickly server side physics could overcome server resources.



I would say simulate anything that does not affect gameplay, or game balance on the clients. If someone smashes a wall and the bricks fly apart, does it really matter that they all land in the same place on all machines? Probably not.

An object like a soccer ball, however, for a soccer game online, would matter, so that should be simulated on the server.

I would go the route of sending the forces and impulses to the clients as a force vector and a position in space, and then have the clients all resolve it for themselves, unless it affects a gameplay critical object.

Share this post


Link to post
Share on other sites
Check out the Forum FAQ for some articles on how to do physics on networks different ways. Server-side physics is quite feasible, although clearly heavier on the servers (per client) than a non-physics server.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!