Overview
Kenshi produces identical random results (NPC positions, loot drops, etc.) when starting new games with the same MOD list, due to a fixed RNG seed. This tool replaces the runtime random seed via DLL injection to achieve varied randomization per playthrough.
Implementation
Reference implementation based on RE_Kenshi FixRNG, hooks MSVCR100 runtime functions and in-game functions:
| Hook Target | Description |
|---|---|
srand | MSVCR100 seed replacement (timestamp or custom value) |
rand | TLS switching: true random / deterministic mode |
randomInt | Building::selectParts +0x113, integer randomization |
random (float) | Building::selectParts +0x26D, float randomization |
getFoliageRotation | RVA 0x6CB8A0, foliage rotation randomization |
All five hooks are implemented via reverse-engineered fixed offset addresses.
Verification
- Log entry
"Full RNG fix active (RE-style)"confirms all hooks active - Compare NPC positions across new games to verify randomization
- Enable
use_custom_seedto reproduce identical results with the same seed
Limitation
Hooks depend on specific game version memory offsets; game updates may require offset adjustments.