-
-
Notifications
You must be signed in to change notification settings - Fork 13
Artifical Intelligence
The core objective of opponent AI is maintaining player immersion through believable behaviors that avoid breaking the game's reality. Higher fidelity character models raise expectations; consider leveraging stylistic choices like perpetual hood shadows or masks to manage uncanny valley effects rather than attempting photorealism. Factions within the dungeon environment exhibit distinct dispositions towards each other and the player, creating dynamic interactions. These dispositions include Aggressive, Ignore, Avoid, Hunt, Friendly, Neutral, Hungry, Defender, Territorial, Flighty, Malevolent, Trapper, and more. Each faction's unique stance informs how they respond to threats and opportunities.
Core behavior states drive moment-to-moment actions:
- Idle: Resting, performing routine non-combat actions.
- Wandering: Patrolling designated areas or moving without specific threat awareness. Patrols should prioritize key room locations (e.g., "checking the library" or heading towards rest areas) to increase predictability.
- Alert/Investigating: Responding to stimuli like sounds, disturbances, or casualties. This includes searching last known player locations and nearby rooms. Searching persists for a tracked duration before giving up; enemies do not revert instantly to idle.
- Chasing: Actively pursuing a known target.
- Positioning - Flanking/Ambushing: Maneuvering tactically to gain advantage, using cover or concealment.
- Attacking: Executing offensive actions against a target.
- Fleeing: Attempting to escape imminent danger, potentially leading to regrouping or summoning reinforcements.
AI senses determine awareness and reaction triggers:
- Implemented Senses: Direct player line-of-sight, auditory detection of footsteps and object interactions, and touch/proximity.
- Potential Sensory Expansions: Tremorsense, echolocation, scent tracking, temperature detection, supernatural perception (Witchsight, Scrying), heartbeat sensing, and advanced scanning (Terahertz radar) offer avenues for unique enemy types and challenges.
AI Behaviors: Effectiveness and Versimilitude Every opponent or encounter incorporates deliberate balancing. Instantly lethal threats possess significant, telegraphed weaknesses or tells (e.g., loud noises, slow movement, high visibility for traps). While demanding player skill to overcome, the design strictly avoids "unfair deaths," particularly critical in a permadeath context. Some monstrosities function purely as environmental hazards – relentless hunters meant only for avoidance, not combat. Clear visual, auditory, or contextual cues must telegraph this role. AI entities maintain internal states, remembering recent events, conversations, and dynamically updating threat assessments (e.g., weighting probabilities for "enemies nearby," "target is the player," "player is formidable").
Combat AI prioritizes believable reactions over simplistic routines. Enemies under sustained fire should exhibit suppression effects: diving for cover, dropping weapons in panic, or fleeing entirely if overwhelmed. Squad-based enemies demonstrate teamwork: shoving comrades from grenade blasts, jumping through windows for escape, providing covering fire for wounded allies, and attempting medical rescues. Memory extends beyond immediate threats; discovering a body triggers lasting alert states, coordinated searches of the area, and consequences for failure (e.g., officer reprimands). Persistent consequences are key – enemies may swear vengeance for fallen comrades, potentially evolving into procedurally generated nemeses dedicated to hunting the player.
Health states significantly influence behavior. Reactions should visibly degrade from 100% to 0%: favoring wounded limbs, switching to secondary weapons, falling and becoming incapacitated rather than instantly dying. Wounded enemies might play dead or set ambushes in their final moments. Tactical intelligence includes flanking maneuvers, exploiting light/darkness (e.g., staying in shadow, reacting to thrown light sources like torches), using consumables (throwing grenades, feinting), employing area denial tactics, and barricading defensible positions. Some enemies exhibit caution, retreating if detected to regroup or set an ambush later. Environmental reactivity is crucial: enemies notice changes like moved furniture, altered door states, missing items, or new light sources. Predictability aids player strategy, but the AI should periodically adapt to dominant player tactics (e.g., setting noise traps for stealth players, improving cover/ambushes for aggressive players) to maintain challenge.
Damage type elicits specific reactions (fire vs. melee vs. projectile). Humanoid reaction times are modeled realistically: simple reactions ~200ms, complex decisions ~400ms, longer if distracted or aiming. Blocking paths (doors, chokepoints) is a valid player tactic; enemies can often open unbarred doors, but may break them down if blocked during pursuit. Specific entities react uniquely to environmental factors (e.g., fleeing pinklight lanterns). AI personalities derive from core motivations: goals, faction allegiances/enmities, and active plans, grounding them within the setting. Additional nuanced behaviors include choosing melee weapons based on context, sprinting for repositioning, reacting to sudden illumination ("get out of the light!"), setting deliberate ambushes, throwing light sources to disrupt the player, feigning death when incapacitated, and executing flanking maneuvers.
Enemy traits define capabilities and limitations:
- Can open doors (if possessing manipulators).
- May attempt to break down barred doors during pursuit.
- Prefer specific combat ranges.
- Exhibit light aversion/phobia.
- Utilize pack tactics.
- Capable of flanking.
- Use thrown consumables.
- Specialize in ambushes.
- Possess spellcasting abilities.
- Host parasites or hive connections.
- Manifest as spirits or incorporeal entities.
- Lack shadows.
- Employ invisibility.
- Spider climb, levitate, fly, or hover.
- Exhibit bloated physiology.
- Possess damage resistances (e.g., piercing resistance affecting backstab efficacy).
- Are deadened to pain.
Pathfinding ensures navigational realism, verifying accessible routes before movement (akin to Rain World's system). Enemies patrol logically around large rooms and towards significant objects, not just random adjacent tiles. Effective area and resource denial strategies force player adaptation. Pursuit generally follows OSR principles, continuing only within the bounds of the enemy's sensory range (sight, hearing, scent). Environmental interactions include stabbing through doors broken down by enemies, or using fog layers for concealment during sneaking.
AI Behaviors: For Horror Horror-centric behaviors are powerful tools best used sparingly to sustain impact and avoid predictability. Rare instances involve entities moving swiftly just beyond the player's clear vision or employing unsettling peeking behaviors around corners. Possession can manifest as enemies moving erratically like marionettes, slamming into objects. Extended player inactivity (e.g., ~45 seconds) might trigger entities on the same or adjacent levels to deliberately move towards their location. An "It Follows"-style relentless pursuer could rarely breach nominally safe areas for maximum dread. Unnerving enemy placement enhances atmosphere: cultists or undead found standing motionless behind doors, under tables, or within wardrobes. Spawning should avoid clichés; enemies rarely appear immediately after an item pickup, while conversely, heavily signposted dangers (like skeletal remains near an artifact) can foreshadow lethal traps or ambushes.
Sensory manipulation creates disorientation: encountering certain entities might trigger a simulated camera effect (low framerate, shutter sound, daguerreotype border, desaturation). Some threats require indirect observation, punishing direct line-of-sight by blanking the player's vision. Lost visual contact prompts enemies to systematically search nearby rooms with dedicated "look around" routines. The core horror principle remains: entities possess agency driven by discernible goals, alliances, enmities, and plans, making them integral, threatening parts of the world fabric.
Interaction typically initiates via proximity or a designated action ("Enter" key). Dialogue presentation requires further design iteration, considering options ranging from classic RPG conversation menus to text-parsing systems. Initial reactions are not universally hostile; OSR-style reaction rolls determine disposition (Friendly, Neutral, Hostile) upon first encounter for many humanoid NPCs like cultists, adding variability and roleplaying opportunities.
The game utilizes a custom-developed behavior tree system for structuring AI decision logic. Procedural level generation includes bespoke runtime navigation mesh (navmesh) creation to facilitate pathfinding across dynamically built environments.