Distributed Physical Modelling
SDxWiki

Bah. Bad page title.

Interacting Bodies

I'm trying to work out a problem here.

Basic Dead Reckoning works on the assumption that each object has a distinct owner. That owner is the authority on the object's state, and provides authoritative updates to reflect the effects of internal state changes - like throttling up a ship's engine, for instance. These internal state changes can only be effected by the owning node, so this arrangment makes sense. Embellishments discussed elsewhere (Software Architecture Ideas/Distributed Security) can introduce authoratative monitoring nodes that can override apparent attempts at hackery, but this doesn't change anything fundamental about how the physical simulations on different nodes stay in synch.

What happens, though, if you want to model objects that affect each other?

Consider a 'tractor beam', or more prosaically and concretely, a tow cable. (They would be simulated similarly, but the beam might not be visible.) This allows the player's ship to apply a force to, say, an asteroid. (A very small asteroid, probably.)

One way to model this is for the player to become the owner of the asteroid, and thus the player can apply 'thrust' to the asteroid just like he can with his ship. Barring hacking, the client program would apply only appropriate force, and would model the effects of force and counterforce between the 'roid and the ship itself.

Points arising (to borrow one of Chris Date's favorite phrases):

Alternately, the connection between the ship and the 'roid could be handled by the overall physical simulator. The cable becomes part of the physical simulation. The player continues to control only his ship, and the effects on the asteroid via the rope are modelled by all nodes themselves. This, however, does not directly model the counterforces on the player's ship.

Points arising:

At this point, you may be having thoughts along these lines: "So that's why Jumpgate doesn't let ships and 'roids interact." Or perhaps even, "What a wise choice that was on NetDevil's part."

Here's a possible out, although it introduces additional networking mechanisms that will cause a player's control over his ship to become less accurate. Perhaps this will be worthwhile, assuming that such situations are not the norm...

The problem can perhaps be solved by a shift in ownership. When a player's ship attaches to another object, ownership of the ship shifts to an objective node -- a server. The server is now the authority for both the ship and the asteroid. The player's control over his ship now has to occur by sending requested changes to the ship's internal state (thrust vectors and such, but not kinematics such as the actual acceleration, velocity, and position) to the server. Control will not be as precise, from the player's point of view.

Other nodes will either model the two objects independently, or as interacting objects, as described by the two alternatives earlier. In the former case, frequent state updates will need to be sent, because the nodes will be modelling the asteroid as if it were drifting normally. In the latter case, the nodes will simulate more accurately. In both cases, all nodes will be receiving updates for both objects, keeping the nodes in synch (over time, on average, as is normal for dead reckoning). The choice will be a matter of quality desired. It seems likely that the server will have to do an interacting simulation in any case to model what's happening, so the same code might as well be applied to the other nodes.

This method also extends gracefully to accomodate the case where multiple player objects become part of one system; they all undergo the same shift in ownership.

JDH This approach of transferring ownership would seem like it's the only feasible one (the former two appear to be too complex / chaotic). The reduced accuracy of control might be rationalized by the fact that in general the player will be towing something of great mass which generally causes sluggish response. However, my concern is that although response in the real world is sluggish it is even more critical to be able to issue fine grained and predictable control input in these situations (otherwise the system quickly becomes unstable). Another concern is that I believe we would create a more noticeable hierarchy between 56Kers and LPBs - you'd really want a high fidelity connection to consider towing. Oh yeah, the more we ask the server to do the more horsepower we'll need - but I'm not too concerned about that. Ultimately, I think this is an area where experimentation might find a usable compromise. DWM Agreed on all points. On slow connections, the control input sent up to the server will be unreliable, we just have to make sure that it's unreliable in a reasonable way. Carefully selecting the form of the control input would help (desired attitude jet positions and thrust settings, rather than incremental joystick and throttle changes), and we would also have to cull old data that has not yet been transmitted when it is superseded by newer data. Perahps it would be possible to do some form of 'smoothing', but I'm not sure that would be applicable. Experimentation sounds good. :-)

Side note: Interactions that are effectively one-way, such as the gravitational interaction between a planet and a ship, are not a cause for concern. The planet won't be affected in any significant way no matter how many player ships it interacts with, so we model it as a one-way effect, and each node's simulation will be completely accurate.

Side note: Determining who will own a group of interacting bodies should be fairly straightforward, if we assume that there is a hierarchy of ownership in place. The owner will be the common parent node of all the bodies involved. If the server network evolves to a large hierarchy that is arranged to follow the network topology (i.e. parents for a topological region, children closely adjacent to one another), this will place ownership automatically at a good compromise node for all involved players. (All objects are ultimately owned by the root node.)