this post was submitted on 01 Sep 2026
517 points (98.5% liked)
Programming
28402 readers
371 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I'm curious why it seems the time slows down at the end compared to reality? Because more computation is needed to check if it's a stable state?
the final resolution stage was a huge headache and as you can see, one I didn't fully solve. Basically when the dice finally settle, particularly those with more sides, lots and lots of micro collisions happen in close sequence, each one having to apply friction and bounce back. As velocities come close to be rounded to 0, the bounce back effect and force of gravity no longer provide movement, but the final angle of the bottom face may not be fully settled on the floor. So basically if i don't ignore all these tiny collisions I get the frame rate drop you see and if I do, I can arrive at not fully settled states which can become ambiguous result-wise in, say, the 20-sided die.
why not save the state of the di(ce) in the settling phase and choose (or allow user assignable) value for how many consecutive identicle states before freezing the di(ce) and reporting the result?
my only concern would be a "spinning" di but short of colliding with other dice, that seems technically solved
that's one of the aspects of the current implementation