Descent.RngKit.Mechanics
0.1.0
dotnet add package Descent.RngKit.Mechanics --version 0.1.0
NuGet\Install-Package Descent.RngKit.Mechanics -Version 0.1.0
<PackageReference Include="Descent.RngKit.Mechanics" Version="0.1.0" />
<PackageVersion Include="Descent.RngKit.Mechanics" Version="0.1.0" />
<PackageReference Include="Descent.RngKit.Mechanics" />
paket add Descent.RngKit.Mechanics --version 0.1.0
#r "nuget: Descent.RngKit.Mechanics, 0.1.0"
#:package Descent.RngKit.Mechanics@0.1.0
#addin nuget:?package=Descent.RngKit.Mechanics&version=0.1.0
#tool nuget:?package=Descent.RngKit.Mechanics&version=0.1.0
Descent.RngKit.Mechanics
The standard ruleset library for Descent.RngKit, plus a batteries-included engine factory.
The engine core stays free of game-specific rules. This package adds them as pluggable evaluators,
registered through the core's public RngParserBuilder seams. Reference it when you want the full
TRPG feature set immediately.
dotnet add package Descent.RngKit.Mechanics --version 0.1.0
Pre-1.0. Below
1.0.0the public API is unstable by declaration — SemVer permits breaking changes in any0.xminor release — so pin an exact version rather than a floating range.
This transitively brings in Descent.RngKit and Descent.RngKit.Abstractions.
Quick start
using Descent.RngKit.Mechanics;
var engine = RngEngineFactory.CreateStandard(); // every mechanic below is registered
var packet = await engine.RollAsync("hope_fear(1d12, 1d12)");
Console.WriteLine(string.Join(", ", packet.Details[^1].Flags ?? [])); // e.g. "WITH_HOPE"
Prefer to opt in only to what you use:
using Descent.RngKit;
using Descent.RngKit.Mechanics;
var builder = new RngParserBuilder()
.AddHopeFear()
.AddScatter(); // or .AddStandardMechanics() for everything
var engine = new RngEngine(builder);
In ASP.NET Core:
builder.Services.AddRngKit(o => o.Builder.AddStandardMechanics());
Included mechanics
Names are case-insensitive and most have aliases.
| Expression | System | Notes |
|---|---|---|
hope_fear(1d12, 1d12) |
Daggerheart | Duality dice; flags WITH_HOPE / WITH_FEAR / critical |
glitch(6d6, = 1) |
Shadowrun | Glitch and critical glitch; condition required |
stunt(3d6, >=3) |
AGE system | Stunt die and stunt points |
stress_pool(1d6, 1d6, ">=5", "==1") |
Year Zero / Alien | Normal + stress pool; aliases stress, hunger, risk |
push_until(1d6, 10, >=6) |
push-your-luck | Accumulate to a target, bust on a condition |
progress_roll(3, 2d10) |
Ironsworn | Strong hit / weak hit / miss; alias ironsworn |
usage_die(1d8, <=2) |
The Black Hack | Resource depletion, steps the die down |
tension_pool(2, "doom", 6, 6) |
AngryGM | Persistent pool; aliases tensionpool, doom_pool |
matchup(5d10, 5d10, 0) |
generic | Opposed clash, highest vs highest |
scatter(3d6, "hex") |
Warhammer-like | Deviation; "compass", "8way", "clock", "hex" |
hit_loc("humanoid", 0) |
generic | Hit location; alias hitloc |
craft(0, 0, 1, 1, 2, 3) |
generic | A die with arbitrary faces |
floor_faces(4d6, 2) |
generic | Treat every 1 as a 2; alias floorfaces |
simulate(3d6+4, 10000) |
— | Monte-Carlo statistics; aliases sim, monte_carlo |
noise_2d(42, 1, 2) |
procedural | Deterministic Squirrel3 spatial hash; aliases noise, noise2d |
markov(1, "weather") |
procedural | Markov chain transition; alias markov_chain |
matrix(1, 2, "crit") |
generic | 2D matrix lookup; alias matrix_lookup |
Exact argument shapes and every alias are in the syntax reference.
Some mechanics need a host provider via RngRollOptions: hit_loc uses IHitLocationProvider,
markov and matrix use ITableProvider, and tension_pool persists its counter through
IVariableProvider. Without one, they return a specific error code rather than throwing.
simulate is cheap
simulate suppresses per-run telemetry and releases pooled buffers on every iteration, so allocation
does not scale with the run count or the formula's complexity. A 10,000-run simulation of 3d6+4
costs roughly 40 KB — essentially just the int[] holding the results. It returns the rounded mean
and attaches median, standard deviation, min, max, and the 25th/75th/95th percentiles as
SimulateMetadata.
Writing your own ruleset
This package is not privileged. It uses exactly the public seams available to you: an AST record, an
IRngCustomEvaluator, a parser modifier, and a builder.AddYourMechanic() extension method. If your
table has a house rule, ship it as your own package — no fork required.
MechanicsParsing offers reusable grammar helpers: Function(names, build) for plain comma-separated
arguments, PoolOpTarget(names, build) for name(pool, OP target), and Named(names, body) for
bespoke grammars.
Walkthrough: Extending.
Links
- 📘 Syntax reference
- 🧩 Extending
- 📦
Descent.RngKit— the engine - 📦
Descent.RngKit.Abstractions— contracts only - 📦
Descent.RngKit.Serialization— opt-inSystem.Text.Jsonsupport
MIT © DescentVTT Team
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Descent.RngKit (>= 0.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|