Attack System

The attack system documentation of Generic Combat System.

Cover.GCS
罗传月武(YueWu)

Author

罗传月武(YueWu)

专注游戏开发和Web技术。

Created: Nov 25, 2025Updated: Sep 15, 2026

Table of contents

Overview

In combat, each hit dealt to an enemy is called an "attack". When a character uses a melee attack ability (including the attack montage), it may trigger 1 or multiple attacks, each of which can deal different types and degrees of damage to the target.
To achieve this flexibility, GCS introduced the "attack system".

Attack Definition

An attack definition is a structure whin GCS.
For every type of attack in the game, there should be a corresponding attack definition. It contains static information for "each hit" in the combat game. A melee ability may play one attack animation but can produce multiple different types of attacks.

Each type of attack/weapon swing/projectile has specific properties associated with it, such as damage type, numerical bonuses, swing direction, etc.

In games like Elden Ring, there are thousands of different attack definitions. Since GCS manages attack definitions using a DataTable and uses soft class/object references, it will not slow down your project's performance.

Creating Attack Definition Tables

As mentioned earlier, when initiating an attack request, you need to specify an attack definition. You can create a new DataTable of type FGCS_AttackDefinition and define all the attack definitions you will use in that table.

Typically, the number of attack definitions depends on the complexity of your game mechanics and how many attack variants exist. For example, the ability "Waterfowl Dance" in Elden Ring has as many as 20 attack definitions, each with different damage types, resilience damage, and associated attributes.

战斗(攻防)系统.013

There are numerous fields to configure, with the most important properties being as follows:

  • AttackTags: You describe the characteristics of the attack by adding game tags. These tags will be added to the attack information, allowing you to use this information for further logic checks when processing attack information.
    • Example: When processing the attack result, you can check if the attack from the attacker has fire attributes and then check if the target is weak to fire. If both conditions are met, you can apply additional effects to the target.
  • SetByCallerMagnitudes: Essentially a key-value pair of GameplayTag -> float, where you can fill in any information that will be passed into the GameplayEffectSpec, allowing for further operations in calculations.
    • Example: If you have a series of combo attacks, the final segment may have a significant damage boost, and you can specify how much here, as long as your calculation accounts for it.

Managing Attack Definition Tables

From my understanding, Elden Ring categorizes different attack definition tables based on weapon types. Therefore, you can organize your attack definition tables as follows: DT_Atk_Sword_A, DT_Atk_Sword_B, DT_Atk_GreatSword_A, DT_Atk_GreatSword_B, etc.


Attack Request

If you want to initiate any form of attack, you need to use an attack request. GCS has different types of attack requests, such as melee or bullet. Attack requests are generally triggered through animation notification states.

This section explains how to initiate different attack requests. Additionally, all Gameplay Abilities that inherit from GA_GCS_Attack will automatically handle attack requests.

Melee Attacks

When a melee attack ability plays a montage, you can add ANS_GCS_AttackTrace (animation notification state) within the appropriate attack frame range to configure an attack request.

战斗(攻防)系统.006
  • TraceToControls: Defines which collision trace instances need to be activated during the activation of the animation notification state.
  • AttackDefinitionHandle: Points to a specific attack definition in the attack definition table, containing all static data related to "this hit" (such as attack power, cost, etc.).

In the above action, a right-hand weapon is used for the attack, so the detection instance named "RightHandWeapon" (which is bound to the weapon's mesh) should be activated. If the action involves a punch or a kick, you should also activate the corresponding detection instances (like RightHand, LeftFoot, which are bound to the character's mesh).

Ranged Attacks

In montages where bullets need to be fired (e.g., archery), you define the attack request by adding ANS_GCS_BulletTrace in the attack frame.

战斗(攻防)系统.007
  • BulletDefinitionHandle: Points to a specific bullet definition in the bullet definition table, containing all static data related to "this bullet" (such as how many projectiles are actually generated, its attack power, etc.).
  • TargetingSourceType: Determines how the bullet's spawn transform is calculated.
战斗(攻防)系统.008

Custom Attack Request Types

You can create a subclass of GCS_AttackRequest in Blueprints/C++ to add more information and use it in subsequent processes. For example, when you select Custom for TargetingSourceType, you should inherit from GCS_AttackRequest_Bullet to create a new version and implement GetTargetingTransform.

战斗(攻防)系统.009