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.
VikingLib
Modular combat mechanics, canonical status effects, and damage calculation framework for Valheim.
| Date uploaded | 16 hours ago |
| Version | 0.4.0 |
| Download link | DigitalVikings-VikingLib-0.4.0.zip |
| Downloads | 48 |
| Dependency string | DigitalVikings-VikingLib-0.4.0 |
This mod requires the following mods to function
denikson-BepInExPack_Valheim
BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.
Preferred version: 5.4.2202ValheimModding-Jotunn
Jötunn (/ˈjɔːtʊn/, 'giant'), the Valheim Library was created with the goal of making the lives of mod developers easier. It enables you to create mods for Valheim using an abstracted API so you can focus on the actual content creation.
Preferred version: 2.20.1README
VikingLib
VikingLib is a modular combat mechanics, character statistic, and damage calculation framework for Valheim. It decouples Valheim's combat, poise, status effect, and stat systems from monolithic vanilla methods, providing a deterministic foundation for combat overhauls, RPG progression, weapon packs, and perk mods.

⚠️ Pre-Release (v0.3.0): This framework is in active development. Features, internal APIs, and balance defaults may evolve between minor releases. Back up your character and world saves before testing.
Core Features
VikingLib intercepts and standardizes combat math, poise, status effects, and resource drains through deterministic, server-authoritative pipelines:
- 6-Phase Prioritized Damage Pipeline: Every melee hit, projectile, and environmental impact executes sequentially across 6 phases (
PreCheck,AttackerModifiers,TargetDefenses,Mitigation,Execution,PostHitProcs), supporting multi-target cleave decay (Geometric,Continuous, orVanilla), armor penetration, lethal-hit interception, and damage reflection. - Dual-Space 3-Tier Mathematical Engine: Evaluates character stats across 160+ declarative tokens using strict modifier precedence — Tier 1 (Flat), Tier 2 (Additive %), and Tier 3 (Compounding Multipliers):
Final = (Base + Σ Flat) × max(0, 1 + Σ Increased%) × ∏ Multipliers - Asymptotic Action Efficiency: Stamina, Eitr, health, and durability costs scale smoothly in the denominator (
Effective Cost = Base / ((1 + Σ Efficiency%) × ∏ Multipliers)), ensuring stacked buffs never reduce action costs to zero or flip negative. - Dynamic Poise Scaling & Physical Damage Triad:
- Creature poise thresholds scale dynamically via a square-root health formula (
Poise = k × √MaxHealth × Offset) with configurable coefficient, global multiplier, and sparse per-creature offsets. - Blunt builds stagger/poise, Slash inflicts post-mitigation Bleed slices (supporting
SeverityGatedRefreshandIndependentmodels with dual absolute and max-HP DPS caps), Pierce gains a melee precision multiplier, and Shields retaliate with poise damage on blocks and timed parries. - Displays live amber poise bars and active status effect chips beneath enemy and boss health bars.
- Creature poise thresholds scale dynamically via a square-root health formula (
- Armor Mitigation & Elemental Armor Absorption: Supports both asymptotic
LinearEHP(Damage = Incoming / (1 + Armor / K + Eff)) andVanillaPiecewisearmor formulas, alongside a configurableElementalArmorAbsorptionRatio(0.0–1.0) governing how much physical body armor absorbs elemental and magic damage (Fire, Frost, Lightning, Poison, Spirit). - Status Effects & Logout Persistence: Provides a builder API for stacked, multi-slice, charged, and barrier-capable status effects. Automatically persists active temporary buffs (Forsaken powers, meads, potions, and custom VikingLib effects) across logout and reconnection via
Player.m_customData. - Combat Dossier, Hugin's Compendium & Modular Glossary Sections:
- Toggle or hold
[Shift]over weapon tooltips to inspect combo chains, chained multi-secondary attacks, decoupled bare-hand vs. fist-weapon profiles, cleave ratings, and live stamina/Eitr costs. - Adds a live Character Stats breakdown and trophy-unlocked Creature Combat Dossiers into Hugin's Compendium (
TextsDialog). - Downstream mods can register dedicated custom glossary categories (
CharacterStatsGlossaryPanel.RegisterCustomCategory) with automatic sparse pruning when empty.
- Toggle or hold
- Project Auga Bridge: Zero-dependency soft runtime integration that injects a scrollable Stats tab into Auga's Player panel, adapts VikingLib weapon tooltips, and enriches Auga's Bestiary stat cards with poise thresholds, stagger timers, cleave resistance, and body armor values.
Click to expand Combat Stat Taxonomy (160+ Declarative Tokens)
| Category | Representative Tokens | Description |
|---|---|---|
| Vitals & Recovery | MaxHealth, MaxStamina, MaxEitr, MaxCarryWeight, HealthRegen, StaminaRegen, EitrRegen, FoodDurationMultiplier |
Physical pools, regeneration rates, combat regen delays, and food scaling. |
| Delivery & Stance | DamagePhysical, DamageElemental, DamageMelee, DamageRanged, DamageMagic, DamageOneHanded, DamageTwoHanded |
Umbrella damage multipliers across combat stances and delivery methods. |
| Techniques & Triad | AttackSpeed, CriticalStrikeChance, CriticalStrikeMultiplier, DamageSecondaryAttack, DamageComboFinisher, DamageSneak, CleaveEfficiency, StaggerDamage, SlashBleedPercent, ParryPoiseMultiplier, BowDrawSpeed, CrossbowReloadSpeed |
Modifiers altering attack tempo, multi-crits, bleed/poise mechanics, stealth, and ranged handling. |
| Situational Contexts | DamageAgainstBosses, DamageAgainstStaggered, DamageAgainstAirborne, DamageAgainstAfflicted, DamageExecute, DamageFirstStrike, DamageBerserk, DamageFlawless, DamageAtNight, DamageWhileAirborne |
Dynamic combat context modifiers evaluated in Phase 1 from live attacker/target states. |
| Weapon Families | DamageSwords ... DamageBloodMagic, AttackSpeedSwords ... AttackSpeedBloodMagic (11 families each) |
Per-weapon-family damage and swing-speed mastery multipliers (including decoupled bare-hand/unarmed support). |
| Action Efficiencies | MeleeStaminaEfficiency, RangedStaminaEfficiency, BlockStaminaEfficiency, ToolStaminaEfficiency, AttackEitrEfficiency, DurabilityEfficiency, SprintEfficiency, DodgeEfficiency |
Asymptotic denominator efficiency ratings scaling stamina, Eitr, blood-magic health, and durability costs. |
| Defense & Resistances | BodyArmor, ArmorEfficiency, BluntArmorEfficiency, SlashArmorEfficiency, PierceArmorEfficiency, StaggerResistance, ResistancePhysical, ResistanceElemental, ResistanceSlashing ... ResistanceBleed, ResistanceFall |
Armor efficiency ratings, poise thresholds, and multiplicative damage-taken factors (Taken = Base × ∏ Multipliers, Tier 3 only). |
| On-Hit Resource Recovery | HealthOnKill, StaminaOnKill, EitrOnKill, HealthOnDamageTaken, StaminaOnCauseStagger (3×3 trigger matrix) |
Flat resource restoration triggered on kill, stagger break, or damage taken. |
| Yields, Mounts & Vehicles | MiningYield, WoodcuttingYield, MonsterDropYield, CraftingYield, CookingYield, ForagingYield, HarvestRadius, RidingSpeed, ShipSailSpeed, CartWeightEfficiency |
Multi-drop roll budgets, agricultural reach, mount handling, sailing speed, and cart cargo efficiency. |
Click to expand Developer Console Commands & Diagnostics
VikingLib includes developer commands accessible in the Valheim console (F5):
| Command | Usage | Description |
|---|---|---|
vl_buff |
vl_buff [on | off | clear | laststand] |
Toggles synthetic test buffs across all taxonomy categories (or toggles a Last Stand test handler) on the local player. |
vl_trace |
vl_trace |
Prints a formatted diagnostic breakdown of the most recent combat hit (damage rolls, modifiers, armor, and resistances). |
vl_log |
vl_log [off | player | all] |
Configures live combat telemetry logging to the BepInEx console. |
vl_armor |
vl_armor [linear | piecewise | k <value>] |
Views or switches the active armor mitigation model and LinearEHP scaling constant K. |
vl_se |
vl_se [apply <name> [stacks] [duration] | list | clear [name] | info <name>] |
Inspects, applies, or clears registered VikingLib status effects on the local player. |
vl_dump_attacks |
vl_dump_attacks |
Exports all weapon attack configurations from ObjectDB to VanillaWeaponAttacks.json. |
Click to expand Downstream Mod Integration Guide
Reference VikingLib.dll in your project and declare a hard dependency on com.digitalvikings.vikinglib:
using BepInEx;
using VikingLib.Stats;
using VikingLib.UI;
[BepInPlugin("com.author.mymod", "MyCombatMod", "1.0.0")]
[BepInDependency("com.digitalvikings.vikinglib", BepInDependency.DependencyFlags.HardDependency)]
public class MyModPlugin : BaseUnityPlugin
{
private void Awake()
{
// Declarative character stat modifier (+20% sword damage, Tier 2 Additive)
CharacterStats.DamageSwords.AddIncreased(Player.m_localPlayer, 0.20f, "Swordmaster");
// Type-safe continuous resistance (Tier 3 Multiplier only: -20% fire damage taken)
CharacterStats.ResistanceFire.AddMultiplier(Player.m_localPlayer, 0.80f, "Fire Ward");
// Asymptotic action efficiency (+25% melee stamina efficiency)
CharacterStats.MeleeStaminaEfficiency.AddIncreased(Player.m_localPlayer, 0.25f, "Iron Stamina");
// Register a modular custom glossary section in Hugin's Compendium (auto-pruned when empty)
CharacterStatsGlossaryPanel.RegisterCustomCategory("My Mod Perks", player => new[]
{
("Active Stance", "Swordmaster (+20%)")
}, priority: 50);
}
}
Developed by DigitalVikings.
CHANGELOG
Changelog
All notable changes to VikingLib will be documented in this file.
[0.4.0] - 2026-11-23
Added
- Unified VikingHub Interface: Introduced the centralized VikingHub window with a live Stats tab, category filtering, and shared visual theming for DigitalVikings mods.
- Modular Food Modifier Pipeline: Added a clean food stat adjustment system enabling compatible mods to modify meal Health, Stamina, Eitr, and duration values safely.
- Combat Damage Telemetry: Added structured per-phase damage tracing to help diagnose combat modifiers and mitigation calculations.
Changed
- Configuration & Glossary Polish: Refined configuration descriptions, character stat glossary formatting, and Project Auga UI/tooltip integration.
Fixed
- Weapon Tooltips & Attack Profiles: Improved item tooltip rendering and secondary attack profile discovery.
[0.3.0] - 2026-11-03
Added
- Dynamic Poise Scaling: Enemy stagger thresholds now scale dynamically via a square-root health formula with customizable coefficient and outlier offsets.
- Multi-Secondary Attack Support: Weapon attack discovery now recognizes chained secondary attacks, rendering individual attack profiles in item dossiers.
- Elemental Armor Absorption: Configurable armor absorption for elemental and magic damage sources alongside physical damage mitigation.
- Decoupled Bare-Hand Combat: Unarmed strikes and crafted fist/claw weapons now maintain distinct secondary attack profiles and progression.
Changed
- Bleed Damage Model: Bleeding afflictions now support severity-gated refresh models and dual absolute/relative health caps.
- Combat Balance Defaults: Retuned baseline stagger coefficient, poise linger duration, pierce precision, and shield poise retaliation.
Fixed
- Unspawned Creature Dossiers: Resolved null reference exceptions when inspecting uninstantiated creature prefabs in the bestiary compendium.
[0.2.3] - 2026-10-29
Added
- Creature Cleave System: Introduced multi-target cleave scaling on creatures, granting full cleave capability to bosses and giants.
- Status Effect Persistence: Active Forsaken powers, meads, and potions are now preserved across logout and reconnection.
- Combat Wounded State: Taking direct physical damage temporarily reduces health regeneration to 33% for 8 seconds with custom HUD indicators.
- Project Auga UI Integration: Real-time combat and survival stats injected natively into Auga's Player panel with custom scroll drawer and quick-jump link.
- Creature & Lore Dossiers: Unlocked creature combat dossiers and martial treatises integrated into Hugin's Compendium and Auga's Bestiary.
Changed
- Modularized Phase Handlers: Decoupled default combat phase implementations into dedicated handler structures for improved maintainability.
- Skill Lifecycle Architecture: Reorganized native skill interception patches into dedicated domain modules.
Fixed
- Eikthyr Stamina Scaling: Corrected Forsaken power stamina cost calculation to grant the full intended 60% discount.
[0.2.2] - 2026-10-27
Changed
- Calibrated Stagger Durations: Refined stagger recovery windows across creature tiers (Minor foes ~2.0s, Standard mobs ~2.75s, Heavy elites ~4.0s, Bosses full 5.0s, and Player 2.0s baseline).
- Combat Dossier Formatting: Streamlined weapon tooltip layout, attack profile headers, and keybinding prompt clarity.
[0.2.1] - 2026-10-25
Fixed
- Fixed critical game startup error triggered by cooking station drop yield telemetry registration.
[0.2.0] - 2026-10-25
Added
- Universal Poise & Boss Stagger Engine: Continuous poise accumulation, uniform stagger duration, and overhead stagger meters, enabling full stagger stuns against all world bosses and giants.
- Economic Yield Engine: Configurable gathering, mining, woodcutting, cooking, and crafting bonus yield mechanics with detailed logging receipts.
- Physical Triad Calibration: Scaled Slash Bleed to 35% of post-mitigation damage, Melee Pierce Precision to +25%, and decoupled enemy physical attack stagger buildup.
Changed
- Default cleave mode changed from
ContinuoustoGeometric.
[0.1.0] - 2026-10-25
Added
- 6-Phase Combat Pipeline: Modular damage processing framework (
PreCheck,AttackerModifiers,TargetDefenses,Mitigation,Execution,PostHitProcs) supporting multi-target cleave, armor penetration, and continuous resistances. - Universal Poise & Boss Stagger Engine: Continuous poise accumulation, uniform stagger duration, and overhead stagger meters, enabling full stagger stuns against all world bosses and giants.
- Dual-Space 3-Tier Stat Architecture: Standardized mathematical engine evaluating character stats across 90+ tokens using flat bases, additive percentages, and compounding multipliers with asymptotic stamina efficiencies.
- Multi-Slice Status Effect System: Dynamic status effect architecture supporting severity-gated bleed refresh, DPS rate bounds, duration-first absorption shields, and automated stat scaling.
- Economic Yield & Environmental Engine: Configurable gathering, mining, and woodcutting drop scaling, plus detection utilities for felled logs.
- Network Serialization Protocol: Robust binary protocol maintaining byte symmetry and save-file safety for custom combat data over RPCs.