You are viewing a potentially older version of this package. View all versions.
FamTeam-LeanHeim-0.5.2 icon

LeanHeim

Client-side performance fixes for Valheim: smoother big bases, storms and portals. Fixes snow and per-second update spikes, moves asset cleanup to loading screens. Works with vanilla players and servers.

Date uploaded a week ago
Version 0.5.2
Download link FamTeam-LeanHeim-0.5.2.zip
Downloads 217
Dependency string FamTeam-LeanHeim-0.5.2

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2350 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.

Preferred version: 5.4.2350

README

LeanHeim

Client-side performance fixes for Valheim, made for big bases, storms and weak PCs.

LeanHeim fixes parts of the game that waste CPU time. It does not lower your graphics quality by default.

Support me on Ko-fi

Multiplayer

  • Install it only on your own PC. Other players and the server do not need it.
  • It adds no network messages and no version check, so you can join vanilla servers and play with vanilla friends.
  • On a dedicated server (no graphics device) it does nothing.

What it does

Buildings

  • Snow speed bug fixed. In vanilla, snow on buildings piles up faster at low FPS (about 3x faster at 20 FPS than at 60 FPS). LeanHeim makes it grow at vanilla's 60 FPS speed on every PC.
  • Fewer snow network updates. In a snowstorm, vanilla writes the snow level of every building piece to the network about once per second. LeanHeim writes it only when it changed by a visible amount. You get less CPU work and less network traffic, and snow looks the same.
  • No once-per-second spike. Vanilla updates the roof and ash state of all building pieces in a single frame every second. LeanHeim spreads the same work over several frames.

Creatures

  • Purely visual creature updates (slope tilt, water and slide effects) run once per frame instead of on every physics step. At low FPS there are 3 to 5 physics steps per frame. AI, combat and movement are untouched.

Memory cleanup (unload unused assets)

  • Vanilla runs this cleanup once per hour at a random moment, which causes a freeze, even in combat. LeanHeim postpones it to the next loading screen.
  • It also cleans up during long-distance teleports (portals and dev commands) while the screen is black.
  • On respawn, vanilla's own cleanup runs while the screen is still black instead of after you appear.
  • Sleep and pause-menu cleanup stay exactly as in vanilla.

Optional (config)

  • Weather: lower rain and snow particle density, and turn off particle collisions.
  • Low-end GPU: settings below the lowest in-game preset (texture resolution, LOD, grass, shadow cascades, reflection probe), for laptops and integrated graphics.
  • Rendering: shadow distance cap and a draw-distance limit for small clutter.
  • Profiler: a built-in profiler and freeze detector that write to the BepInEx log.

Configuration

The config file is BepInEx/config/leanheim.performance.cfg. It is created on the first start.

Every feature has its own Enabled switch. Turning a switch off restores vanilla behaviour.

Compatibility

  • Requires BepInExPack Valheim.
  • It patches WearNTear, WearNTearUpdater, Character, Player.UpdateTeleport, Game cleanup methods, EnvMan weather particles and graphics settings. Other mods that completely replace these methods may conflict.
  • If the game updates and a patch no longer fits, LeanHeim writes a warning to BepInEx/LogOutput.log. The rest of the game keeps working.

Reporting problems

Enable [1 - Profiler] Enabled = true, play until the problem happens, and attach BepInEx/LogOutput.log.

Support

If LeanHeim made your game smoother, you can support its development. Thank you!

Support me on Ko-fi

CHANGELOG

Changelog

0.8.2

