3
\$\begingroup\$

I am working one Mini Golf game development using Scenekit (iOS). To fix one of the problem with Scenekit, I have to increase the physics simulation rate by 4 times.

Questions:

  1. What is the impact on the CPU requirements?
  2. What are the common advantages and disadvantages of changing the physics simulation rate?
  3. What are the expected problems/issues with such increase in the physics simulation rate?

I would appreciate any suggestion on this topic. Thank you.

\$\endgroup\$
2
\$\begingroup\$

It's pretty straight forward really.

When you increase the rate you increase the time it needed to calculate each in-game second by the same rate.

One of the issue you can run into when increasing the simulation rate too much is that the delta per timestap can become too small and get rounded away. Increasing by a factor of 4 means it's only 2 bits but it can add up if you are not careful.

\$\endgroup\$
  • \$\begingroup\$ Thank you for the reply. I agree with your thoughts mentioned above. I have been facing one issue with Apple's Scenekit. By increasing the physics timestep from 60 FPS to 200 FPS, the issue is resolved. I want to know how that issue is related to physics timestep. \$\endgroup\$ – Nimesh Chandramaniya Apr 21 '18 at 5:52
1
\$\begingroup\$

The simulation rate is essentially as follows: how many times per second are you calculating and updating your objects?

If you're simulation rate is 10 times per second, you're taking all of your objects, updating their position by their velocty/10, and dealing with any forces and collisions. If you up that to 40 times per second, you're moving each object a smaller each time, but you're doing more updates. If everything works properly, a higher simulation rate means more precise physics. Your accelerations will be smoother, and your collisions will be calculated closer to when they should occur. A lower rate means less precise physics (and you might find bounces and accelerations not working as intended)

If you're completing all the calculations in less than 1/40th of a second, a simulation rate of 40 would mean you can display the objects in real-time (ignoring the time it takes to draw them for the purpose of answering this question). The load on your CPU per second would be equal to 40*the time it takes to calculate your physics.

However, if it exceeds your CPU's capabilities, you've got two options: not render in real time (save the locations from each frame), or drop frames. This can potentially wreak havoc (pardon the pun) on the simulation itself as it could miss collisions or not properly calculate accelerations.

So in short, if you need precision, try upping it, but if you find that it's impacting CPU usage, consider dialing it back a bit.

\$\endgroup\$
  • \$\begingroup\$ Thank you for the reply. I agree with your thoughts mentioned above. I have been facing one issue with Apple's Scenekit. By increasing the physics timestep from 60 FPS to 200 FPS, the issue is resolved. I want to know how that issue is related to physics timestep. \$\endgroup\$ – Nimesh Chandramaniya Apr 21 '18 at 5:52

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.