Physics determinism test
Re: Physics determinism test
Works the same in both. Interestingly, the result is different (chaotic, as expected) in versions 0.9 and 0.10, but it's unclear whether that's because of the PRNG or Box2D; using LuaJIT's math.random instead of love.math.newRandomGenerator might shed light on that. The final layout is also different in 0.9 vs 0.10.
Re: Physics determinism test
Thanks for testing! I don't really care about the older versions, although it would be interesting to know what's causing the difference.
Here's another, more interesting one just for shits and giggles. I couldn't figure out a nice and easy way to draw circles in this one, so it's quads this time.
- Attachments
-
- hellodb.love
- (7.55 KiB) Downloaded 206 times
Re: Physics determinism test
Perfect. 10/10.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
Re: Physics determinism test
Haha, nice!
Picture was perfectly coherent for me on Linux Mint desktop.
Picture was perfectly coherent for me on Linux Mint desktop.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Re: Physics determinism test
bumping this thread for a note:
I think this test is only deterministic because it updates the physics like this:
Note how world:update() is called with a constant as parameter. NOT with the variable dt.
(The speed is limited by accumelating dt-timesteps only it is above a threshold and then update)
If world:update(1 / 60) is replaced by world:update(dt) then the program shows a different outcome on every run. (even on the same machine)
I think this test is only deterministic because it updates the physics like this:
Code: Select all
local accum = 0
function love.update(dt)
accum = accum + math.min(dt, 1 / 20)
while accum >= 1 / 60 do
world:update(1 / 60)
....
(The speed is limited by accumelating dt-timesteps only it is above a threshold and then update)
If world:update(1 / 60) is replaced by world:update(dt) then the program shows a different outcome on every run. (even on the same machine)
Re: Physics determinism test
Duh. It's a chaotic process. Any minimal variation in any parameter causes radically different results. The test was for cross-platform reproducibility, i.e. whether identical inputs produced identical results in all platforms. Obviously you don't get identical inputs if your dt varies between frames.
I've made a modified version so that when pressing certain keys, a very slight variation is introduced in the simulation.
- Pressing space introduces a single frame with dt = 1/59.9999 instead of 1/60.
- Pressing return multiplies one of the random numbers by 0.99999 in one frame.
- Pressing an arrow key moves the obstacle 0.0001 units in the given direction.
- Attachments
-
- hellodb-chaos.love
- (7.72 KiB) Downloaded 131 times
Who is online
Users browsing this forum: No registered users and 4 guests