Overview
This article briefly explains the combat attack/defense process in the General Combat System (GCS), helping you to better understand the workflow of GCS.
Attack Process
The attack process refers to the procedure in which combat entities initiate attacks against other combat entities in the game.
Any entity involved in combat (including the environment object/traps) can initiate an attack against other combat entities in the game.
The sole purpose of the entire attack process is to: Create GameplayEffect instances and apply it to the targets.
The following diagram illustrates the general process of a humanoid character initiating an attack in GCS:

Breakdown
- Activate Ability: The Attacker (Player/AI) activates different Abilities, such as melee Ability or Spell Ability.
- Initiate Attack Request: The ability will play different ability actions (montages), and you will place
AttackTrace/BulletTraceanim notify states in the animation sequences, configuring the relevant attack request's configuration. - Ability Handles Attack Request: The
AttackTraceNotifyState's start and end will passthe attack requestto the Ability for processing through Gameplay events. The Ability will then construct the necessary GameplayEffect instances based on the relevant information in the attack request. - Melee: If it is a Melee request, the associated collision trace instance of the character or weapon will be activated, and relevant information will be passed to the collision trace instance. Once the collision trace instance identifies a valid target, it will notify the Ability to apply the gameplay effect.
- Bullet: If it is a Bullet request, a bullet instance will be spawned through the bullet system, and relevant information (gameplay effect instances) will be passed to the bullet instance. Each bullet instance has its own collision traces, and once it identifies a valid target, the bullet will apply the attack to the target.
For The gameplay effect instances created during the attack process (GameplayEffectSpec/GameplayEffectContainerSpec), you can modify them before they are actually applied to the targets.
For example:
- Pass the numerical parameters defined in the attack definition to the GE.
- Add different Tags to the GE as needed and use them in subsequent processes (for example, using Tags to indicate whether it is fire damage or magic damage).
- Bullets reduce damage over distance.
- Add new targets to the GE during the bullet's flight.
- Send a GameplayEvent and pass the Context in, allowing other passive abilities to conditionally modify the contents of the Context.
Damage Calculation
GCS standardizes the implementation of the attack process, where the attacker's goal is to add a GameplayEffect to the target, and as a game designer, you need to customize your Damage Execution Calculation。
Defense Process
The defense process refers to the procedure in which a combat entity is attacked by other combat entities in the game and the corresponding handling process.
The following diagram illustrates the general process of the 'victim' handling an incoming attack:

Each combat entity use Combat Flow to process each incoming attack.
Summary
The so-called combat essentially refers to: the offensive and defensive behavior between combat entities in the game, resulting in combat results and related result processing.
