This project uses the First Person Shooter template using Unreal Engine 5.6 and native C++ to create a dynamic, interactive shooting game. Colored, damageable boxes are fetched from online JSON data and spawned into the world. Each box has its own color, health, and score value. Shooting and destroying these boxes adds points to a live HUD display.
Video Link: Project Demonstration
-
Boxes are defined by online JSON data (link).
-
Custom structs (FBoxType, FBoxObject, FBoxTransform) parse type and transform.
-
BoxDataFetcher handles HTTP GET + JSON deserialization.
-
BoxManager spawns each box as an ABoxActor with custom material and transform.
-
Each ABoxActor has a custom dynamic material set in C++ using the JSON color field.
-
When shot, box health decreases; on death, the player is awarded points.
- Integrated with the existing shooter system:
- Projectile hits call ApplyDamage() on BoxActor.
- Health is reduced; box is destroyed when Health <= 0.
-
ShooterBulletCounterUI extended to include live score display.
-
FPSBoxShooterPlayerController manages score and passes it to the HUD via UpdateScore().
-
HUD updates in real-time when boxes are destroyed.
-
Launch the project in UE 5.6.
-
Play in Standalone or Selected Viewport mode.
-
You’ll see multiple colored boxes in the world (spawned from JSON).
-
Pickup the weapon from the ground.
-
Shoot boxes using your weapon:
- Box takes damage per shot.
- When destroyed, a score is awarded.
-
You'll will see that the score updates live in the bottom-right corner UI.
Resolved by ensuring BP_ShooterPlayerController is correctly parented to AFPSBoxShooterPlayerController.
Ensured material instance is created from base material in C++, not from editor assignment.
-
Caused by Blueprint UI class reference being lost during reparenting.
-
Fixed by re-exposing BulletCounterUIClass and assigning it in Blueprint.
Carefully ensured UGameplayStatics::ApplyDamage() properly reaches BoxActor.
| File | Description |
|---|---|
BoxActor.cpp/.h |
Represents each box, handles color, health, score |
BoxDataFetcher.cpp/.h |
Fetches and parses JSON from URL |
BoxManager.cpp/.h |
Spawns boxes from parsed data |
BoxDataTypes.h |
Defines JSON struct types |
| File | Description |
|---|---|
ShooterCharacter.cpp/.h |
Handles firing, weapon switching |
ShooterWeapon.cpp/.h |
Fires projectiles, manages cooldown |
ShooterProjectile.cpp/.h |
Detects collision and applies damage |
FPSBoxShooterPlayerController.cpp/.h |
Adds score, manages HUD widget |
| File | Description |
|---|---|
ShooterBulletCounterUI.cpp/.h |
UUserWidget class (C++) |
BP_ShooterBulletCounterUI |
Blueprint widget showing ammo + score |
BP_ShooterPlayerController |
Blueprint inheriting from FPSBoxShooterPlayerController |