Settings window usability.

  • Every option row is a proportional grid (label column, control column), so sliders and radio buttons line up on every row and at any screen size. Radio buttons sit in equal columns that line up across options; all values fit (before, 128 and 256 were cut off).
  • Slider tooltips now explain what the minimum and the maximum value do, and every option shows its recommended value (the defaults are the recommended values). The tooltip area is larger and shrinks long texts to fit.
  • Values show their unit (m, s, ms, min, FPS); multipliers show as percentages (60% instead of 0.6); 0 shows what it means ("Off" or "Game").
  • Sliders move in round steps (for example 5 m, 5%, 0.5 ms) instead of values like 147.23.
  • TextureQualityReduction is now a radio choice: Full, 1/2, 1/4, 1/8 (same values as before, existing settings are kept).
  • Labels of a module's options are dimmed while the module is off, and options that differ from the recommended value are marked "(changed)".
  • The reset button is now called "Reset tab to recommended".

0.8.1

Fixes for the settings window and for applying settings while playing.

  • Settings window: the mouse wheel scrolls one row per notch (it was very slow); a scrollbar on the right; Home / End / PageUp / PageDown scroll the list; the list starts at the top when you switch tabs.
  • Settings window: options with a fixed set of values (ReflectionResolution, ShadowCascades) are radio buttons in a grid; "Game" means the game's own value is kept, and the option tooltips now say so. Sliders keep the game's full slider look, including the handle.
  • The game now pauses while the settings window is open, like the game's own menu (single player only). New setting [0 - Menu] PauseGame (on).
  • Graphics changes made while playing no longer re-run the game's whole graphics apply (which also re-sent the simulation distance and reset other systems). Only the changed values are set, and switching a module off restores the game's own LOD bias, shadow cascades and shadow distance exactly.
  • Grass distance and density changes now show at once (the grass around you is rebuilt), not only on newly loaded ground.
  • The profiler no longer half-starts when switched on in the menu: it needs a restart, as its label says.
  • LogGarbageCollections switched off and on again no longer reports one wrong burst; a shorter FeatureLogIntervalSeconds applies at once.

0.8.0

  • New in-game settings window (F8) built from the game's own UI (its buttons, toggles, sliders and fonts); option descriptions show at the bottom of the window when you hover an option. The camera and game controls are locked while it is open. Every option can be switched on or off while playing, no restart needed (only the profiler switch needs one). Options sit in four tabs with a category tag: Performance, Memory, Graphics, Diagnostics. Hover an option for its description; "Reset this tab to defaults" is at the bottom. The key can be changed ([0 - Menu] ToggleKey).
  • All modules now switch live: turning one off restores vanilla behaviour at once (weather, lights, reflections, grass, shadow and texture settings are restored to what the game had).
  • The graphics modules are back (sections "2 - Weather", "3 - Lights", "4 - Rendering", "5 - Low-end GPU"), now all off by default and tagged Graphics in the menu. Existing config values are kept.
  • New setting CacheSupportLookups (section "7 - Buildings", on by default): structural support checks remember which building piece each nearby collider belongs to instead of searching the object hierarchy again every second. Same result, less CPU on big bases.
  • New section "12 - World streaming": PaceTerrainRebuilds (on) spreads queued terrain rebuilds away from the player over several frames (TerrainRebuildBudgetMs, 8 ms per frame). The player's own ground and loading screens are never delayed. Log tag [LeanHeim Terrain].
  • Every garbage collection is logged with its frame length ([LeanHeim Garbage], setting LogGarbageCollections). Each feature writes a summary every FeatureLogIntervalSeconds (60).
  • Profiler: new setting TrackAllocations (on by default while the profiler is on): the report shows the total garbage rate (KB/frame, MB/s) and the top garbage-producing subsystems, plus the hit rate of the support lookup cache.
  • New module "9 - Engine": ReuseCollisionCallbacks (on by default): physics reuses one Collision object per callback instead of allocating a new one each time, so less garbage and fewer GC pauses.
  • New setting CollectGarbageOnLoadingScreen (section "8 - Memory", off by default): at respawn, when the asset cleanup is not due, a full garbage collection runs while the screen is black, so the pause does not hit gameplay later. The log prints its duration and freed memory.
  • The log now confirms the Physics setting applied by the Engine module.
  • Profiler: freeze (hitch) lines can now name more suspects: world and player saving, map saving, zone/object creation, terrain rebuild and dungeon spawning.
  • Removed the MergeTransformSyncs setting from 0.6.0 (it was off by default).
  • This release also contains the planned 0.7.0 changes (never built as a separate version): the graphics settings removed in 0.6.0 are back, now off by default and switchable live from the menu (see the list above).

