Mods / Quiet Worldgen

Tags:
Utility Tweak
Author:
Venah
Side:
Both
Created:
Jun 9th at 5:44 PM
Last modified:
Jun 9th at 5:46 PM
Downloads:
1109
Recommended download (for Vintage Story 1.22.0 - 1.22.3):
quietworldgen_0.1.0.zip  1-click install

A tiny server-side Harmony patch that suppresses the benign `IndexOutOfRangeException` thrown by vanilla `ChildDepositGenerator.GenDeposit` during chunk generation under popular worldgen mods (Geology Additions, TerraPretty, and others that modify rock strata or add deposit definitions).

What it does

 

The exception is benign - the chunk completes successfully, and only the one small deposit at the boundary position is silently skipped. Ore distribution remains broadly correct. But the exception logs a full stack trace per occurrence, producing hundreds of useless log entries during exploration that drown out real errors and waste CPU + disk I/O.

 

Quiet Worldgen catches the specific `IndexOutOfRangeException` from `ChildDepositGenerator.GenDeposit` via a Harmony Finalizer, increments a counter, and discards it. All other worldgen exceptions continue to log and propagate normally.

 

What it does NOT do

 

- Fix the underlying bug. The deposit math is still walking out of bounds; we just stop reporting it. The proper fix lives in either vanilla VS or in the third-party worldgen mods that trigger it.
- Suppress other worldgen exceptions. Watersheds NullReference, TerraPretty asset-not-found, JSON patch parse errors - all those still log normally. Only this specific exception in this specific method is caught.

 

Performance impact

 
Deployment Errors/hour (typical) Without QWG With QWG
Single player ~1,600 during exploration ~1.6 s CPU + 2.4 MB GC + 1.1 MB log writes 0
5-player server ~5,000 at peak ~0.4-0.6% CPU 0
20-player server ~20,000 at peak ~2-4% CPU 0
50-player server ~50,000 at peak ~5-10% CPU 0

 

The Harmony Finalizer catches the throw before stack trace generation, before logging, before disk I/O. Cost per swallowed exception is a single atomic counter increment.

Mod Version Mod IdentifierFor Game version Downloads Released Changelog Download 1-click mod install*
0.1.0 quietworldgen
1.22.0 - 1.22.3
1109 Jun 9th at 5:46 PM quietworldgen_0.1.0.zip 1-click install

Initial release


3 Comments (oldest first | newest first) (threaded | flat)

Nephelangelo, Jun 23rd at 3:04 AM

Mighty thanks!

chisps, Jun 9th at 9:15 PM

A lifesaver for sure. What exactly is the cause of the exception anyways? I saw it constantly while testing Rock Strata Variety and could never figure it out, beyond some connection to modded child deposits.

Venah , Jun 9th at 10:19 PM
@chisps: A lifesaver for sure. What exactly is the cause of the exception anyways? I saw it constantly while testing Rock Strata Variety and could never figure it out, beyond some connection to modded child deposits.
Spoiler

Glad it's earning its keep. Here's what's actually happening, as best I could trace it:

When vanilla generates a parent deposit, ChildDepositGenerator.GenDeposit then tries to place its child deposits (quartz around gold, that kind of thing). The child placement math takes the parent's position and offsets it, then indexes into per-chunk arrays (rock strata / depth data) to decide if the child fits there. Vanilla's offsets are tuned to its own strata assumptions, so the computed index always lands in bounds.

Mods that touch rock strata or deposit definitions (Rock Strata Variety, TerraPretty, Geology Additions, and others) shift those assumptions. The parent deposit can now sit somewhere vanilla never expected, usually near a chunk boundary, and the child offset walks the index past the end of the array. Hence the IndexOutOfRangeException.

The reason it's benign: the exception aborts only that one child deposit. The chunk finishes generating, the parent deposit is intact, and ore distribution stays broadly correct. You lose a single small child pocket at the boundary position, which is statistical noise across a world.

The real fix would be a bounds check inside vanilla's child placement, or strata mods regenerating in a way that matches the vanilla window. Until one of those happens, suppressing the log spam is the practical option. If you're seeing it with RSV specifically, that tracks. Anything rewriting strata composition triggers the same path.