Page 1 of 1

Physics + network

Posted: Fri Feb 12, 2010 3:35 pm
by nathanf534
Ive decided to make a little game in which you will go around building towers out of blocks. I want to add physics to the game so I can have them realistically fall down, but I'm not sure how I could do this as a network game. How would I update the physics on all the clients without using an extreme amount of bandwidth? (a tower could be up to 500 square blocks or more). Ill probably be using Newton physics, but I don't have any code yet because I'm still planning how this would actually work.

Posted: Fri Feb 12, 2010 5:09 pm
by Nox
Well thats really not an easy task. Moreover most networklibs are not really abled to handle so much objects nativily so you are mostlikely forced to implement your own "message/data-batching" system. If you want to keep the server and client state synchron you need to use inter and extrapolation and timestamps.
Maybe http://syncsys.sf.net is useful for your situation except you want to deal with the synchronisation 'manually'.
For the inter- and extrapolation stuff are many tutorials out there. Just look a bit around.

Posted: Sat Feb 13, 2010 2:35 am
by nathanf534
Thanks, I googled the extrapolation and timestamps. Ill just mess around with what I have learned and hopefully get something to work.

Posted: Sat Feb 13, 2010 9:10 am
by Brainsaw
Can you keep us updated? I'm currently using the "brute force" approach to handle network in my project "stunt marble racers", I send a message with the position and rotation of each moved object on every simulation step. As in my game there are normally not more than 20 moving object at a time it works fine (at least in local networks), but a "more advanced" solution would be cool.

Posted: Sun Feb 14, 2010 1:09 am
by yamashi
Use a heart beat system...
Let the client handle the physics but synchronize the world once every 10 secondes or so...
You have two approaches possible :
- The FPS approach : Keep refreshing the world all the time.
- The mmo approach : Use emats, send when a player starts doing something and when it stops, also you have to synchronize once in a while.

Posted: Sun Feb 14, 2010 3:30 am
by nathanf534
Ill try to keep you updated, but it will be a while until I get any results considering I haven't really started the project yet. I was thinking of doing something similar to the heartbeat system. I will have each client do their own physics but have the server update the clients as often as it can.

Also, does anyone know where I can get information on how to set up Newton physics with eclipse? I have been searching the forum but haven't found anything helpful yet.