Skip to content

Releases

StS2 RNG Fix v0.1.1

Choose a tag to compare

@ing-gom ing-gom released this 16 Jun 07:17

Robustness + in-engine verification.

  • Patches both Rng constructors now. v0.1.0 patched only Rng(uint,int); if the JIT inlines the chaining Rng(uint,string) constructor before the patch installs, RunRngSet's per-stream RNGs could be missed. Both postfixes compute the same final seed, so it's idempotent — no double-mixing.
  • Fixed a packaging-level pitfall where method-level-only Harmony attributes made PatchAll skip the class.

Verified against the real game engine (sts2.dll RunRngSet on the game runtime): the Neow's-Bones Niche curse, conditioned on another stream, is skewed 36.7% / 0.0% in vanilla and flattens to 9.8–10.3% with the mod (PatchAll reports 2 patched methods). Determinism and save/load position preserved.

Install

Extract the Sts2RngFix/ folder into Slay the Spire 2/mods/.

StS2 RNG Fix v0.1.0

Choose a tag to compare

@ing-gom ing-gom released this 16 Jun 06:51

First release.

What it fixes: the "Correlated Randomness" bias carried over from Slay the Spire 1. The game seeds its ~12 RNG streams as runSeed + hash(streamName) and feeds them straight to System.Random, whose first output is nearly linear in the seed. Streams sharing a run seed (map, Neow's Bones curse, Act 2 transform pool, …) end up with correlated first draws — uniform unconditionally, but heavily skewed once you condition on something you can see (e.g. starting map → Neow's Bones curse leaning ~54% Debt / ~73% Writhe, some curses near 0%).

How: one Harmony postfix on the Rng constructor runs each stream's seed through a splitmix32 avalanche before System.Random, decorrelating the streams.

  • ✅ Determinism preserved (same seed → same run) and save/load safe.
  • ⚠️ Outcomes differ from vanilla, so seed-sharing with non-modded players won't match. Single-player recommended; in multiplayer all players must run it.
  • Disable without uninstalling: STS2_RNG_FIX_DISABLED=1.

Verified: real 0Harmony on the game runtime (postfix fires through ctor chaining, readonly field replaced, counter restored, same-seed stable); 2,000,000-seed simulation — conditional bias 31.8% / 0.0% → 9.9–10.1% per option.

Install

Extract the Sts2RngFix/ folder into Slay the Spire 2/mods/.