Using ODE and now would like to expand to multiplayer. Is it possible in real-time?

Started by
8 comments, last by grill8 14 years, 5 months ago
Hello, I am using ODE and now would like to expand to have multiplayer capabilities in my game engine. I have read a lot of articles and it seems that the concensus says ODE and multiplayer capabilites are simply not realistically possible in real-time. Is that true? Or if not ... where/how do I get information on handling networking multiplayer and ODE? Thank you for your help. Jeremy
Advertisement
I assume you're talking about the Open Dynamics Engine?

The STALKER games used ODE and also have multiplayer, which should be reassuring =D

One of the comments on this page mentions making a multiplayer game with ODE also:
http://www.mtp-target.org/
Everything's possible, it just gets more complicated to realize with increasing complexity. =)

I'd say using ODE is no difference towards "standard" physics, because in the end what matters is how often you do updates over the network. I'd say you don't have to update the position and direction and speed of an ODE-object if there has been no significant change (it's still lying on the floor or it's still falling down from the sky). Instead implement some good interpolation-routine to accomodate with little "known" data from the network.

I've never done such a thing, but in theory I suppose that's the way to do it. And maybe use 16-bit floats to keep data volume down.

Greetings
3-R4Z0R
Quote:ODE and multiplayer capabilites are simply not realistically possible in real-time


ODE and *deterministic* multi-player simulation are not really compatible, for various reasons. (Neither is Havok or PhysX, btw)

ODE works fine for multi-player games where you're OK with the state being slightly different on each machine. You can treat the interpolated positions you receive for other entities as force generators for the ODE bodies representing those entities, for example.

enum Bool { True, False, FileNotFound };
hplus -

I would be ok with the simulation not being 100% identical on all machines as long as the game gives the illusion that it is with all parties. The game play must be fluid/smooth for all parties. If they differ slightly but it is indistinguishable than that is fine with me.

I am unsure about what you mean exactly by force generators etc. Can you elaborate?

Thank you for your help.
Jeremy
Quote:Original post by grill8
If they differ slightly but it is indistinguishable than that is fine with me.
The problem with this is that slight differences can add up over time. An example from the 1,500 archers article is this:
Quote:A deer slightly out of alignment when the random map was created would forage slightly differently -- and minutes later a villager would path a tiny bit off, or miss with his spear and take home no meat. So what showed up as a checksum difference as different food amounts had a cause that was sometimes puzzling to trace back to the original cause.
So if you look at the villager, if his arrows are physically simulated (say), it might be that on one machine he hits the target and on another he misses, which means he doesn't take that meat home, which means you get one less new villager born, which means you don't quite have enough archers to defend your castle which means on your simulation, the enemy overruns you but on the other you successfully defend it. And it can all be traced back to that one villager missing his shot. For want of a nail, and all that.

Now if the physical simulation is just "for show" and doesn't really affect the game then that's something else. For example, if you blow up a house and the exact placement of rubble is not important, then you can do that with a non-deterministic physics engine separately on each client.

Also, if you're running a client/server game and the physics runs on the server, as long as you make sure the server is really running the authoratative version of the game, then you can fudge over the little differences by re-syncing thing every now and then.
Ok ... Questions ...

Question 1)
Ok, so if I was to "fudge over the differences" by resynching things occasionally does that mean that the overall state of the apps will still be stable/consistent over the long course of the game? I am assuming yes but that there may be the occasional object that slides to a new position a bit which may be slightly noticable from time to time.

Question 2)
If yes to question 1, could someone give a sequential list of actions that both the clients and the server should be doing throughout the course of the game to maintain stability and forced synchronization? For example ... what packets are sent, when, and how often?

Thank you for your help.
Jeremy
Update -

What I am grasping from this is that there will inevitably be differences when using ODE between machines in multiplayer.

It also sounds like you can get away with this for things that do not affect the simulation directly such as a crate exploding to pieces as long as the pieces do not affect the simulation. The effect will vary on machines but the illusion and game play is unaffected.

For objects that DO affect the simulation with their physics you MUST resync them periodically to maintain concensus between machines.

This is where I get a bit confused.

Me ... with no knowledge on this topic would do it as follows:

Step 1)
Have a minimal amount of objects that can move under the physics simulation. I.e. walls and such are fine because although they interact with the simulation there positions will never change so they do not require alignment/adjustment. A few are ok ... the players themselves and maybe some projectiles or misc. items.

Step 2)
Run the physics simulation ONLY on the server.

Step 3)
Clients send their forces (accelerations etc.) to the server but do not apply them locally ... again ... no physics are done on the clients.

Step 4)
When forces are received from clients by the server, apply them in their physics simulation not based on where they WERE when the force was applied, but where they are currently. I am hoping that this approximation while not 100% accurate will still give the illusion of accuracy while maintaining synch.

Step 5)
Once/frame send out the positions/rotations of dynamic objects from the server to the clients (i.e. objects that DO move such as the players, and objects that ricochet/collide etc such as a steel box or a hand grenade). Walls and such are always unaffected so the client side version will always hold.

Step 6)
Since the server is doing the physics, the clients do the updating of objects (their animation variables, their traits etc.) which are sent directly to the server which does NOT have to spend time doing these types of updating ... they are simply applied flat out via packets. The idea behind this is that the server (host) can spend its CPU time doing physics but does not have to update the objects while the clients do not have to do the physics but can do the updating.

Note:
I realize that there will be some slight latency between the time the player inputs a force to the time they see its affect. I am just hoping (with again no knowledge or experience in this topic) that it will be acceptable.

Anyways ... I have no experience in this topic. That is how I would do it but again ... I do not know anything about networking games beyond how to program sockets.

So my questions are ...

1)
Is this approach acceptable?

2)
If not I would love a thorough explaination of how I SHOULD be doing it.

3)
I looked into the Newton physics library vs. ODE. Is Newton a better physics engine for my needs?

4)
Please provide as much input as you can.

I appreciate your help.
Jeremy






Quote:Original post by grill8
It also sounds like you can get away with this for things that do not affect the simulation directly such as a crate exploding to pieces as long as the pieces do not affect the simulation. The effect will vary on machines but the illusion and game play is unaffected.

For objects that DO affect the simulation with their physics you MUST resync them periodically to maintain concensus between machines.
Here's a good article on networked physics. Basically, you've got it right, except that you can still run physics on the clients - just remember that it's an approximation, and it's only purpose is to make the objects look smooth and more responsive. If you only relied on position/rotation updates from the server, your objects would move rather jerkily and look unnatural. Particularly player movement feels really bad without client-side prediction.
Hello ... thanks ...

I finally think I have it pretty much figured out ... at least in my mind.

Question:

1)
With the client adjust events (with snaps and smooth blending) it is entirely possible that an object could become snapped to become partially (not much but partially) embedded in another object. Will ODE explode or anything in this scenario or just provide an outwards force to help deal with it? It seems to me that ODE could become unstable if objects are being moved/nudged/snapped from time to time. I could be wrong but just predictions.

Thank you all for your help ... with your help I believe I finally grasp the concept.

Thank you!
Jeremy

This topic is closed to new replies.

Advertisement