Determinism in vehicles

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Arkamarante
Posts: 3
Joined: Fri Aug 29, 2014 10:01 am

Determinism in vehicles

Post by Arkamarante »

Hi Norbo,

I am developing a multiplayer racing game. I have implemented the rewind-forward correction system, and it works very well with boxes. In order to correct the entities I rewrite the position, orientation, linear and angular velocities.

Now I am using vehicles, but the corrections are much more frecuents due to the differences beetwen the server and clients, Is the vehicle class less deterministic than simple boxes? Do I need to correct some other values of the vehicle?

I have disabled all the multithreading, and both, client and server are very deterministic themselves separately, they produce the same outputs with the same inputs, but the outputs differs between each other very soon.
Arkamarante
Posts: 3
Joined: Fri Aug 29, 2014 10:01 am

Re: Determinism in vehicles

Post by Arkamarante »

More info,

If I only change the throttle, then the determinism is much more stable and remains for several seconds. If the steer is constant the determinism is pretty stable too. The focus of indeterminism seems to be the variations of steering.

This tests are done with only one vehicle and a plane. I have checked that the order of creation of entities is the same in the client than in the server.

Any idea?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Determinism in vehicles

Post by Norbo »

If all of the standard sources of in-engine nondeterminism are addressed (multithreading, precise order and timing of all adds/removes), it's likely some other form of input to the engine. For example, in the VehicleInput of the BEPUphysicsDemos, the steering is changed according to the game's Update dt. If the game has a variable time step, it will not match the engine's internal time step. If this were running on a client and server, each would have different steering angles at each physical time step, causing divergence.

But it's hard to be sure. In the worst case, if this ran on two different computers, the floating point implementation might just be different and no amount of local determinism (short of fixed point math) would address it.
Post Reply