SANDBOX — this is a test environment. No servers are actually deployed and no real payments are charged.
Back to NxLabs

NxLabs / Vintage Story

Q

Quiet Worldgen

VBy Venah

Silences benign ore-deposit IndexOutOfRangeException spam from worldgen mods. Cleaner logs, less I/O

Description

<p>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).</p> <h1>What it does</h1> <p>&nbsp;</p> <div>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.</div> <p>&nbsp;</p> <div>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.</div> <p>&nbsp;</p> <h1>What it does NOT do</h1> <p>&nbsp;</p> <div>- <strong>Fix the underlying bug.</strong> 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.</div> <div>- <strong>Suppress other worldgen exceptions.</strong> 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.</div> <p>&nbsp;</p> <h1>Performance impact</h1> <div>&nbsp;</div> <div> <table style="width: 782px; border-spacing: 0px;" border="1" cellpadding="6"> <thead> <tr> <th style="width: 141.891px;">Deployment</th> <th style="width: 191.781px;">Errors/hour (typical)</th> <th style="width: 336.438px;">Without QWG</th> <th style="width: 110.891px;">With QWG</th> </tr> </thead> <tbody> <tr> <td style="width: 141.891px; text-align: center;">Single player</td> <td style="width: 191.781px; text-align: center;">~1,600 during exploration</td> <td style="width: 336.438px; text-align: center;">~1.6 s CPU + 2.4 MB GC + 1.1 MB log writes</td> <td style="width: 110.891px; text-align: center;">0</td> </tr> <tr> <td style="width: 141.891px; text-align: center;">5-player server</td> <td style="width: 191.781px; text-align: center;">~5,000 at peak</td> <td style="width: 336.438px; text-align: center;">~0.4-0.6% CPU</td> <td style="width: 110.891px; text-align: center;">0</td> </tr> <tr> <td style="width: 141.891px; text-align: center;">20-player server</td> <td style="width: 191.781px; text-align: center;">~20,000 at peak</td> <td style="width: 336.438px; text-align: center;">~2-4% CPU</td> <td style="width: 110.891px; text-align: center;">0</td> </tr> <tr> <td style="width: 141.891px; text-align: center;">50-player server</td> <td style="width: 191.781px; text-align: center;">~50,000 at peak</td> <td style="width: 336.438px; text-align: center;">~5-10% CPU</td> <td style="width: 110.891px; text-align: center;">0</td> </tr> </tbody> </table> </div> <p>&nbsp;</p> <div>The Harmony Finalizer catches the exception after the runtime's cheap frame capture but before the expensive part: symbolication of the stack trace string, the PDB reads that requires, the logging, and the disk I/O.</div>

Download

No download link is available for this entry right now.

Ratings & reviews

No ratings yet

Sign in to leave a rating or comment.