The Insanity Procedural Weapons System is a system designed on the principle that any weapon part can have it's own parts, making a tree structure of varying weapon parts. A barrel can have a second barrel to the side firing it's own shots. The ammo can be modified to blow up in a fiery explosion, or poison the target, or both! The stock can have a missile silo that fires a barrage on reload. The goal is to allow for a near endlessly expandable weapon informed by the physical parts of the weapon, similar to the Borderlands approach to weapon generation, with an added level of chaos thanks to the ability to stack parts on top of each other recursively. This makes the system useful for weapons generated immediately, or a roguelite system where the player can build up their weapon over the series of many battles.
The Insanity System is built on a hierarchy of Slots and Parts in order to keep objects organized and easy to traverse via recursion. These are packaged into a Weapon Component that acts as a wrapper for the entire system.
Slots: These are used to store the location and class of a singular part. If the slot's part is empty, it can return a valid part from the part pool that fits the parts subclass as an option to spawn.
Parts: These are where the meat of the system lies. Parts hold the physical mesh, the stats, and the functionality of a part, such a shooting, or effects that take place on reload. Each part can hold any number of slots, which are defined by sockets on the mesh with a tag for that class of part.
Weapon with a singular root part
A weapon with multiple parts attacthed, such as a barrel, magazine, stock, and minibarrels
Weapon Base: This acts a wrapper, allowing any entity be it a player class or NPC to easily access and use the weapon without running into edge cases. It has a single slot for the base part that is used as the root of the part tree. It acts as a mediator for the weapons system, taking requests from the player and sending them to the parts.
In the current iteration, the parts handle most of the gameplay logic, such as reloading and shooting. This is to allow for a web of interesting mechanics when certain parts are combined. The Root Part handles default cases for the weapons if no other parts exist to handle those responsibilities.
Expand on the available gun parts and pathways for a player to expand their weapon.
Add unique parts with special abilities such as underbarrels and, launchers, etc.
Refactor the relationship between the parts and the weapon base with an interface to make functionality more flexible; this would allow for multiple different types of weapon bases that functioned differently, such as swords, grenades, and other types of gear that would want to use the structure of the Insanity System in different ways.