-
-
Notifications
You must be signed in to change notification settings - Fork 4
Feature: Timed Despawn Stagger and Budget
Tsu edited this page May 31, 2026
·
1 revision
This feature spreads timed-despawn checks and caps how many checks run in a single tick.
Patch in BehaviorDespawn:
// Stratum: widen the stagger window from 1s to ~5s
accumOffset += (float)((entity.EntityId / 73.0) % 5);This distributes check times across a wider window.
Stratum adds a shared static budget for despawn check evaluations:
private static long stratumLastBudgetTickMs;
private static int stratumChecksThisTick;
private const int StratumMaxChecksPerTick = 16;Budget gate in OnGameTick:
if (stratumChecksThisTick >= StratumMaxChecksPerTick)
{
accumSeconds = accumOffset - 0.05f;
return;
}
stratumChecksThisTick++;This defers excess checks to near-future ticks instead of letting one tick eat all of them.
patches/VSEssentials/Entity/Behavior/BehaviorDespawn.cs.patchVSEssentials/Entity/Behavior/BehaviorDespawn.cs