Purple Glow (Technical Breakdown)

A unreal engine game using mostly c++

Unrealc++Game

Purple Glow

10/10 naming, we know

Summary: Purple Glow, a captivating game in development using Unreal Engine and predominantly C++

This document delves into the technical aspects, highlighting key features and implementation details.

Key Features:

  • Movement
  • Weapons shooting
  • Ammo count
  • Weapon switching
  • Enemies
  • Pickups
  • Score system
  • Time system
  • Health system
  • Procedural tools

Player & Weapons

Alongside basic movement the player can crouch, sprint, slide and slide jump for more movement options. This is done by increasing the max speed when sprinting and when crouch button is pressed check the velocity of the player to see if it should slide or crouch. The weapons is in a different class to allow for different weapons. This works by referencing the guns in the player controller and changing the gun depending on the which weapon is selected The unique part of the weapon is that it uses both projectile to deal damage and line trace to get the centre of the screen no matter how close they are to an object. UI is set with getters in the c++ scripts and being called using blueprints in the widget class.

Procedural Tools

Started with Procedural Walls

  • Spawn cube depending on width, height and Length
  • Set material per cube
  • Add an offset on each cube

Procedural Room

  • Spawn a wall
  • Set the wall properties
  • Move each wall to specific location

Enemies

Turrets

The turrets have 4 states:

  • Search
  • Aim
  • Firing
  • Reloading

To find the player it uses a cone which overlaps objects. With a line trace to make sure the player is not behind a wall.

Score & Health System

Both health and score system are separate class but are connected to the main player controller.

Both use getters and setters that are public and blueprint callable to allow for the UI to show this info similar to the ammo count.

The score system also handles the timer which is done by using GetWorld()->GetTimeSeconds();

We made the score and timer be part of each other so the time can affect the score multiplier.

We used separate class for health system so could attach the same health script to other actors.

Doors

Doors can be set to open depending on different requirements;

  • Total target hit
  • Keys
  • If player is inside the trigger box
  • If the player press the interact button

This allowed for one code base for all the different door opening requirements and allows us to control level flow, forcing people to do certain task to proceeded.

The door interact is quite complex as the input is still handled in the player controller. It is done by adding itself to an array on the controller and when the interact button is pressed it loop through this array and call the CheckDoorInteraction() function which will open the door if the player is still in the trigger box.

Pickups - HP orbs and Keys

Pickup class start off with a class were each pickup inheriting from the base class.

The base class handles rotation of the object and setting everything up.

For each child class of the base class the OnOverlapBegin get overwritten by the new class to do different things like adding they keys to the player or increase health.

With the health it adds the health amount to the health system which is attached to the player controller.

With the keys it adding the keyID which is set per key to the player controller.