Unreal Engine C++ Blueprints
A solo-developed dark fantasy action RPG built in Unreal Engine 5, exploring the research question: "How could quantum computing change video game mechanics in role-playing games?"
All core systems were designed and implemented from scratch: combat, AI, inventory, equip, dialogue, target lock, and a dual skill tree including a set of quantum-inspired abilities derived from real quantum mechanics principles.
βΆ Click to watch the gameplay demo on YouTube
The project investigates whether quantum mechanics principles (superposition, entanglement, inversion, orbital force) can be translated into viable, fun gameplay systems for an action RPG β without requiring real quantum hardware.
Each quantum ability in the game is derived from a real quantum concept, reinterpreted as a mechanic that changes how the player interacts with the world. The design framework produced serves as a forward-looking reference for the intersection of quantum computing and game design.
Fast-paced, no-block, parry-based encounters built around player aggression and high-risk decision making. The player is rewarded for attacking and punished for passive play.
- 4-hit light attack combo chain driven by an AttackIndex integer (0-4) routed through a Switch on Int node. After the 4th hit, a combo finisher triggers automatically
- Combo continuation managed via a SaveAttack boolean β input during an active attack queues the next in chain
- Player can be hit mid-combo β no invincibility frames during attacks
- Player can dodge mid-combo at any point in the chain
- Hit detection uses a looping Sphere Trace By Channel (radius 120 units, Visibility channel) running every 0.001s between SwordTopPoint and SwordBottomPoint bones. Valid targets are filtered by the Actor Tag "Damageable". On confirmed hit, ApplyDamage is called (base damage 200) and a particle emitter spawns at impact
- Target Lock fires a Sphere Trace For Objects (radius 200, range 1500 units) from the camera forward vector, filtering for PhysicsBody and Pawn types, validated by "Damageable" tag. Toggle input clears the lock
| Tree | Gate | Description |
|---|---|---|
| Knight Abilities | Boss kills | Combat and traversal abilities unlocked by defeating bosses |
| The Power of the Gods | Exploration | Quantum-inspired abilities unlocked by discovering locations |
The two trees are designed to reward different play styles β aggression versus curiosity.
Each ability is derived from a real quantum mechanics principle and translated into a gameplay mechanic:
| Ability | Quantum Concept | Gameplay Effect |
|---|---|---|
| Master of Matters | Matter-wave duality | Control over physical objects in the environment |
| Instability | Quantum decoherence | Creates unpredictable, randomised enemy behaviour |
| Inversion | NOT gate / time reversal | Reverses an action or effect that has already occurred |
| Elliptical Force | Orbital mechanics | Applies orbital force to enemies or objects |
| Double Superposition | Quantum superposition | Player exists in two states simultaneously |
Two distinct enemy types, each driven by a custom Behaviour Tree:
Patrol β Investigate (on sound) β Chase β Attack
- Patrols to random points within 3000 unit radius, waits 2 seconds at each point
- Investigates last known player position on hearing detection, waits 9 seconds before resuming patrol
- Chases player (BT_Task_ChaseTarget), stops at 100 units
- Attacks when within 250 units (BT_Task_AttackTarget)
- BT_Service_GetDistanceToTarget ticks every 0.40-0.60 seconds to update inMeleeAttackRange
Patrol / Combat (Chase + Attack simultaneously via Simple Parallel)
- No investigation state: player detection triggers immediate combat
- Simple Parallel node chases and attacks at the same time
- Max health: 350, tracked via dedicated WB_Werewolf_H widget
- Wider aggro radius than standard enemy
- Single powerful attack replaces the standard attack set
| Area | Description |
|---|---|
| Tutorial β Centralis | Introduces combat, parry system, and core movement |
| The Woods | First open area with standard enemies and environmental storytelling |
| Misty Lands | Mid-game area introducing ranged enemy types |
| Frozen Mountains | Final area with boss encounters and full quantum ability access |
- Slot-based inventory backed by a Data Table using S_Slots and S_Items structs
- Item rows store: Name, Damage, Icon, StaticMesh, Type, WeaponSocket
- Equipping calls Get Data Table Row, breaks S_Items, and swaps the StaticMesh on the weapon socket
- Supports Sword and Bow equip slots
- Critical bug fix: equipment state persistence across level loads was resolved by rethinking state ownership at level load using Game Instance rather than per-actor variables
| Element | Description |
|---|---|
| Player health bar | Displayed as moon phases integrated into the player's armour |
| Enemy health bar | Shared across standard enemies and player via character type selector |
| Mini-Boss health bar | Dedicated widget (WB_Werewolf_H), activated on aggro |
| Inventory screen | Slot-based UMG widget |
| Dialogue box | Linear NPC conversations with speaker name display |
moon-knight-ue5-rpg/
βββ Source/
β βββ MoonKnightRPG/
β βββ MoonKnightRPG.Build.cs # Module dependencies (AIModule, EnhancedInput, ...)
β βββ MoonKnightRPG.h/.cpp # Primary game module β shared enums & design constants
β βββ MKPlayerCharacter.h/.cpp # Player: health, combo state machine, death/respawn
β βββ MKEnemyAIController.h/.cpp# Enemy AI: perception config, Blackboard writes
β βββ MKGameInstance.h/.cpp # Persistent state: Willow Tree checkpoints, equip
βββ assets/
β βββ ...
βββ README.md
The full UE5 project (Blueprints, maps, assets) is not hosted on GitHub due to binary file size constraints. This repository documents the systems architecture, C++ foundations, and all tuning values extracted directly from the Blueprint implementation.
Blueprint vs C++ split:
| System | Implementation |
|---|---|
| Combat combo chain, sword trace, ApplyDamage | Blueprint (BPC_Attack System) |
| Enemy Behaviour Trees, Blackboard, patrol tasks | Blueprint (BD_AI, BD_Werewolf) |
| AI perception, detection, sight stimulus | C++ (AMKEnemyAIController) |
| Inventory Data Table, equip socket swap | Blueprint (BPC_Equipment System) |
| Player systems: health, combo state, death | C++ (AMKPlayerCharacter) |
| Enemy AI controller base | C++ (AMKEnemyAIController) |
| Game Instance: checkpoints, equip persistence | C++ (UMKGameInstance) |
Systems logic (health, combat state, AI perception, persistent state) lives in
C++, where it is testable, diffable, and fast. Visual and timing work
(animation montages, the death fade timeline, UI, Behaviour Tree assets) stays
in Blueprint, where iteration takes seconds rather than compile cycles.
Blueprints reparent to the C++ classes and call down into BlueprintCallable
functions, while C++calls up through++ BlueprintImplementableEvent++s when
something visual needs to happen. In short: C++ decides when, Blueprint
decides what it looks like.
All design constants (death fade 5.0s, respawn at 4.9s, perception radii) live
in the MoonKnightConstants namespace in MoonKnightRPG.h, each traceable to
the GDD. Shared enums such as ECombatState and EWeaponType are defined once
and included wherever needed, avoiding magic numbers and duplicate types.
Incoming damage uses the built-in TakeDamage override rather than a custom
path. Any damage source (sword trace, future ranged enemies, environmental
hazards) funnels through one function, where parry negation and death handling
live.
The AI controller configures sight and hearing in C++ and translates stimuli
into Blackboard values (TargetActor, InvestigateLocation). The Behaviour
Tree assets read those keys and own all decision-making, keeping enemy
behaviour designer-editable without touching code.
The player character is destroyed and respawned; levels load and unload. Anything that must survive those events, such as the last Willow Tree checkpoint and the equipped weapon, belongs to the Game Instance, which exists exactly once per session. This is also the fix for the equipment persistence bug documented above.
To use this code in the full UE5 project:
- Drop
Source/into the project root and compile. - Set
MKGameInstanceas the Game Instance class in Project Settings > Maps & Modes. - Reparent the player and enemy controller Blueprints to
AMKPlayerCharacterandAMKEnemyAIController. - Assign the Behaviour Tree asset on the enemy controller Blueprint.
- Ensure the Blackboard has keys named
TargetActor(Object) andInvestigateLocation(Vector).
| Engine | Unreal Engine 5 |
| Scripting | Blueprint Visual Scripting |
| Code | C++ (base classes, components, game instance) |
| UI | UMG (Unreal Motion Graphics) |
| AI | Behaviour Trees, UE5 Perception System |
| Input | Enhanced Input System |
| Animation | Animation Montages, Animation Notify system |
This project requires Unreal Engine 5 installed via the Epic Games Launcher.
# Clone the repository
git clone https://github.com/alvarogope/Moon-Knight-UE5-RPG.git
# Open the .uproject file in Unreal Engine 5
# Right-click the .uproject β Generate Visual Studio project files
# Build and run from the UE5 editorNote: large asset files (meshes, textures, animations) are not included in this repository. The Source folder and README document the systems architecture independently.
Full project breakdown, GDD, and design documentation available at: alvarogomezgamedesign.wordpress.com/moon-knight





