Overview
The Generic Game System (GGS) Interaction System provides code-only functionality, with this section offering guidance for integration.
- Use Case: Designed for complex, advanced interaction needs, not suitable for simple single-player scenarios (e.g., triggering events on player overlap).
- Purpose: Supports multiplayer interactions, dynamic UI construction, and network replication for projects requiring sophisticated interaction logic.
Enabling Plugins
The Interaction System depends on the following plugins:
- GameplayAbilities: Encapsulates all interaction behaviors in GameplayAbility.
- SmartObject: Interactive objects are SmartObject instances, with interaction entry rules (prompts, inputs) defined in their configurations.
- GameplayBehavior: Each interaction entry uses GameplayBehavior to define triggered behaviors, with GameplayAbility assigned and activated via GameplayBehavior.
- GenericGameSystem: The plugin supplies the interaction component, candidate/option state, and interaction lifecycle. A project Ability or other project logic performs Trace, Overlap, or Targeting discovery and passes the results to the component.
Prerequisite: Basic understanding of the above systems is required.
Interaction assets in the companion project
The current GenericGame project's InteractionCore contains GA_GGS_Interaction (an interaction Ability example), TP_QueryPotentialSmartObjects (a Targeting Preset), and WB_GGS_InteractionBox (an interaction prompt Widget). The Blueprint example below shows project-side Targeting System search passing results to the plugin component; these Blueprints are project Content, not part of the code plugin. See the Companion Project Content and Example Assets guide for full paths.
Relationship Diagram
The following diagram illustrates the relationships between the Interaction System, GameplayAbility, Smart Objects, and UI:
Note
Dont worry, The hard part is done. After setup, you only need to care about how to confige the actual interact actor and the concrete interaction abilities(kick door, open door...)
Interaction System Component
All players participating in active interactions require a GGS_InteractionSystemComponent on their Pawn.
The component:
- Maintains references to potential interactable actors, the current selected target, and the total num, with network replication support.
- Uses
DefaultRequestFilterto specify the types of smart objects to search for (optional, depending on implementation). - Manages state and notifies external systems of changes via events.
- Notifies the current interactable actor via the interactable interface based on state changes.
Primary Interaction Ability
Create a GameplayAbility inheriting from GGS_GameplayAbility_Interaction. The ability:
- Acts as a communication bridge between the player, Interaction System, and UI.
- Uses
ReplicationPolicyset to Replicate for RPC communication. - In the companion example, the server-side Ability runs Targeting queries, passes candidates to the component, and handles authoritative interaction. Search implementation belongs to that Ability/project logic.
- Manages interaction UI creation and communication on the client side.
Loading Blueprint
Initializing BlueprintUE renderer...
Interaction Object Search and Selection
The example uses UE5’s Gameplay Targeting System to search and sort targets, passing resulting Actors to the Interaction System Component. Alternative methods:
- Selection based on the player’s camera angle.
- Interactable Actor proactively adding itself to the potential interaction list.
Building UI
The simplest, most versatile approach is to build an interaction options list UI with key features:
- Generates a set of buttons based on the current selected interaction object’s options list.
- Disables or hides buttons based on Smart Object slot availability.
- Notifies the interaction ability via Index to start interaction upon button click.
- Allows switching between potential interactive objects via the Interaction System.
Example:
Reference Blueprint:
Loading Blueprint
Initializing BlueprintUE renderer...
Refresh Options:
Loading Blueprint
Initializing BlueprintUE renderer...
This example is available in companion projects for my other paid systems.
Interactable Interface
To enable interactive Actor responses to interaction events, implement the GGS_InteractableInterface. Example: Implementation of the interactable interface for merchants in the Generic Inventory System.
Loading Blueprint
Initializing BlueprintUE renderer...