Skip to content

Hostile Mob Intelligence Overhaul: Vision Cones, Stealth Mechanics, and Smart Navigation#414

Open
Malerus wants to merge 47 commits intoFoundation-19:masterfrom
Malerus:Smart-Mobs
Open

Hostile Mob Intelligence Overhaul: Vision Cones, Stealth Mechanics, and Smart Navigation#414
Malerus wants to merge 47 commits intoFoundation-19:masterfrom
Malerus:Smart-Mobs

Conversation

@Malerus
Copy link
Contributor

@Malerus Malerus commented Feb 13, 2026

About The Pull Request

This PR makes hostile mobs significantly smarter and more challenging through advanced AI systems.

Smart Mob Pursuit & Coordination

Multi-Level Combat:

  • Hostile mobs now chase you up and down stairs, ladders, and through open spaces
  • No more cheesing enemies by climbing a ladder - they'll follow you
  • Mobs remember you for 15 seconds after losing sight and actively search the area for 30 seconds
  • After climbing 3 times, mobs commit to their current floor for 10 seconds to prevent constant yo-yoing
  • If a mob takes 5+ consecutive stair steps, it's forced to stay on that level

Pack Tactics:

  • When a mob spots you or loses you, it calls for backup within 15 tiles (even across floors)
  • Idle allies immediately respond and converge on the alert location
  • Mobs can hear gunfire and combat sounds from 7 tiles away and investigate
  • Sound alerts give approximate locations (not exact) so mobs patrol the area naturally

Smarter Navigation:

  • Mobs can now open doors instead of always smashing them (configurable per mob type)
  • Only destroy walls when you're within 5 tiles and no door exists
  • Prioritize using hallways over breaking through walls

Environmental Detection Refinements

Line-of-Sight Filtering:

  • Thrown items only alert mobs that can see the item land (no cross-room detection)
  • Silenced light destruction requires line-of-sight to alert mobs
  • Unsilenced gunfire carries through walls (sound is not blocked by LOS)

Stealth Boy Interaction:

  • Mobs now physically turn around (visible setDir) when hearing cloaked players behind them
  • After turning, they check vision with stealth boy 20% range penalty applied
  • Turn-around behavior is visible to alert stealthed players they've been heard

Unsilenced Weapon Response:

  • When unsilenced weapons fire, mobs investigate the shooter's location directly
  • Creates natural "heard gunshot" behavior instead of investigating light destruction
  • No LOS check needed - sound carries through walls realistically

Investigation Movement:

  • Fixed mobs stopping 2-3 tiles away from investigation points
  • Mobs now properly complete full movement to thrown items and broken lights
  • Investigation state sets remembered_target to prevent premature LoseTarget() calls

Distraction Tools:

  • Bottle cap throw range increased from 2 to 7 tiles
  • Makes thrown distractions viable stealth tactic within detection range

Directional Vision & Stealth System

Field.Cones.Test.mp4

Cone-Based Vision:

  • Can be seen by entering Sneak Mode by pressing K by default
  • Mobs have a 90° vision cone in front - full detection range
  • 45° peripheral vision on each side - reduced detection (60% range)
  • Complete blind spot directly behind them - sneak up on enemies!
  • Vision effectiveness affected by lighting - darker areas reduce detection range

Sound Detection:

  • Mobs can hear your footsteps from behind even when they can't see you
  • Running is 2x louder than walking
  • Light armor makes you quieter (0.5x sound), heavy armor makes you louder (1.5x+)
  • Sound detection uses rear cones - sides are easier to hear (2.5x) than directly behind (3x)

Low-Light Vision:

  • Nocturnal and predator mobs see better in darkness
  • Nightkin, deathclaws, geckos, nightstalkers, wolves, radscorpions, cazadores, and yao guai all have enhanced dark vision
  • Get +2 to +4 bonus tiles of vision range in dark areas

Predictable Behavior:

  • Idle mobs now face the same direction for at least 45 seconds
  • No more rapid spinning - you can plan stealth approaches
  • Learn patrol patterns and time your sneaking

Combat Mode Standardization

Clear Combat Behaviors:

  • All 70+ f13 hostile mobs now have standardized combat modes
  • Melee mobs (deathclaws, ghouls, molerats): Rush you down aggressively
  • Ranged mobs (eyebots, gutsys, soldiers): Keep distance and shoot
  • Mixed mobs (reavers, fire geckos, assaultrons): Prefer ranged but will brawl

Gunfire Alerts:

  • Firing guns alerts hostile mobs within 7 tiles
  • Enemies rush toward gunfire to investigate
  • Suppressed combat is now tactically important

Bug Fixes

Ghost System:

  • Fixed bug where ghosts couldn't re-enter their corpse during revival
  • Better error messages when something goes wrong

Statpanel (Admin UI):

  • Statpanel no longer flickers when switching bodies
  • Admin tabs persist when using aghost or re-entering corpse
  • Only refreshes when verb list actually changes

Why It's Good For The Game

