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
 

Daddy needs a new pair of RAM!

edit: the fps are way better in smaller terminal windows with lower character count but then it's hard to make out the dice. D:

edit2: code here (expires in 2 weeks)

you are viewing a single comment's thread
view the rest of the comments
[–] oce@jlai.lu 37 points 1 week ago (11 children)

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?

[–] Pudutr0n@lemmy.world 32 points 1 week ago (10 children)

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.

[–] ravenn@lemmy.blahaj.zone 1 points 6 days ago (1 children)

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

[–] Pudutr0n@lemmy.world 2 points 6 days ago

that's one of the aspects of the current implementation

load more comments (8 replies)
load more comments (8 replies)