Simulation varies between iOS simulator and device

Post Reply
albenchers
Posts: 6
Joined: Sun Jan 17, 2016 7:32 pm

Simulation varies between iOS simulator and device

Post by albenchers »

I have a basic simulation for three falling objects onto a ground plane and watching them collide and bounce. When I run it on the iOS simulator, the behavior of where they end up and bounce to varies from when I run the same simulation on an actual device. The simulation is always consistent upon repetitive runs within the same environment, but does not match up between these two different environment.

I'm curious what might affect this? Could it be things like floating point precision, the way the CPUs (arm vs x86) process numbers, etc? I wouldn't think so, but I'm at a loss to explain it.
anthrax11
Posts: 72
Joined: Wed Feb 24, 2010 9:49 pm

Re: Simulation varies between iOS simulator and device

Post by anthrax11 »

There can be several reasons and a part of it is how floating point numbers are processed, but noone really seems to have a definitive answer for this. You can search the forum or the web for "determinism", but I haven't seen anyone actually achieving it in open-source games.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Simulation varies between iOS simulator and device

Post by Erwin Coumans »

Yes, a main reason of simulation differences is a difference in compiler and CPU floating point settings.

One way to get around this is to use fixed-point integer math, but that is not implemented in Bullet, not in any other commercial engine as far as I know.
If you are only using one platform (say PS4) you can use the same compiler and same CPU and guarantee determinism.
Post Reply