Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
balrond core optimizer
Mod optimize logic calculations in multiple ingame components to lessen CPU burden
| Last updated | 3 hours ago |
| Total downloads | 12 |
| Total rating | 0 |
| Categories | Mods Tweaks Misc Libraries Tools Server-side Client-side Utility Bog Witch Update |
| Dependency string | Balrond-balrond_core_optimizer-0.1.0 |
| Dependants | 0 other packages depend on this package |
README
Balrond Core Optimizer
Client-side CPU/presentation optimization for Valheim
Balrond Core Optimizer reduces repeated CPU work that Valheim performs for visual state, lights, effects, audio and frequently queried world-object lists. It is aimed especially at large bases, dense modded worlds and scenes containing thousands of active components.
The optimizer does not try to change combat, production speed, AI, structural integrity or networking. Its main rule is: if the result is already known and unchanged, avoid doing the same presentation work again; if an object becomes truly idle, stop scheduling its unnecessary callback until a real wake event occurs.
Join Balrond's Den · All Balrond mods · Support development on Ko-fi · Commission inquiries
What does it optimize?
Static and network-backed visuals
- Armor Stand visual revision gate — skips repeated attachment reconstruction while its ZDO data revision is unchanged.
- Armor Stand cloth LOD — replaces the vanilla every-frame
Vector3.Distancecheck with a throttled squared-distance check. - Item Stand visual revision gate — avoids repeating the same attachment visual rebuild.
- Ward / PrivateArea status visuals — avoids repeated
SetActiveand material emission writes while the ward state is unchanged, while preserving vanilla flash re-arming. - Portal stable emission — keeps portal transitions full-rate, then stops rewriting the same emission color every frame after the fade reaches its endpoint.
Character presentation
- VisEquipment equipment signature gate — avoids repeated equipment reconstruction when the relevant equipped-item state is unchanged.
- VisEquipment color signature gate — avoids repeated skin/hair material writes when colors, model and generated hair/beard instances are unchanged.
The color gate explicitly treats a player model change as an invalidation event, so the same color values are still re-applied to a newly selected model.
Production presentation
- Smelter visual-state gate — skips repeated model/animator state writes while fuel/ore/roof/smoke presentation state is unchanged. Production itself remains vanilla.
- Fireplace visual-state gate — skips stable visual tiers while preserving the wet-owner
RPC_ToggleOnpath embedded in vanillaUpdateState. - Cooking Station visual signature gate — caches slot/status/fire/fuel presentation only. Cooking timers and fuel consumption remain vanilla.
- Crafting Station idle dormancy — once the vanilla use and extension timers have reached their only meaningful thresholds, a completely idle station is removed from Valheim's per-frame CraftingStation updater list.
PokeInUseand extension refreshes wake it again immediately.
Lights, smoke and continuous effects
- LightFlicker distance throttling — near lights remain full-rate; persistent distant lights update at progressively lower rates. TTL/fading lights stay vanilla.
- Central LightLod scheduler — replaces one
LightLod.UpdateLoopcoroutine per light with a single time-sliced scheduler. Stable lights receive no per-frame LightLod callback; lights that are actively fading still transition every frame. - SmokeRenderer throttling — reduces only smoke particle presentation refresh.
SmokeSpawner, smoke blockage and fireplace/smelter gameplay remain untouched. - Windmill audio throttling — only
UpdateAudiois reduced; windmill movement and propeller gameplay stay vanilla. - Cart/Vagon audio throttling — cart physics and attachment remain vanilla.
- Cart idle tether gate — a detached cart whose tether line is already hidden skips the redundant
LateUpdateresult. - EffectFade endpoint dormancy — once the effect reaches a stable endpoint, its
Updatecomponent is disabled;SetActivewakes it. - MaterialFader endpoint dormancy — once all fade properties have finished, its
Updatecomponent sleeps;TriggerFadewakes it. - ZSFX idle dormancy — completed, non-looping audio objects leave the per-frame ZSFX updater list. Normal
ZSFX.Play/FadeOutwake them immediately, and a low-frequency watchdog catches unusual mods that directly start the underlyingAudioSource. - LineConnect no-connection gate — caches the stable hidden/no-peer state for about one second, reducing repeated
ZNetScene.FindInstancelookups while still periodically reconciling streaming changes.
Exact query micro-optimizations
Selected radius queries keep Valheim's own collections and traversal order but use squared-distance comparisons instead of repeated square roots:
Piece.GetAllPiecesInRadiusPiece.GetAllComfortPiecesInRadiusCraftingStation.UpdateKnownStationsInRangeCraftingStation.HaveBuildStationInRangeCraftingStation.FindStationsInRangeCraftingStation.FindClosestStationInRangeStationExtension.OtherExtensionInRange
What performance should I expect?
Performance depends heavily on the world, CPU, mod list, number of loaded objects and which components dominate the frame.
During development, an intentionally extreme test world containing more than 120,000 instances in one area was reported at roughly 5 FPS without the optimizer and 14 FPS with an earlier optimizer build enabled. That result is a useful stress-test signal, not a promise of a 2.8× FPS increase in normal worlds. A normal base with a different bottleneck may show a smaller gain.
Version 0.1.4 specifically tries to improve the worst-case CPU side further by removing idle components from update lists and replacing thousands of independent LightLod coroutines with one scheduler, instead of merely adding more cheap Harmony checks.
For proper comparison, use the same save, camera position and graphics settings and compare frametime/1% lows as well as average FPS.
Safety boundaries
Balrond Core Optimizer intentionally does not patch or replace:
ItemDrop,Floatingor dropped-item Rigidbody physics,ZSyncTransform/ZSyncAnimation,ZDOMan,ZNetScene,ZRoutedRpc,ZRpc,ZNetor socket transport,- Valheim's global
MonoUpdatersdispatcher itself, WearNTear/WearNTearUpdaterstructural integrity,- AI/pathfinding/spawn simulation,
- smoke spawning/blockage simulation,
- production timers or resource consumption.
The optimizer can read normal existing ZDO state to decide whether a local visual needs refreshing, but it adds no custom RPC protocol, no custom ZDO keys and no competing network authority layer.
FiresGhettoNetworking
FiresGhettoNetworking remains the authority/network specialist. BVO deliberately stays away from its transport, ZDO replication, RPC routing, server authority, zone and ZSyncTransform responsibilities.
Balrond Better Build
Better Build remains responsible for structural integrity/support optimization. BVO treats the complete WearNTear and WearNTearUpdater area as protected.
Harmony conflict protection
Disable On Foreign Harmony Patches = true is the recommended default.
For optimizer methods that can skip or replace vanilla work, BVO checks Harmony ownership of the exact target. If another mod patches that same method, BVO disables/unpatches its own conflicting feature rather than relying on fragile patch order. The plugin periodically rechecks late-loaded conflicts and also reconciles immediately after a config change.
The log prints a summary such as:
[patches] patches active=.../... , disabled=..., permanently-blocked=...
If a feature is not active, the same summary reports the first reason.
Installation
Thunderstore / mod manager
Install the compiled release with a Thunderstore-compatible manager. BepInEx is required by the package/dependency chain.
Manual installation
For a compiled release, copy the mod DLL into your normal BepInEx plugins directory, for example:
Valheim/BepInEx/plugins/BalrondCoreOptimizer/
Then start Valheim once so BepInEx creates:
BepInEx/config/balrond.astafaraios.BalrondCoreOptimizer.cfg
Client or server?
Version 0.1.0 is a client-side presentation optimizer. It does not require a dedicated-server installation and deliberately skips its client presentation patches in batch/dedicated mode.
Every player may use their own local optimizer settings. For consistent troubleshooting, compare clients using the same version.
Recommended configuration
The defaults are intended to be usable without editing the config. All actual optimization features are enabled by default; only diagnostics and unsafe development overrides are disabled.
Important defaults:
[0 General]
Enabled = true
Allow Unknown Game Build = false
Disable On Foreign Harmony Patches = true
Compatibility Recheck Seconds = 60
Visual Safety Refresh Seconds = 30
Static Visual Safety Refresh Seconds = 30
[1 Static Visuals]
ArmorStand Revision Gate = true
ArmorStand Cloth Throttling = true
ArmorStand Cloth Checks Per Second = 10
ItemStand Revision Gate = true
PrivateArea Status Visual Gate = true
Portal Stable Emission Gate = true
[4 Continuous Presentation]
Light Flicker Near Distance = 40
Light Flicker Mid Distance = 60
Light Flicker Far Distance = 100
Light Flicker Mid Updates Per Second = 10
Light Flicker Far Updates Per Second = 5
Light Flicker Distant Updates Per Second = 2
Light Flicker Distance Checks Per Second = 2
LightLod Central Scheduler = true
LightLod Distance Checks Per Second = 1
LightLod Checks Per Frame = 512
Smoke Renderer Updates Per Second = 10
Windmill Audio Updates Per Second = 10
Vagon Audio Updates Per Second = 10
Allow Unknown Game Build should remain false for players. It exists only so a developer can deliberately test private/publicized replacements against an unaudited Valheim assembly.
See Config/CONFIGURATION.md in the source package for every setting.
Diagnostics and benchmarking
For normal play keep:
Runtime Statistics = false
For testing, enable it temporarily. Every configured interval BVO reports delta counts for that interval, not only one ever-growing lifetime total. This makes it easier to tell whether a feature is actively saving work in the current scene.
A high counter alone does not prove an FPS gain. The useful test is:
- Use the same save and camera position.
- Let the scene settle for at least 30–60 seconds.
- Measure with BVO disabled.
- Restart and measure with BVO enabled.
- Compare average FPS, frametime, 1% low and visible stutter.
- Confirm that production, visuals, smoke behavior and multiplayer state still transition correctly.
The source package contains Diagnostics/MANUAL_TEST_PLAN.md with component-by-component edge cases.
Frequently asked questions
Does this change gameplay?
It is designed not to. Gameplay/authority systems such as production timing, physics, structural support, AI, smoke blockage and networking remain outside the optimizer's patch scope.
Why can one optimization disable itself?
Another Harmony mod may patch the exact same method. With conflict protection enabled, BVO prefers vanilla/the other mod over stacking a skip/replacement patch whose ordering cannot be proven safe.
Why is Allow Unknown Game Build off?
Several 0.1.4 optimizations use private/publicized Valheim fields and exact method replacements. The MVID guard prevents those patches from silently running on an assembly version that was not audited.
Do normal players need publicized assemblies?
No. Publicized assemblies are a developer/build-time dependency for compiling this source project. A normal player installs the already compiled BVO DLL.
Why does the source project require publicized_assemblies?
Version 0.1.0 intentionally uses direct access to Valheim's normally private fields/methods to avoid reflection and reduce hot-path overhead. The project therefore fails the build with a clear error if valheim_Data/Managed/publicized_assemblies/assembly_valheim.dll is missing.
Does BVO optimize dropped items?
No. ItemDrop, Floating, Rigidbody ownership and ZSyncTransform are deliberately untouched. Problems with a dropped item floating in multiplayer should not be "fixed" by BVO taking over networked item physics.
Bug reports and support
For bug reports and compatibility help:
Please include:
- Balrond Core Optimizer version.
- Valheim version.
- Complete BepInEx log.
- Full mod list/profile code.
- Single-player, local host or dedicated-server client.
- The exact object/action that causes the problem.
- Whether the problem disappears when the matching BVO feature is disabled.
- If performance-related: before/after frametime or FPS measured from the same scene.
For loading, Harmony and compatibility problems, the complete log is much more useful than a screenshot alone.
Support development
Balrond Core Optimizer and Balrond's other public Valheim projects are available to the community. Support helps fund maintenance, compatibility work, profiling, documentation and future systems.
For custom mods, integrations or commissioned work:
Public bug fixes are not paywalled. Project-specific implementation, private configuration and commissioned integration may require a separate quote.