Back to selected work

A Chain of Pain

An Unreal Engine 5 / C++ narrative game in development. The current playable slice focuses on first-person stealth and exploration, with a custom Hunter that combines perception, memory, search and environment interaction.

Status
In development · playable stealth / AI prototype
Role
Solo-directed, AI-assisted development using licensed environment assets.
Architecture
AI Perception → knowledge / memory → C++-generated StateTree → movement, doors and gameplay events.

A narrative game, a playable AI slice

A Chain of Pain is a first-person narrative game in development. Its current playable work is a stealth and enemy-AI prototype in a hospital environment. Dialogue, objectives, story triggers, branching outcomes and endings are not implemented yet.

The project brings game design, system design, architecture, integration, level composition and playtesting under one technical direction. Documented fairness rules and acceptance criteria guide what the Hunter should know and how it should respond.

The current playable focus

The current playable slice is a first-person stealth prototype in a hospital environment. Sneaking, crouching, running and a limited panic sprint offer different ways to explore and escape. Movement, noise, door use and the flashlight affect what the Hunter can perceive.

The Hunter can stop to listen, investigate stronger evidence, chase and search. Its hearing uses navigable NavMesh path distance rather than only straight-line distance, so walls, floors and route geometry affect whether sound is faint or clear. After losing sight, it searches from the last verified position, movement direction and newer sound evidence rather than continuously tracking the hidden player.

Environmental interactions use a shared door system for the player and Hunter. Wounds and a critical state create pressure; capture and death lead to retry. Adaptive music responds to the enemy’s state as exploration becomes danger or pursuit.

Systemic enemy AI

The H1 Hunter is a custom C++ enemy built on Unreal AI Perception and StateTree. The controller manages the brain, while the character handles movement and physical actions. A dedicated knowledge component processes perception, detection, memory and search information; behaviour tasks read that component rather than hidden live player state.

Custom C++ tasks and conditions form a StateTree generated and compiled from code. This keeps the behaviour graph reproducible and separates information gathering from decisions and world interaction.

Hunter architecture

  1. PerceptionSight, sound and flashlight clues; sight is rechecked each frame.
  2. Knowledge / memoryDetection meter, verified positions, alert level and search evidence.
  3. State selectionStateTree picks the highest-priority eligible behaviour.
  4. BehaviourCustom C++ tasks investigate, pursue, search and patrol.
  5. World interactionNavigation, unlocked doors, capture and gameplay events.
Information passes through the knowledge layer before behaviour acts. Detection is a continuous perception process, not a separate behaviour state.

Hearing the route, not just the radius

Sound is evaluated using the length of a complete, navigable NavMesh path. Loudness changes the accepted range. A nearby source across a wall or on another floor can therefore be quiet to the Hunter if the route is long. This is a gameplay hearing filter based on route geometry, rather than a physical acoustic simulation.

A faint noise makes the Hunter stop, face the sound and listen. A clear noise—or a second faint noise that confirms the first within a short window—creates an investigation location. Player gait changes footstep loudness, and doors report their own noise.

Gradual visual detection

Detection accumulates in a meter instead of treating visibility as a simple on/off switch. Its fill rate responds to distance, view angle, gait or posture, movement and flashlight use. It decays out of sight, with immediate detection at very close range. Suspicion can start an investigation before a confirmed target triggers pursuit.

The flashlight is a stealth trade-off: it affects sight range and detection, and a visible beam or illuminated spot can become a clue. The debug overlay exposes the sight factors so the response can be inspected and tuned.

Behaviour selected by priority

The StateTree selects the first eligible state in this priority order. It reselects when knowledge changes or a task completes; these are competing behaviours, not sequential gameplay steps. Capture and stun also have event-driven overrides. Alert level is a separate knowledge value.

StateTree / highest eligible priority first

  1. CaptureCapture is active. It holds until the death flow reloads the level.
  2. StunnedStun is active; recovery starts a search.Debug-triggered support only; no in-game stun source is established.
  3. ChaseA confirmed target exists; fresh perceived noise can guide pursuit out of sight.
  4. InvestigateA suspicious sight, clear or confirmed noise, or flashlight clue has a location.
  5. SearchThe target was lost; search uses retained evidence.
  6. ListenA faint sound has a location but is not yet confirmed.
  7. AlertRoamThe Hunter remains alerted without a target.
  8. RoamFallback patrol when no higher-priority condition is eligible.
There is no Detect state. A filled detection meter makes Chase eligible; a new sound can redirect Search into Investigate.

Player, world and Hunter

The AI is integrated with the playable environment. A short, bounded charge on a new engagement has a cooldown. Capture requires reach, verified line of sight and a short navigable path; the territory and leash bound pursuit. The Hunter opens closed, unlocked doors on its route and respects locks.

Connected gameplay systems

  • Player movementSneak, crouch and run affect visibility and noise. A limited panic sprint supports escape.
  • Interaction / doorsA reusable look-at interface and shared door class serve the player, AI and encounters.
  • Perception inputsSurface- and gait-aware footsteps, door noise and the flashlight feed the Hunter.
  • Wounds / retryWounds recover in stages, with a critical state. Capture and death lead to a retry flow.
  • Reactive audioMusic changes between exploration, danger, chase and death in response to the Hunter.
Player actions change the environment and perception evidence; Hunter behaviour feeds back into player pressure and audio.

A world composed around the systems

A large single One File Per Actor map contains a manor and two hospital buildings, composed from third-party modular environment kits. The current Hunter territory is the H2 hospital. Multi-floor navigation, barriers, locked routes and door assets converted to the project’s shared door class connect the space to the AI.

One scripted Door-14 ambush temporarily directs the Hunter outside normal StateTree behaviour, then hands control back to the systemic chase. The surrounding world is broader than this tested slice: multi-floor navigation setup is evidenced, but stair chases still need dedicated playtesting.

Engineering and iteration

Milestone development uses Git, Git LFS and One File Per Actor. Reusable components separate perception, character actions, interaction, wounds and audio. AI tuning lives in a data asset read during play, making iteration possible without scattering constants through behaviour code.

  • Console test commands, visual markers and overlays expose detection, hearing decisions, remembered locations and search destinations.
  • Python tooling supports scripted PIE regression checks and exports level geometry into scaled floor plans.
  • Design rules, acceptance criteria and small milestones keep implementation and review focused.

Prototype work and next steps

A smaller Hunter nail-gun prototype uses physical projectiles, line-of-sight-gated firing, projectile embedding and a live projectile cap. Its aim presentation is placeholder-level, with audiovisual polish still incomplete.

The current engineering evidence centres on one Hunter and its stealth loop. Narrative expansion remains future work. Real media will make the perception, search and environment integration easier to assess alongside the recorded development evidence.

Gameplay, AI debug views and deeper technical implementation details are available on request.

Verification record

  • Recorded development runs include a 12/12 scripted AI regression pass on 17 September 2026. This is saved project evidence, not a new Unreal test run during this portfolio update.
  • Scripted PIE checks exercise perception, pursuit, memory and capture. Console commands, overlays and world markers support focused playtesting and diagnosis.

Documentation status

Forthcoming evidence

  • Real gameplay and debug captures are planned; the concept graphic is not a gameplay screenshot.
  • A public build or source link has not been supplied.

Source material

This presentation is grounded in the following project material.

  • Project C++ systems, milestone history and recorded in-editor regression evidence; reviewed 3 October 2026.
Explore the restReturn to selected projects