Karliss 12 hours ago

Search for "numerical integration" in the context of physics simulation/game engines. You can use https://en.wikipedia.org/wiki/Numerical_methods_for_ordinary... as a starting point.

From what I understand it's not just floating point errors, but due to the nature of approximating continues function as simple discrete steps. Linked wikipedia article has a graph demonstrating that with large steps the error accumulates way before floating point precision is a concern.

There are different numeric integration techniques with different tradeoffs. Stuff like Eulers method, Verlet, Runge-Kutte. In some of them overall energy tends to accumulate in others it gets lost both of which is wrong. Some of the more complex ones tend to behave a bit better, but then you get into the problem whether gains from each individual step being more complex outweighs what you would get from running more iterations of simpler/faster algorithm.

2
rikroots 10 hours ago

I've got a demo[1] where people can play with (my interpretation of) various calculation engines, adjust variables, etc. But seeing this comment made me realise I've never heard of Verlet integration[2] before - not surprising given that I got an F in Maths (and got thrown out of Physics before I could take the exam). So ... how efficient and accurate is Verlet compared to Euler/Runge-Kutte/etc? And what other methods are out there for this sort of calculation?

[1] - https://scrawl-v8.rikweb.org.uk/demo/particles-008.html

[2] - https://en.wikipedia.org/wiki/Verlet_integration

debugnik 9 hours ago

Verlet integration became the go-to method for particle effects and soft surfaces back when people wrote their own game engines, mostly thanks to the paper documenting its implementation for the first Hitman game [1]. In fact, I'd say it got cargo-culted by game devs for that purpose and that purpose only, despite it being a general method and competing with others.

[1]: https://www.cs.cmu.edu/afs/cs/academic/class/15462-s13/www/l...

Azrael3000 11 hours ago

Would be interesting to know what integrator they use. Verlet schemes can be implemented with very little effort and they don't suffer from this issue (see e.g. the leap frog method). But in general you would nearly always add some sort of damping mechanism, particularly for CG applications.

debugnik 9 hours ago

You mean for this submission? The window title says "Verlet simulation test".

Azrael3000 9 hours ago

Ah thanks I missed that. Then it seems there is nearly no damping used.