UpgradeLagFix
Removes the freezes when many upgrades are stacked on one gear (Ouroboros/Blitz). Client-side, no gameplay changes: same stats, same apply order, only faster lookups.
| Last updated | a day ago |
| Total downloads | 58 |
| Total rating | 0 |
| Categories | Mods Quality Of Life Client-Side |
| Dependency string | t4t5u0-UpgradeLagFix-1.0.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack_Mycopunk
BepInEx pack for Mycopunk. Preconfigured and ready to use.
Preferred version: 5.4.2403README
Upgrade Lag Fix
A client-side BepInEx mod for Mycopunk that removes the freezes you get when many upgrades are stacked on one gear (for example, in Ouroboros and Ouroboros Blitz).
It does not change gameplay. Damage, effect values and the order upgrades are applied in stay exactly the same. It only makes the game find the same answers faster.
What it fixes
With dozens of upgrades on one gear, every time the game re-applies upgrades (closing the inventory, picking up an upgrade, and so on), it can freeze for seconds. The cost grows roughly with n³ × U, where n is the number of upgrades on the gear and U is the number of upgrades you own.
Example: one gear with 120 upgrades, about 1,670 owned upgrades.
| Time to apply that gear's upgrades | |
|---|---|
| Unmodded | ~2,600 ms |
| With this mod | ~10 ms |
How it works
| Step | What it does |
|---|---|
| Instance index | PlayerData.GetUpgradeInstanceFromID is a linear search over every owned upgrade. The mod answers it from an InstanceID → UpgradeInstance index. It only returns a cached answer while that upgrade can still be reached in the player's data. Otherwise it falls back to the original search. |
| Cleanup skip | Walking the equipped upgrades calls GearData.Cleanup() on every step. The mod skips it when nothing it depends on has changed since the last time it removed nothing. |
| Prepare / sort skip | Every walk starts with PrepareUpgrades, which re-checks every entry and re-sorts the list. The mod skips the check under the same rule as Cleanup. It skips the sort only when the list is already strictly in order, so sorting could not change it. |
"Nothing has changed" is proven, not guessed:
- At startup, the mod scans the game assembly with Mono.Cecil for every instruction that can remove upgrades, or replace the data these checks read.
- Right before each of those instructions, it inserts a counter.
- If something can't be instrumented, that feature turns itself off and the game runs its original code.
The mod was verified by running the original code next to every cached or skipped step and comparing the results. Over tens of millions of checks, it found 0 mismatches. You can run the same check yourself with Debug.Verify (see below).
Installation
With a mod manager (recommended)
Install it from Thunderstore with r2modman, Gale or the Thunderstore Mod Manager. BepInEx is installed automatically.
Manually
- Install BepInExPack Mycopunk.
- Copy
UpgradeLagFix.dlltoMycopunk/BepInEx/plugins/UpgradeLagFix/.
Multiplayer
The mod is declared as client-side and not sandbox (MycoMod with ModFlags.IsClientSide). It only changes how your own game looks up data, so other players don't need it.
As with any BepInEx mod, your game counts as modded: lobbies show [MODDED], and hosts can block modded players with "Allow Modded Joiners".
Configuration
The config file is BepInEx/config/t4t5u0.UpgradeLagFix.cfg. The defaults are what you want for normal play.
| Section | Key | Default | Description |
|---|---|---|---|
| Cache | Enabled | true | Instance index for GetUpgradeInstanceFromID |
| Walk | SkipRedundantCleanup | true | Cleanup skip |
| Walk | SkipRedundantPrepare | true | Prepare check skip |
| Walk | SkipSortedSort | true | Sort skip |
| Logging | LogSlowApplies | false | Log ApplyUpgrades / ReapplyUpgrades calls slower than LogThresholdMs |
| Debug | Verify | false | Run the original code next to every cached or skipped step and log mismatches. Safe, but as slow as the unmodded game |
| Debug | Hotkeys | false | F7–F9 toggle the features, F10 runs a benchmark, F11 prints stats |
| Debug | DetailedProfiling | false | Per-call timing. It slows down the code it measures |
Compatibility
- Tested with Mycopunk v2.0.4 and BepInEx 5.4.23.3.
- After a game update, check
BepInEx/LogOutput.log. If a step can't find what it needs, it logs a warning and turns itself off, and the game keeps working. - Mods that remove upgrades from the player's data in their own code (not by calling the game's methods) are not covered by the change tracking. If you see problems together with such a mod, set the
Walkoptions to false.
Building
Requires the .NET SDK (6 or newer) and a Mycopunk install with BepInEx.
dotnet build -c Release src/UpgradeLagFix -p:GamePath="<path to Mycopunk>"
scripts/package.ps1 builds the Thunderstore zip into dist/.
License
MIT