Dynamic Combat:

  • Vertical Threat: Players can no longer trivially escape combat by climbing stairs - multi-level facilities become genuinely dangerous
  • Pack Coordination: Elite enemy types feel threatening and intelligent through coordinated responses
  • Tactical Navigation: Enemies behave intelligently - searching for hidden players, responding to combat sounds, using doors

Stealth Gameplay:

  • Directional Awareness: Creates actual stealth mechanics with blind spots and vision cones
  • Sound Discipline: Armor choice and movement speed directly impact detection
  • Predictable Patterns: 45-second direction stability allows players to plan tactical approaches
  • Environmental Use: Darkness and lighting become meaningful tactical elements

Combat Depth:

  • Gunfire Consequences: Shots bring reinforcements - suppressed combat matters
  • Armor Tradeoffs: Light armor enables stealth, heavy armor increases detection
  • Position Matters: Player awareness and positioning directly impact survival
  • Emergent Gameplay: Smart mobs create dynamic, unpredictable combat moments

Quality of Life:

  • Standardized Behavior: Combat modes make 70+ mob variants consistent and predictable
  • Admin Reliability: Statpanel fixes prevent UI disruption during body switches
  • Ghost System: Ensures players can reliably re-enter corpses during revival

Pre-Merge Checklist

  • Tested on local server
  • No runtimes during testing
  • All changes documented

Changelog

🆑
add: Hostile mobs pursue players across Z-levels via stairs, ladders, and openspace
add: Mobs remember targets for 15 seconds and actively search for 30 seconds after losing sight
add: Pack coordination - mobs call for backup and respond to allies' alerts across Z-levels
add: Mobs hear combat sounds from 7 tiles away and investigate
add: Smart mobs open doors instead of destroying them when possible
add: Directional vision system - 90° front cone, 45° peripheral vision, rear blind spot
add: Rear sound detection - mobs hear footsteps behind them based on speed and armor weight
add: Low-light vision for nocturnal/predator mobs (nightkin, deathclaws, geckos, wolves, cazadores, etc.)
add: Idle mobs maintain facing direction for 45+ seconds for predictable stealth gameplay
add: Combat mode standardization across 70+ f13 hostile mobs (MELEE/RANGED/MIXED behaviors)
add: Gunfire alert system - shooting alerts hostile mobs within 7 tiles
add: Debug vision mode for testing stealth mechanics
add: Thrown items only alert mobs within line-of-sight (no cross-room alerts)
add: Silenced weapons require LOS for light destruction alerts
add: Mobs visibly turn around when hearing stealthed players behind them
add: Unsilenced weapons cause mobs to investigate shooter location (sound carries through walls)
add: Bottle cap throw range increased from 2 to 7 tiles for distraction tactics
fix: Mobs complete full movement to investigation points (no more stopping 2-3 tiles away)
fix: Investigation state properly sets remembered_target to prevent premature LoseTarget()
fix: Mobs no longer lose targets when players change Z-levels
fix: Multiple anti-loop systems prevent mobs getting stuck on stairs
fix: Mobs investigate sound areas naturally instead of X-raying to exact locations
fix: Ghosts can no longer be locked out of corpses during revival
fix: Statpanel no longer flickers when switching bodies
fix: Admin tabs persist through body switches
tweak: Z-level commitment system prevents yo-yo behavior
tweak: Light armor (0 slowdown) provides 0.5x sound multiplier for stealth
tweak: Heavy armor increases detection range from rear
balance: Sound detection baseline established - refinement per-mob-type needed
balance: Standardized retreat and engagement distances for all f13 hostile mobs
/:cl:

…GC stuff

Annoying Fast - 2.5
Fast - 2.75
Average - 3
Slow - 4
With Ghost Re-entry & Statpanel Stability Fixes
3. Combat Mode Standardization & Gunfire Alerts
- Standardized combat_mode across ALL f13 hostile mobs (16 files, 70+ variants)
- Three explicit modes: COMBAT_MODE_MELEE, COMBAT_MODE_RANGED, COMBAT_MODE_MIXED
- Defined retreat_distance and minimum_distance for all mob types
- Gunfire alert system: shooting alerts hostile mobs within 7 tiles
- Alerts respect can_hear_combat flag and faction relationships

Technical Implementation:
- Added combat_mode variable to all f13 hostile mob definitions
- Integrated gunfire alerts into shoot_live_shot() in gun.dm
- Added cached_verb_hash for efficient statpanel change detection
- Modified mob/Destroy() to preserve mind.current for valid ghosts
- Created attempt_z_pursuit(), climb_stairs(), and coordination procs
- Batch atom initialization: Check tick every 100 atoms
- Batch lighting updates: Process 100 lights/corners/objects per yield
- Batch icon smoothing: Process 100 icons before yielding
- Cache area lookup in turf initialization to avoid redundant loc calls
@Malerus Malerus changed the title Smart mobs follow you through z-levels Hostile Mob Intelligence Overhaul: Vision Cones, Stealth Mechanics, and Smart Navigation Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant