Smart Weapon
Concept
The idea here was to create a smart aiming system similar to the one found in the game Titanfall. I have always been facinated by that system, and I wanted to face the challenge of recreating this system from scratch. My goal was to approach the technical challenge in a modular way by using components to do most of the logic.
2024
Solo project
2 weeks

Key Feature - Smart Aiming Component
1. Targeting: Used a cone-based detector with structs for tracking targets.
2. Testing: Tested with basic shapes, verifying occlusion checks and dynamic splines.
3. Auto-aimed shots: Widgets mark targets, allowing player to fire auto aimed shots.
Technical Design Document
I started by creating a document that would describe the system and guide me through the process of working on it. I knew that some things might change during the development, but I wanted to have a clear direction.
I started by describing the system to have the requirements clear from the start. The core of the smart aiming system would be one actor component that is attached to the weapon, and another would be attached to any actors that should be targeted by the system.
Detection
The targeting system detects actors with the target component (smart targets) in front of the owner that are not occluded. A cone is generated to identify overlapping smart targets, with each detected actor represented by a runtime-created struct containing data such as the actor and time in view. This allows independent tracking of each target.
The system is highly modular, working with any actor. Initial tests involved a cube with a targeting component detecting spheres with the target component. Occlusion is checked via traces for each target overlapped by the cone. For visible targets within range, a dynamically curving spline is generated towards them.

Smart targeting component
Widgets and Automatic Firing
Targets are marked with widgets after being in view long enough, indicating that auto-targeting is ready. When enough widgets accumulate to match the target's health, based on current bullet damage, the widgets update to show that firing will deliver a lethal number of bullets.
The weapon system begins in the player controller, which signals the weapon system component on the player. This component determines the firing behavior based on whether the equipped weapon has a smart targeting component and if any widgets are placed on targets. If widgets are present, the system iterates through them, sending the weapon the location of each widget to fire toward. If not, weapon fires straight ahead.

Smart target component (in target)
Weapon component (in player)
Reflections
I really enjoyed this project, as it was a fun and rewarding challenge to tackle an existing mechanic and figure out how to implement it. The smart pistol in Titanfall is so smooth and polished that I often found myself fixating on the details, striving to replicate its feel rather than just its functionality. This focus on capturing the exact experience felt more pronounced compared to when I work on mechanics I've designed myself.
This project provided valuable insights into leveraging Unreal Engine components to create highly modular systems that function seamlessly across different actors. It was also my first in depth experience working with structs, where I created, modified, and iterated through arrays of them to build the system. This process significantly enhanced my understanding of managing and manipulating collections of data.
If I were to tackle a similar project again, I would create the technical design document alongside experimenting in the engine. In this project, I prepared the document before diving into the engine, which limited me to my knowledge at the time and constrained my approach. I believe I could have identified or developed solutions more quickly if I had allowed for more flexibility during the initial stages. That said, this experience taught me the value of thorough planning, even as I recognize the importance of incorporating early testing to inform and refine the document during its creation.