Scalable Weapon System

Solo project | Oct 2023 | Unreal Engine 5

This is a mini-project to help get back into Unreal. My goal is to create a scalable weapon system utilising Primary Data Assets, with the hope of expanding the project by implementing it into a small shoot ’em up game, themed around clowns.

The game idea that the weapon system will be designed around:

Wave based shooter themed around clowns, every so often a quest-giver clown rewards player with a new weapon. Each clown enemy is designed to be weak against a particular type of weapon.

Stretch: When all weapons have been collected, the quest-giver clown becomes the big boss and the player needs to use the logic they learnt with enemies being weak to particular weapons to defeat the big clown boss.

Systems Design

Key Software and Skills utilised:

  • Unreal Engine 5: Blueprints
The Primary Data Asset Class, defining the core data for the weapon.
Data Asset deriving from BP_WeaponData, I have set placeholder values as well a placeholder model for now.

To achieve my goal of creating a scalable weapon system, I decided to use Data Assets. This will allow me to add as many different weapons I want at will, and will still retain functionality with the rest of the weapons system.

In time I want to add additional variables to the Data Asset Class, such as bullet speed, spread type, potentially even an elemental type, but for now my focus is on setting up the foundations of the system.

BP_WeaponMasterPickUp is what triggers the rest of the system, it is a general PickUp blueprint, to be used by all the weapons stored as Data Assets. This is where you can pick out which weapon from the BP_WeaponData Data Assets you want the player to pickup. It updates it’s static mesh on construction, and activates the Add Weapon function when collision is overlapping with the player, adding the Data Asset to a Weapon Inventory array.

The Weapon Inventory array, in conjunction to the player scroll input, is what is being used by the weapon switching system to dictate which weapon is currently equipped. Because this identifies which data is currently being used from the array, we can use this to update various piece of data to match the currently equipped weapon.

This section of blueprints handles shooting. There are a couple of branches right after the Left Mouse Button event, this is to ensure there is a weapon inside of the array before any shooting can occur, and CanFire is tied into the cooldown of the bullet. Before a bullet is fired, it checks to see if the equipped weapon uses hitscan or projectile based weapons based on the attached Data Asset. After the bullet has been fired, this system goes into a fire cooldown until it can be activated once again.

Current state of the system.

So far, the system is capable of:

  • Creating any number of different weapons, will work with the rest of the system.
  • Can pick up any number of weapons and still be able to seamlessly switch between them.
  • Updates the static mesh on the held weapon and BP_WeaponMasterPickUp according the the attached Data Asset.
  • Can fire based on whether the weapon is Hitscan or Projectile based.
  • Cooldown does effect how often a bullet is fired.

The future plans:

  • Implement bullet speed.
  • Add a rapid fire variable for automatic weapon function
  • Capability of spread patterns.
  • Create a new Data Asset class for unique bullet types