vera-core
VERA — Verified Effect-Rule Architecture
Generic infrastructure for effect-verified game loops. Pure rule functions return effect enums, a mechanical apply function mutates state, and a trace records everything that happened for verification.
What this crate provides
Trace<E>— records effects during test runs for assertion and debuggingTraceEntry<E>— a single recorded effect with turn number and sourceTraceSource<E>— where an effect came from (rule or reaction)RuleOutput<E, P>— what a rule function returns (game effects + presentation effects)
All types are generic over your effect type. Your game crate defines the concrete enums.
Usage
use ;
// Define your game's effect types
// Rule functions are pure: input → effects
// Trace records what happened
let mut trace = default;
trace.enabled = true;
let output = rule_heal;
for effect in &output.effects
assert!;
assert_eq!;
The VERA pattern
- Rules are pure functions:
(args, &Context, &mut RNG) → RuleOutput<E, P> - Effects are enums describing state mutations — never applied by rules directly
- Apply is a mechanical
matchon effects — no logic, just field assignments - Traces record all effects for test assertions and debugging
The pattern enforces separation: rules describe what should change, apply does the mutation, traces prove what happened.
License
MIT