Expand description
Tomb is a minimal crate that provides dice rolling mechanisms for games.
Why use tomb
:
- The name is great (short for tombstones, another name for dice)
- Requires close to no depdendencies (an optional one for the
fastrand
crate) - Fully tested with generous example code
One way to think about tomb
is as a minimal headless tabletop simulator.
Examples
Creating and rolling a D20
// Optional dependency, exclude to implement your own RNG.
use fastrand::Rng;
// It is possible to define your own dice, rollers, and to use immutable die as well!
use tomb::{D20, RngRoller, RollMut};
// Pre-defined seed so the result of this example is predictable.
let roller = RngRoller::from(Rng::with_seed(7194422452970863838));
let mut d20 = D20::new();
roller.roll_mut(&mut d20);
assert_eq!(d20.value(), 10);
Modules
Contains “physical” objects or objects that act on physical objects.
Contains behaviors physical objects can declare.
Structs
A die that starts at
1
and has a defined maximum numeric value.Rolls entities using the
fastrand
crate.Traits
A trait that creates new elements based off ones which
Rotate
and are Polyhedral
.A trait that mutates existing elements which
RotateMut
and are Polyhedral
.