0.7.0

Not released as a separate build; its changes are part of 0.8.0.

  • The graphics settings removed in 0.6.0 return: sections "2 - Weather", "3 - Lights", "4 - Rendering", "5 - Low-end GPU". They are all off by default, so nothing changes in how the game looks unless you switch a module on. Existing config values are kept.
  • Each graphics module can be switched on and off while playing; switching it off restores what the game had.

0.6.0

  • Removed all graphics changes (sections "2 - Weather", "3 - Lights", "4 - Rendering", "5 - Low-end GPU"). LeanHeim now only changes how much work the game does, never how it looks. Their old lines in the config file do nothing and can be deleted.
  • New setting CacheSupportLookups (section "7 - Buildings", on by default): structural support checks remember which building piece each nearby collider belongs to instead of searching the object hierarchy again every second. Same result, less CPU on big bases.
  • New section "12 - World streaming": PaceTerrainRebuilds (on) spreads queued terrain rebuilds away from the player over several frames (TerrainRebuildBudgetMs, 8 ms per frame). The player's own ground and loading screens are never delayed. Log tag [LeanHeim Terrain].
  • Every garbage collection is logged with its frame length ([LeanHeim Garbage], setting LogGarbageCollections). Each feature writes a summary every FeatureLogIntervalSeconds (60).
  • Profiler: new setting TrackAllocations (on by default while the profiler is on): the report shows the total garbage rate (KB/frame, MB/s) and the top garbage-producing subsystems, plus the hit rate of the support lookup cache.
  • New module "9 - Engine" (client-side, same result with less work):
    • ReuseCollisionCallbacks (on by default): physics reuses one Collision object per callback instead of allocating a new one each time, so less garbage and fewer GC pauses.
    • MergeTransformSyncs (off by default, multiplayer only): objects moved by other players no longer trigger a physics transform sync one by one; the syncs are merged into one right after the whole batch.
  • New setting CollectGarbageOnLoadingScreen (section "8 - Memory", off by default): at respawn, when the asset cleanup is not due, a full garbage collection runs while the screen is black, so the pause does not hit gameplay later. The log prints its duration and freed memory.
  • The log now confirms the Physics setting applied by the Engine module.
  • Profiler: freeze (hitch) lines can now name more suspects: world and player saving, map saving, zone/object creation, terrain rebuild and dungeon spawning.

0.5.2

  • New setting IncrementalGcTimeSliceMs (section "8 - Memory", default 0 = game value untouched): if the game build uses incremental garbage collection, it caps how many milliseconds per frame the collector may work, so one long pause becomes several short ones. Does not change gameplay. The startup log now prints the GC mode, time slice and mono heap size.
  • Profiler: freeze (hitch) lines now also show the mono heap size and whether a garbage collection happened during the frame; the periodic report shows gen0 collections and heap size.
  • Profiler: method names are cached, so the profiler itself allocates less and adds less overhead.
  • Fixed the version number inside the plugin (it said 0.5.0 while the package was 0.5.1).

0.5.1

  • Added a Ko-fi support link to the README.

0.5.0

  • First public release.
  • Building fixes: snow growth no longer depends on FPS, fewer snow network writes, per-second update pass spread over several frames.
  • Creature visual updates run once per frame instead of every physics step.
  • Unload unused assets moved to loading screens (teleport, respawn); the hourly cleanup is postponed to the next safe moment.
  • Optional weather, low-end GPU and rendering settings.
  • Built-in profiler and freeze detector (off by default).