VikingAI
Foundational 2.5D navigation graph, flow-field steering, tactical pack coordination, smart-object affordances, and virtual NPC simulation framework for Valheim.VikingAI
A foundational navigation, context-steering, sensory perception, tactical pack coordination, smart-object affordance, and unloaded-zone NPC simulation framework for Valheim.
Core Architecture
-
Unified 2.5D Clearance Navigation Graph (
NavGraphManager)- Normalizes vanilla
Pathfinding's $10\times$ tile-border link penalty (10.0 -> 1.2) to eliminate $32,\text{m}$ tile-seam zig-zagging. - Replaces multi-agent-type NavMesh rebuild stalls with a 2.5D clearance-annotated span graph (
TrueClearanceRadius,CeilingClearance,StructuralHp) and pluggableINavTraversalRulecontracts (GroundWalkRule,WaterSwimRule,DoorTraversalRule,LedgeJumpRule,SiegeBreachRule).
- Normalizes vanilla
-
Player-Centric Tactical Flow Fields (
TacticalFlowField)- Maintains a $64 \times 64,\text{m}$ ($2,\text{m}$ cell) Dijkstra integration and gradient vector field around combat anchors at $5,\text{Hz}$, stamping crowd density and fire hazards so large packs route around congestion.
-
16-Ray Context Steering & Polar Follower Formations (
SteeringPipeline)- Evaluates 16-slot radial
InterestandDangermaps across modularISteeringContributorstages (PathAndFlow,NeighborSeparation,ObstacleWhisker,HazardAvoidance,PlayerYield). - Decouples
SetLookDirfromSetMoveDironCharacterto unlock native $360^\circ$ humanoid combat strafing and backstepping. - Assigns tamed followers and companions into polar V-wedge formation slots behind the player and automatically steps aside when approached in corridors or doorways.
- Automatically opens and re-closes unlocked doors (
DoorTraversalController) for profiles withCanOpenDoorsenabled.
- Evaluates 16-slot radial
-
Layered Brain Pipeline, 4-Stage Sensory Engine & Pack Coordinator (
BrainPipeline)- Sensory Perception Engine (
SensoryMemoryController): GeneralizedCharacter-to-Character4-stage detection ramp (Unaware -> Suspicious -> Alerted -> Engaged), directional sunlight/shadow raycasting viaRenderSettings.sun, time-sliced foliage concealment, mathematical equipment-weight acoustic profiles, and a 32-slotAllyCallring buffer. - Tactical Pack Coordinator (
CombatPackCoordinator): Enforces simultaneous melee Attack Token budgets per target and distributes waiting attackers onto a $45^\circ$ flanking ring with anti-perch fallback.
- Sensory Perception Engine (
-
Smart Object Settlement Affordances & ZDO NPC Equipment (
AffordanceRegistry)- Slot-reserved settlement work providers (
SmelterAffordanceProvider,FireplaceAffordanceProvider,RepairPieceAffordanceProvider,HarvestPickableAffordanceProvider,LeisureChairAffordanceProvider) driven bySmartAffordanceBrainModule. - ZDO-backed NPC inventory persistence (
"VAI_v1_Inv") and fullVisEquipmentpaperdoll synchronization (hair, beard, and holstered back items) on non-playerHumanoids.
- Slot-reserved settlement work providers (
-
1 Hz Macro-ZDO Virtual Agent Director (
VirtualAgentDirector)- Simulates unloaded settlement NPCs and patrols at $1,\text{Hz}$ in
ZDOspace, applies deterministic time-delta catch-up when zones reload, and transports active party companions across portals and dungeon transitions.
- Simulates unloaded settlement NPCs and patrols at $1,\text{Hz}$ in
Vanilla-Faithful Baseline & Configuration
Unopinionated engine improvements (tile-seam cost normalization, context steering, crowd separation, follower formations, and friendly yield-on-approach) are enabled by default. Opinionated changes to wild vanilla enemy tactics (VanillaEnemiesUsePackTokens, VanillaHumanoidsStrafeInCombat, VanillaEnemiesJumpLedges, VanillaEnemiesBreachWeakWalls, VanillaEnemiesUseSensoryEngine) default to false so vanilla enemies retain their familiar feel unless opted in via configuration or a downstream mod's AgentBehaviorProfile.
Developer Console Commands
vikingai debug [grid|flow|steering|tokens|affordances|senses|all|off]— Toggles real-time 3D GL and HUD telemetry overlays.vikingai stats— Prints live tracked piece and affordance counts fromPieceRegistry.
