2
\$\begingroup\$

In order to use certain approaches to multiplayer physics, it requires that the clients calculate exactly the same values for physics simulations. That "exactly" is a very big word here and goes all the way down to the hardware.

Can Unity 5 or Unreal Engine 4 physics engines guarantee numerically exact physics simulations across platforms?

\$\endgroup\$
4
\$\begingroup\$

No.

And there is rarely a need for exact physics replication.

You mention multiplayer in your tags.

Generally, in a multiplayer game, the physics and game logic is performed by one instance, which can be the server hosting the game, or one of the client that hosts the game.

Each simulation step, that authority, the server, performs logic update and physics update then send the resulting game state to all of the clients. The clients draw the scene upon reception of these events.

This way, all of the clients do not need to compute physics, they only draw. This removes a load from the clients, and it allows every one to have the same simulation. Plus it helps against cheating!

Game clients still can simulate physics for:

  1. estimating and predicting game behaviour
  2. non-game logic behaviour; e.g.: rag doll, objects destruction
\$\endgroup\$
1
\$\begingroup\$

No. What would be the point of that?

The physics simulation in a game engine is not a real simulation in the sense that everything is done with the correct real-world formulas and reproducible. Doing so would require massively more computing power.

Most of the time, you can't even exactly reproduce the same physics simulation in a game twice in a row.

Edit: This of course depends on the exact implementation, but I just checked in the unreal engine and this is the result of repeating the same drop of a cube on a sphere (sorry for the bad image quality):

enter image description here

All four screenshots were taken from the same perspective. As you can see, sometimes the cube bounces far away, sometimes it stays close.

\$\endgroup\$
  • \$\begingroup\$ Please explain: Most of the time, you can't even exactly reproduce the same physics simulation in a game twice in a row. \$\endgroup\$ – Evorlor Mar 17 '15 at 22:15
  • \$\begingroup\$ The physics calculations use a lot of randomness, e.g. when determining the angle an object bounces off after a collision. So, when you set up an experiment in your engine by dropping a cube on a sphere the cube will most likely fly off in a different direction every time you repeat the experiment. \$\endgroup\$ – TheBrain Mar 17 '15 at 22:26
  • \$\begingroup\$ @TheBrain, is it actual randomness, or is it merely a chaotic situation? \$\endgroup\$ – Mark Mar 17 '15 at 22:28
  • 1
    \$\begingroup\$ @TheBrain tested, and your assumption is incorrect \$\endgroup\$ – Evorlor Mar 17 '15 at 22:41
  • 1
    \$\begingroup\$ What's random in physics? Physics simulation is an exact science. The differences you get in simulating it in a game engine come from the fact that there may be small difference in time/frame and floating point calculations. \$\endgroup\$ – Vaillancourt Mar 18 '15 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.