Skip to content

CaioOlivieri/StalkerAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StalkerAI: A C++ Prototyping Sandbox for Dynamic Combat AI

About The Project

A development sandbox built in Unreal Engine 5 to architect, implement, and test advanced AI behaviors and core gameplay systems with a C++ first approach. StalkerAI was born from a single objective: to build a robust, reusable, and high-performance foundation for prototyping advanced combat AI in Unreal Engine 5. This project prioritizes a clean C++ architecture for core systems, using Blueprints for high-level logic and data integration. It serves as both a personal learning journey and a technical showcase of core game development principles.

This repository documents the step-by-step process of implementing key features, including:

  • A modular character controller using Unreal's Enhanced Input System.
  • A reusable Health, Damage, and Combat system built in C++.
  • A flexible blockout arena for rapid level design and gameplay testing.
  • Foundational AI behaviors designed for dynamic interaction.

StalkerAI Video Demonstration

🗺️ Full Project Roadmap


Technical Case Study: Forging a Stable Foundation

The initial development of this project provided one of the most valuable engineering challenges of my career, cementing the importance of a sound architectural foundation.

The Initial Challenge & Systemic Instability

The project began with an attempt to merge the Third-Person Template features into a Blank C++ project. This seemingly straightforward approach led to immediate and cascading build failures. After resolving an initial AIModule dependency error in the .Build.cs file, the project remained critically unstable. The core "phantom problem" was identified as intermittent compilation failures, often reporting false out of memory errors.

Deep-Dive Diagnosis & The Architectural Realization

A deep analysis of the full compiler logs revealed that the root cause was not in the project's code, but in a faulty Incredibuild integration that came bundled with the IDE. The unstable project state, caused by the improper template merge, was triggering bugs in this third-party tool, creating an unpredictable and unreliable development environment.

It became clear that continuing to apply point-fixes was inefficient. The foundation itself was compromised.

The Strategic Decision: A Full Reset for Long-Term Stability

Faced with this systemic failure, I made the strategic engineering decision to discard the patched-together project and restart with a clean Third-Person C++ template.

This decision was not a step back, but a crucial step forward. It was a deliberate choice to prioritize long-term project health over short-term progress, eliminating technical debt from day one. The goal was to build a foundation that was:

  • Solid: Free from unpredictable "phantom" errors and providing a stable, reliable development experience.
  • Scalable: Architected to easily accommodate new, complex systems (weapons, advanced AI, UI) without breaking the core.
  • Durable: Aligned with Unreal Engine's best practices, ensuring easier maintenance and future engine version migrations.

Development Roadmap

Milestone 1: Core Systems & Player Foundation

  • Objective: To establish a stable project architecture and implement a fully controllable player character with a professional-grade locomotion system.
  • Tasks:
    • Project Setup: Establish a stable C++ project, a clean development environment, and a professional version control workflow with Git & Git LFS.
    • Arena Blockout: Create a functional level blockout to serve as a testbed for all gameplay mechanics.
    • C++ Character Architecture: Architect and create a shared C++ base class (SltakerAICharacter) and a dedicated child class for the player (StalkerAIPlayerCharacter).
    • Player Controller Implementation: Implement camera controls and basic Enhanced Input bindings in C++.
    • Animation Integration:
      • Data Layer: Implement the Event Graph logic to provide the Anim Graph with real-time data (GroundSpeed, Direction, bIsInAir).
      • Blend Space: Create a 2D Blend Space for fluid, 360-degree movement, blending Idle, Walk, Run, and Strafe animations.
      • State Machine: Build a robust State Machine with dedicated states for Start/Stop transitions (to add weight) and a full Jump/Fall cycle (Start, Loop, End states).
    • Health & Damage System: Develop a reusable C++ HealthComponent and attach it to the base character class.

Milestone 2: Combat Mechanics Prototype

  • Objective: To implement a functional combat loop, allowing for interaction between characters through damage.
  • Tasks:
    • Weapon System: Implement a foundational C++ weapon system (hitscan or projectile based).
    • Core Combat Loop: Add logic for shooting, reloading, and ammo management.
    • Animation Layering (Combat): Expand the Animation Blueprint with an Upper Body Slot to allow for aiming and shooting animations to play concurrently with lower-body locomotion.
    • Target Dummy: Create a simple AI target dummy that utilizes the HealthComponent to receive damage and be destroyed.

Milestone 3: Advanced Player Traversal (Parkour)

  • Objective: To give the player a rich, acrobatic moveset for navigating the environment.
  • Tasks:
    • Fall Roll System: Implement a roll to negate/reduce fall damage based on landing velocity, driven by a Root Motion animation.
    • Obstacle Vaulting System: Develop a system using C++ line/sphere traces to detect and vault over low obstacles.
    • Ledge Climbing/Mantle System: Implement logic for detecting and climbing up ledges.
    • Animation Integration (Parkour): Expand the State Machine with new states and logic to handle all new traversal animations.

Milestone 4: AI Implementation (Enemies & Ally)

  • Objective: To bring the non-player characters to life with distinct, appropriate AI architectures.
  • Tasks:
    • Common Enemy AI:
      • Configure an AIController and a Behavior Tree for standard combat behavior.
      • Implement tactical repositioning logic (seeking cover) using custom BT Tasks.
    • Ally AI:
      • Implement foundational support behaviors (follow, engage targets) using a Behavior Tree.
      • Develop a data-driven Utility System as a custom BT Service to allow the ally to make intelligent support decisions.

Milestone 5: The "Acrobatic Stalker" (Boss AI)

  • Objective: To build the signature "Boss" enemy, leveraging a high-performance, animation-driven architecture for complex pursuit.
  • Tasks:
    • Advanced Traversal Implementation (Player): Implement wall running and wall jumping mechanics for the Player to establish the system.
    • Boss AI Architecture: Re-architect the animation logic for the Boss using Unreal's modern State Tree system for maximum performance and fluid transitions.
    • AI Parkour Navigation: Use NavLinkProxies and custom State Tree Tasks to teach the Boss AI to use all parkour mechanics for aggressive pursuit.

Milestone 6: Advanced Interaction & Game Loop

  • Objective: To implement the final core mechanics and a basic UI, creating a complete gameplay loop.
  • Tasks:
    • Player "Downed" State: Develop the mechanic where the player enters a downed state at zero health.
    • Ally Support Systems: Implement the ally's ability to provide ammo, heal, and revive the player.
    • UI/HUD: Create a basic user interface with UMG to display essential information (health, ammo, ally status).

Current Features

  • Character Controller: Fully functional third-person character movement based on Unreal's Enhanced Input System.
  • Stable Project Base: A clean and robust C++ architecture ready for feature development.
  • Development Arena: A simple blockout level for gameplay testing and iteration.

Built With

  • Unreal Engine 5
  • C++
  • Blueprints
  • Visual Studio 2022
  • Git & Git LFS

About

An Unreal Engine 5 C++ sandbox for prototyping and testing third-person shooter mechanics and dynamic AI behaviors.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors