Skip to main content

Build and Test a Card Battle with GCS FlowGraph

TinyGiants
Unity Games & Tools Developer

Game Card Editor, FlowGraph and Game Card Monitor

The image above follows a card battle from its content to its runtime results. Create the cards, characters and encounter in Game Card Editor, then open their Behavior graphs to define what happens in battle. In Play Mode, Game Card Monitor shows the result of playing a card so you can trace it back to the rule that produced it.

Create the battle content​

Open Card mode in Game Card Editor to see the list, Inspector and preview together.

Card mode with the database list, Inspector, Behavior and preview

Select a card on the left to edit its cost, target and artwork. When the card is ready to test, open its Behavior from the Inspector. The other five modes use the same layout to supply the rest of the encounter.

ModeWhat you set up
CardCost, targets, tags, art, upgrades and Behavior
DeckStarting decks, reward pools, cards and quantities
PlayerStats, energy, starting deck and battle prefab
EnemyHealth range, prefab, Intent and Behavior
StatusIcon, stacking, decay rules and Behavior
EncounterPlayer and enemy lineup, rewards and battle rules

Connect effects in FlowGraph​

A Behavior uses a control connection for execution order and a data connection for values. The node browser groups available nodes by role, so you can look under Get for a value or Action for a change to the battle.

FlowGraph node categories and a Group exposing common settings

CategoryNodesUse
Entry33Start a graph from a card, turn, battle or other event
Hook18Read or change a value before it is applied
Get19Read units, cards, piles, status stacks or variables
Operator22Calculate, compare, filter or convert values
Flow10Branch, loop, wait or ask the player to choose
Action27Change health, armor, energy, cards, statuses or turns
Intent6Choose and organize enemy actions
Event2Raise a GCS event or an optional GES event
FX7Request audio, effects, animation or other feedback
Group1Collect related nodes into a subgraph

Start with the Poison Arrow card. Follow the connection from On Card Played through damage and hit feedback to Change Status.

Poison Arrow applies damage and Poison in sequence

The card applies Poison, and the Status Behavior handles the later damage ticks. Open the status to change its tick rule for every card that applies it.

The same entry can drive a simpler card. Connect On Card Played to Change HP, target Self and enter a positive amount to heal.

Self-heal using On Card Played and Change HP

To combine two effects, connect them in order. In the next example, Draw Cards runs before Change Energy.

Drawing cards before adding energy

When the result depends on battle state, send a value into Branch. Read the Marked stack count, compare it with 0 and use the result to choose a draw or armor effect.

Marked stacks feed Condition and Branch

To apply different values to different targets, start with All Opponents. Use Filter to select enemies with Marked and Exclude for the rest.

Two target groups receive different amounts of damage

Modify a result and choose an enemy action​

Use a Hook when a status must change a value before it takes effect. Strength reads the pending damage, adds its current stack count and writes the result back with Write Hook.

Strength updates pending damage in a Hook

An Intent graph decides what the enemy will do with the current battle state. Mire Reaper uses a health threshold of 40% to choose between two weighted action lists.

Mire Reaper selects an Intent based on its health

Open the Poison Scythe Group to see one action. Its Leaf Intent supplies the preview, and its action path deals 14 damage and applies 2 stacks of Poison with the corresponding feedback.

The Poison Scythe Intent and its action path

Put FX nodes on the same control path to play a sound or effect after its battle action. The graph below places audio, effects, floating text and camera shake together as one feedback sequence.

Combat feedback with sound, VFX, floating text and camera shake

The online reference contains 103 recipes across cards, statuses and enemies. Open a recipe for a mechanic you need, then adapt its connections and settings to your content.

FlowGraph recipe reference

Edit values and organize a graph​

A node field stores a fixed value until you connect an input. Use the switch beside Deal Damage.Amount to open a port, then connect a value such as current armor or the number of cards in a pile.

Fixed fields and dynamic inputs on Deal Damage and Play Effect

Double-click a displayed name to rename it for the current graph. Drag a port up or down on the same side of a node to move it closer to the connection it serves.

Default Deal Damage node and a customized layout

Press Tab to open the node reference. Select a node to check its ports, settings and defaults.

Node reference for Deal Damage

Open ? on the toolbar to see the shortcuts available in the graph editor.

FlowGraph shortcut panel

Select two or more related nodes to create a Group. GCS carries the connections crossing the selection to the Group ports, where you can expose settings you often change, such as damage, a clip or an effect prefab.

A Group exposing selected subgraph settings

Verify the result in Play Mode​

Run the encounter and play the card. In Game Card Monitor, open Battle to check the current turn, health, energy and the effect of the last action.

Battle state in Game Card Monitor

If damage differs from the configured value, use Unit to check active statuses, then use Flow and Event to trace the action. For a phase that appears stuck, open Phase and Gate to see what is pending. Edit the corresponding Behavior and repeat the same action to check the fix.

Open the GCS documentation