Modular Weapon System Design

Hi,

There isn’t a place I’ve found with all different approaches in one place for creating a weapon system. Regarding guns and attachments and logic. Granted all are made different to suit the game you’re making but the framework and design would be similar.

The weapon and attachments systems are very similar in functionality between Battlefield and COD, defined loadout pre-game, but both I’m sure would do it differently if it were in UE.

In the FPS Template, picking up a weapon adds a weapon component to the player as well as the skeletal mesh. In this FPS Game Starter Kit | Fab, the weapon BP seems to be a persistent BP in the world which the player BP references once picked up. Neither of these deals with attachment’s though. Neither do the majority of YT tutorials.

So If you had a weapon that could have a variety of different attachments with differing stats and meshes, how would you design that modular system? It’s not a subject I can find much on and can be potentially complex.

(Attachments being defined as stocks, sights, barrels etc…)

Thanks in advance and enjoy.

Hello there @VAND00M!

Checking with my peers, this is indeed a quite daunting task, with multiple possible approaches. You should definitely avoid approaching a weapon as a massive blueprint. Instead, it should be tackled as something similar to a Lego set, where you have a main actor, with it’s associated data set, rules, and sockets, where the separated attachments could be incorporated.

Checking around the community, I found the following example in FAB, with a few video guidelines on the logic implemented for the modular system, which could be useful for your scenario: