dungeon-revealer / dungeon-revealer

A web app for tabletop gaming to allow the game master to reveal areas of the game map to players, roll dice and take notes.
ISC License
429 stars 97 forks source link

3D Dice Roller #295

Open n1ru4l opened 4 years ago

n1ru4l commented 4 years ago

Due to Corona, we had to move our game online. Currently, we use discord, but we love our dice and miss them. Unfortunately, current tools for rolling dice are either lame (no dice rolling animation) or not collaborative (other people cannot see what you roll).

There is a library for 3D dice that looks pretty cool: https://www.npmjs.com/package/threejs-dice

Do we want to have a dice rolling solution within dungeon-revealer and move into the direction of a full-blown tabletop simulator application or keep the scope on revealing dungeons and moving tokens?

A first implementation could look like the following:

  1. Players can set a session name. (Implemented by https://github.com/dungeon-revealer/dungeon-revealer/pull/403)
  2. In the lower right corner is a roll History (DM and Player Section). The window can be minimized. (Implemented by https://github.com/dungeon-revealer/dungeon-revealer/pull/403)
  3. Players can Roll dice by typing in the dice types in a command prompt below the roll history (e.g. 2d20). (Implemented by https://github.com/dungeon-revealer/dungeon-revealer/pull/403)
  4. Animated dice will roll and the result will also be printed to the Dice History.
n1ru4l commented 4 years ago

Someone ported threejs-dice to React: https://github.com/RobRendell/gTove/blob/54b06d142f232ff609ed211517789bd08981e912/src/presentation/die.tsx

n1ru4l commented 4 years ago

We now have a dice roll chat with macro functionality introduced by (Implemented by https://github.com/dungeon-revealer/dungeon-revealer/pull/403).

A stretch step will be animated dice. D&D Beyond also started providing animated dice rolling this week.

If anyone is interested in implementing such functionality, contributions are more than welcome 😊

For the implementation I have the following libraries in mind:

The difficulty in implementing this is that we already know the result of the dice roll prior to rolling the dice. That means we have to somehow pre-compute on which side the dice will land in a simulation and then place the dice labels accordingly.

The dice rolling should be limited to the map viewport (and not overlap with the chat sidebar).