This prototype was built with Unreal Engine 5 using C++ and Blueprints, following the Unreal Engine 5: The Ultimate Game Developer Course as a structural foundation. It covers a broad range of core gameplay systems: a third-person player character, melee combat, enemy AI, collectible items, destructible props, and a HUD overlay. The player must fight enemies, collect souls from defeated foes, and gather gold from breakable pots scattered across an open world landscape.
The Character System is built around an abstract ABaseCharacter class shared by the player and all enemies:
- Directional hit reactions (Front / Back / Left / Right) computed via dot and cross product against the attacker’s position
- Randomized death montage selection mapped to
EDeathPose UAttributeComponentmanaging Health, MaxHealth, Stamina, MaxStamina, Gold count, and Soul count
The Player Character handles all input and gameplay state through two enums — ECharacterState and EActionState — that gate every action:
- Third-person movement with spring arm camera, oriented to movement direction
- Dodge with stamina consumption and full invincibility frames during the montage
- Equip / Unequip montage flow with socket swapping between
WeaponSocketandSpineSocket - Passive health and stamina recovery while unoccupied
The Weapon System uses a box trace swept between two scene components (WeaponBoxTraceStart → WeaponBoxTraceEnd) driven by AnimNotify during attack montages:
- Per-swing actor deduplication via
ActorsToIgnoreInBoxTraceto prevent multi-hit on the same target - Enemy-vs-enemy friendly fire prevention
- Blueprint
CreateFieldsevent for Chaos field system destruction effects at the impact point - One-handed and two-handed weapon types via
EWeaponType
The Enemy AI runs a hand-coded state machine — Patrolling → Chasing → Attacking → Engaging → Dead — driven from Tick without a Behavior Tree:
PawnSensingComponentfor line-of-sight player detection- Two configurable patrol modes per instance: Loop and Back-and-Forth
MotionWarpingComponentfor translation and rotation warping toward the combat target during attacks- Spawns a weapon on
BeginPlayand drops a soul above its location on death
The Item System provides a base AItem class with sine-wave hover animation and sphere overlap detection, subclassed by three types:
- Soul: drifts upward after spawn; target hover height is determined by a downward line trace against world geometry
- Treasure: spawned from breakable actors on break; adds gold to the player’s attribute component on pickup
- Niagara pickup effects and spatial audio on collection for both types
The Breakable Actors use UGeometryCollectionComponent (Chaos) for physical destruction, triggered via IHitInterface dispatch from the weapon box trace:
- Single-hit guard (
bBroken) prevents double processing on the same frame - Spawns a random treasure from a configurable pool at break time
The HUD is owned by APlayerHUD, which creates the UPlayerOverlay widget on BeginPlay and adds it to the viewport:
- Overlay displays Health bar, Stamina bar, Gold count, and Soul count — updated every frame from
UAttributeComponent - Enemy health bars use a world-space
UHealthBarComponent, visible only while the enemy is aware of the player
Leave a comment