Introduction
Weapons are objects that exist in most games with combat elements.
To make the weapon system easy to integrate, GCS provides the GCS_WeaponInterface
and includes BP_GCS_DemoWeapon
as the default implementation in the reference project to help you get started quickly.
Design Diagram
This design diagram describes the overall design of this weapon system.

How to implement weapon
In GCS, there are several ways to implement weapons. Below is the inheritance chain for weapon classes.

- For regular users: You should copy
BP_GCS_DemoWeapon
to create a new class as the parent class for all your weapons and customize it accordingly. - For integration: If you want to integrate with other systems, refer to
BP_GCS_DemoWeapon
and create a weapon class that inherits fromBP_GCS_Weapon
to serve as the parent class for all your weapons, and then customize it. - For advanced users: you can directly inherit from the C++ class
GCS_WeaponActor
or create your own weapon actor entirely and implement the weapon interface (GCS_WeaponInterface
) directly.
Default Weapon Implementation
The demo project also includes a weapon parent class: BP_GCS_DemoWeapon. You can create new weapon types by making a subclass of this blueprint. The weapon blueprint supports both SkeletalMesh and StaticMesh.
Default Parameters for Weapons

- Active/Inactive Sockets: Weapons can have active and inactive states, and you can specify which socket on the character's mesh the weapon should be attached to in both states.
- WeaponAbilitySets: You can add multiple ability sets to the weapon. When the weapon is activated, these ability sets will be granted to the character's ability system component, and they will be removed when the weapon is deactivated.
- AbilityActionSet: You can also associate an ability action set setting with the weapon, allowing the character to query and select corresponding ability actions from the weapon's associated ability action set when executing various abilities.
If you already have an existing project or are not satisfied with the default implementation, you can completely create your own Actor/Component/UObject and implement the GCS_WeaponInterface
.
Weapon Collision Trace Setup
Weapons can choose from different collision detection instance types for collision detection, so the weapon itself does not need to enable collision.

Depending on your accuracy requirements for weapon collision detection, you can choose either Socket-based (B_GCS_TraceInstance_SocketBased
) or Shape-based (B_GCS_TraceInstance_ShapeBased
) detection. Learn more about it here.
Socket-based Trace
If you choose SocketBased and set the SocketPrefix
to "Socket," you need to add sockets prefixed with "Socket" to your weapon model. The number of sockets depends on your collision accuracy requirements and the design of the weapon itself.

In the game, the collision trace instance will determine targets based on the number of sockets.

Shape-based Trace
If your game does not require such precise detection, you can opt for ShapeBased, which offers better performance and does not require adding numerous sockets to the Mesh. However, you will need to add a Shape component to the weapon and override the weapon interface's GetPrimitiveComponent
method to return the Shape component.

In the game, the collision trace instance will perform target detection based on the position and orientation of the Shape component.

Weapon Interface
In most cases, you can use GCS_WeaponInterface
to obtain various information related to the weapon itself or modify its state. For GCS, a weapon is just an object (it can be an Actor, a Component, or even a UObject) that contains information and state about the weapon.
Thus, the default implementation of the weapon interface in GCS is completed in the form of an Actor.
Further Reading
In real game development, weapon systems are usually part of complex inventory/equipment systems, and depending on these systems, weapons can be created in completely different ways. For example, in Lyra, weapons are represented as UObjects, and a weapon can have multiple Actors as its visual representation, such as "dual sword".
Default Weapon Management Component
The provided project includes a simple weapon manager component (BC_GCS_DemoWeaponManager) suitable for scenarios where a character has only one weapon at a time. You will add it to your combat character and configure 1 to N weapon information, allowing weapon switching through a simple API.

The BC_DemoCombatCore
component will return the character's current weapon through this weapon management component.
Integrating Other Weapon Management Component
You can refer to BC_DemoCombatCore(inherit from BC_GCS_CombatCore), and return the specified weapon object through the corresponding overloaded functions using other weapon/inventory systems, as long as the object implements the GCS_WeaponInterface
.