Wing Commander Like Prototype

Unreal Engine 5.6 | Blueprint | Solo Project (In Progress)

Overview

A 6DOF (6 Degrees of Freedom) space combat game inspired by Wing Commander, featuring:

  • Physics-based flight
  • Component based architecture (ECS)
  • Projectile pooling for performance
  • Target lock-on with lead indicators (in progress)
  • Mouse based flight controls
  • Utilizing Data Assets for inputs of various ship type and weapon specifications

Technical Highlights

Flight

  • A custom built physics-based movement with intertial damping
  • Camera-relative mouse controls with input curves
  • Angular and linear velocity management

Weapons

  • Object pooling for projectiles
  • Energy based primary weapons with lock-on homing missile secondary weapon
  • Predictive aiming with intercept calculations (in progress)
  • Damage interface for modular target types (in progress)

Targeting System

  • Screen space reticle detection
  • Lock on states for secondary weapon
  • Grace period for stable lock acquisition
  • Lead indicator for moving targets

Misc

  • Utilizing Data Assets for inputs on similar type actors (eg. Different ship types)

What I’ve Learned So Far

  • Physics simulation and impulse calculations
  • Vector math for 3D space calculations

Blueprint and Architecture Overview

Entity Component System (ECS) Architecture

ECS is an architectural pattern that consists of entities (components in Unreal) instead of having the typical parent/child relationships. This allows for any Actor to have only the required functionality of the given components attached, ensuring only the systems required for any particular functionality exist within the actor. This helps prevent a long tree of child actors from a parent by treaing relationships based on the components, instead of hard coded object references.

For example, a ship will have the BPC_FlightComponent for flight controls, BPC_WeaponComponent for weapon functionality and/or BPC_TargetComponent for the ability to lock onto a target. However, if I wanted a space station to only be able to shoot, but doesn’t require any movement I can just create an Actor, attach the BPC_WeaponComonent and if needed, the BPC_TargetComponent and that actor will be able to fire weapons. It will not be able to move though like a ship can, will not be tied to a ‘Ship’ like parent or have functionality that it does not require.

Object Pooling

Instead of spawning and destroying each projectile every time the player shoots, which is not performant, all primary and secondary weapons for the player and enemies will be created at level creation, disabled, and will activated when needed. Once the projectile has hit something or reached its time limit, it will return to the pool.

When getting a needed projectile, the Weapon Component simply draws from the pool, moves the projectile to the location on the ship the shot is coming from and initializes the projectile.

Data Assets

Instead of having multiple actors with identical structure, such as different player ship types or enemies, I utilize Data Assets to contain all the relevant information pertaining to each particular ship type. Information such as speed, acceleration, pitch/yaw/roll rates, damping factors (how quickly the ship reaches its target speed or how it responds to turning inputs) as well as it’s static mesh. Different weapon types as well have their own Data Assets to describe items such as the damage they do, projectile speed, lifetime of the projectile and fire rate.

HUD/UI (WIP)