When building lockstep netcode, replay systems, or server-authoritative logic, standard random utilities like UnityEngine.Random or System.Random cannot be used because their results vary between platforms and Unity versions. OSL Deterministic Core solves this problem by providing a pure .NET Standard 2.1 PRNG suite designed from the ground up for strict determinism and high performance.
Key Features
- Deterministic by Construction: Same seed produces identical sequences across all machines, platforms, and CPU architectures, eliminating desynchronization risks.
- Zero Allocations on Hot Paths: Performance-critical operations—including RNG advance, dice rolls, deck shuffling, and weighted gacha draws—never allocate managed memory.
- Integer-First Probability: To completely avoid floating-point drift across different CPUs, APIs like RollPermille and RollProbability utilize strict integer comparisons.
- Pluggable Gacha & Pity Systems: Includes weighted draw tables (OSLGachaTable) and flexible extension points for pity rules (IPitySystem), with built-in support for Unity ScriptableObjects and JSON serialization.
- Independent Sub-RNG Streams: Supports deriving multiple statistically independent sub-RNGs from a single master seed using different stream IDs, isolating subsystems so that modifying one roll sequence does not affect others.
Package Content
- Core Engine: IRandomEngine contract, PCG32 algorithm implementation, and the OSLRandom developer facade.
- Shuffling: OSLDeckShuffler for in-place, zero-allocation Fisher–Yates shuffling.
- Gacha & Pity: OSLGachaTable and SimpleHardPity for managed reward configurations.
- Combat: OSLCombatResolver for reliable dice rolls and integer-based probability checks.
- Lockstep Demo: A split-screen sample application that runs two independent simulations side-by-side with real-time state hash validation to instantly demonstrate sync integrity.
- Editor Tests: Comprehensive NUnit EditMode tests covering determinism, statistical distribution, state round-trips, and pity semantics.
🔥 LAUNCH SALE: 50% OFF for the first 2 weeks! (Regular price: $15.99) 🔥