DFG-CustomMonsterReplacer icon

CustomMonsterReplacer

Monster manager: replace a vanilla monster's visual with a custom 3D model, or clone a prefab into a new creature with its own model, health, faction and spawns. Web tuning GUI.

By DFG

CHANGELOG

Changelog

All notable changes to CustomMonsterReplacer.

[1.4.3]

  • Package fix: Blurrg.glb was shipping in the deployed profile but was missing from the 1.4.2 package, so anyone installing from Thunderstore got a mod one model short of the one the author had been testing. The package now stages models straight from the build output rather than from a hand-kept list, so this cannot silently recur.
  • Re-verified against Valheim 1.0.16.

[1.4.2] - Performance

Four separate causes of lag, all real, all fixed:

  • updateWhenOffscreen was forced on for every custom SkinnedMeshRenderer, so the CPU re-skinned all 25 trooper.glb parts (and the bundle meshes) every frame for every greydwarf at any distance. It is now explicitly off.
  • AnimatorCullingMode.AlwaysAnimate on bundle creatures is now CullUpdateTransforms. Bones are still written, so culling does not make them pop.
  • MonsterRenderCuller registered itself in Attach(), which only runs on the prefab, so no live clone was ever in the ticker's list and nothing was ever culled. Registration moved to OnEnable/OnDisable. The log now prints distance culler: N custom model(s) in the world whenever N changes; if that stays at 0, culling is broken again.
  • The /options prefab cache walked all ~4,600 entries of ZNetScene.m_prefabs with a GetComponent<Character> on each, every 2 seconds. It now rebuilds only when the loaded prefab count changes.

Also: the model's Colliders are disabled alongside its renderers when culled, and Animator.parameters (which allocates a new array on every call) is no longer read from Update.

[1.4.0] - Creature mode and the monster manager

  • Two kinds of entry. Replace swaps a vanilla prefab's visuals in place, keeping its AI, stats and loot. Creature clones a vanilla prefab under a new registered name with its own mesh, health, faction, AI ranges and spawn entries.
  • The tuning GUI is now a monster manager. Entries are added and removed in the browser rather than by editing JSON.
  • Pre-1.4 configs (one with a root TargetPath) migrate once into three entries: the old visual replace, the old Creature block, and the code-defined ogre.
  • Creatures are patched in place on re-apply rather than rebuilt, because the clone is registered in ZNetScene and destroying it would break spawn.
  • Added the valheimbear and valheimogre AssetBundles (BearPlayer, OgrePlayer) and ogre.glb.

[1.2.0]

  • Skeleton binding: GLB skin joints are remapped to the vanilla Greydwarf skeleton by name (proximity-weighted fallback) so rigged models animate.
  • Live web tuning GUI (http://127.0.0.1:8777/): scale/position/rotation sliders, per-mesh enable/disable, auto-height-fit, skeleton overlay, and a generated Blender armature script for content creators.
  • Config moved/kept as JSON (monsterreplacer_config.json) beside the DLL, saved automatically on tuning.

[1.0.0] - Initial release

  • Replaces the Greydwarf visual with the bundled trooper.glb model via custom GLB/GLTF runtime parsing.
  • Uses Jotunn's PrefabManager.OnPrefabsRegistered.
  • Requires Jotunn (Jotunn 2.30.x).