Open frankieali opened 2 years ago
Hi @frankieali, I founded Game Park (https://game-park.com/) to offer online board games adaptations. I would love to use this library, however the result of any dice throw is provided by the server (to prevent any cheating of course). I think that's not compatible with the library actually, but I would love to see a feature to animate dices with a predictable result! Bravo for the great work anyway 👍
Hi @fromi. You are not the first to request this. Also here https://github.com/3d-dice/dice-box/issues/29. Currently, I just start the dice rolling and let the physics resolve themselves. I don't even know how I would approach this problem. I don't believe AmmoJS, used for physics, is a deterministic engine. This link offers me a clue though https://www.reddit.com/r/gamedev/comments/bq6c5d/deterministic_physics_dice_rolls_in_a_non/
Yes, I already studied that: http://a.teall.info/dice/ And I came to the conclusion it would be quite a challenge to produce a deterministic output, given the extensive use of random values at every bouncing. The solution you are pointing at was also my conclusion, but I cannot spend the time on it unfortunately :/
Ok, I took a deep dive into this yesterday. It's not impossible. I added it as an enhancement https://github.com/3d-dice/dice-box/issues/47. It'll take some time though.
Overall, I think this is a very valuable feature to have and a core requirement for many people who would want to use this library. It'll also open up options for dice parsers. I've always liked the features offered by RPG Dice Roller.
The sound effects would be awesome and adds a lot to the flavour.
Would love a way to interact with the dice, for example click on a dice and 'lock' that dice, then re-roll all other dice except for the locked once. So some sort of onClick event listener.
@MaritFischer Clicking on dice involves importing all the ray tracing capabilities of the 3D library. I chose to leave these features out of the package in order to keep the package size small. It's a lot of overhead. The dice all become static at the end of a roll. Dice can be removed and added individually. I would suggest presenting a UI component that allows the user to lock dice. Then you know what to re-roll.
I may come back around to adding raytracing click events in the future. It seems including more features is outweighing package size.
Idea list for future features
d2
,d14
andd30
used in other systemsonCollision
callback event