Goal
To create a modular weapon system in Unreal Engine that supports multiple weapon types (guns, lasers, projectiles) while being flexible, designer-friendly, and performant. The system needed to allow easy switching between ammo types, reuse of objects via pooling, and data-driven customization.
System Overview
The system is built around an Object Factory + Pooling subsystem for ammo management, combined with Data Assets to define ammo properties. A Weapon Component acts as the core driver, handling weapon logic, switching modes, and firing behavior.
This setup allowed me to blend C++ power with Blueprint flexibility, giving both programmers and designers control over the system.
Architecture
At a high level:
Game Instance Subsystem: Provides the ammo factory & pooling system.
Weapon Component (UTP_WeaponComponent): Mediates weapon logic, firing, ammo switching, and delegates.
Projectile Classes: Base projectile in C++, extended into specialized types.
Laser Classes: Base laser in C++ with Blueprint-extended variants.
Ammo Data Assets: Define parameters like damage, visuals, and cost, making new ammo types possible without touching code.
Delegates & Events: Allow the system to broadcast ammo depletion, power usage, and switching to UI or other systems.
Component Breakdown
Object Factory / Pooling Subsystem
Creates and recycles ammo (projectiles/lasers).
Reduces runtime allocation cost.
Blueprint-callable for designers.
Weapon Component
Attachable to player or NPC.
Handles normal/charged ammo states.
Manages firing, cooldowns, and switching.
Exposes delegates (OnAmmoSwitch, OnPowerDepleted) for event-driven behavior.
What I Learned
Flexibility of C++ + Blueprint: How to design in C++ while still exposing extensibility in Blueprints.
Data Assets for Designer Freedom: Learned to decouple logic from data, giving designers control over balancing and ammo creation.
Delegates for Event-Driven Behavior: Implemented a clean event-driven workflow between gameplay systems, UI, and effects.
Scalable System Design: Learned to design with future expansion in mind (e.g., adding new ammo types, extending behavior).
Performance Awareness: Understood the impact of pooling on runtime performance.
Seamless switching between laser and projectile weapons.
Optimized performance with object pooling.
Designer-friendly pipeline through Data Assets and Blueprint exposure.
Demonstrated scalable design for adding new ammo types or weapons with minimal code changes.
Projectile System
Base projectile (C++) for common logic.
Derived projectiles (seeker, explosive, ice).
Uses pooling for reuse.
Laser System
Base laser (C++) for firing mechanics.
Variants extended in Blueprint (e.g., Plasma Beam).
Shares data-driven ammo definitions.
Data Assets
Ammo Definitions
Stores ammo stats and behaviors.
Enables rapid designer iteration.
Result
Key Takeaways
Factory + Pooling patterns integrate well with Unreal subsystems.
Data Assets are a powerful tool for data-driven game systems.
Delegates make systems highly modular and event-driven.
C++ + Blueprint hybrid design makes systems both extensible and designer-accessible.