T.TAO
Resources & Data

Variable System

The Variable System is Alfheim's game state management tool for defining and managing various data that affects game execution. Variables serve as the foundation for conditional logic and state tracking in the Story System.

Feature Overview

  • Global variable definition and management
  • Character variable templates
  • Support for four variable types
  • Integration with Story System conditions and branching

Two Management Tabs

Global Variables

Project-level variables that can be read and written by all Episodes.

Character Templates

Predefined character variable templates that can be added to individual characters as needed in the Character Designer.

Global Variables

Global variables are data shared across chapters, suitable for state that needs to be tracked throughout the entire game.

Typical Uses

  • Character values such as health, gold coins
  • Main story progress markers
  • Global flags (e.g., whether a certain event has been triggered)
  • Game difficulty settings

Creating Global Variables

  1. Click the Add button in the Global Variables tab.
  2. Enter the variable name.
  3. Select the variable type.
  4. Set the default value.
  5. Optional: Add a description explaining the variable's purpose.

Variable Types

TypeDescriptionExample
IntegerWhole number valueGold coins: 100
FloatDecimal valueMovement speed: 1.5
StringText valuePlayer name: "Traveler"
BooleanTrue/FalseHas cleared game: No

Character Variable Templates

Character variable templates are predefined variable structures that can be applied to multiple characters in bulk.

Typical Uses

  • Affection (each character has it, but values are independent)
  • Trust level
  • Loyalty
  • Other common character attributes

Creating Character Variable Templates

  1. Switch to the Character Templates tab.
  2. Click the Add button.
  3. Enter the template name (e.g., "Affection").
  4. Select the variable type.
  5. Set the default value.
  6. Optional: Add a description.

Using in Characters

After creating a template, in the Character Designer profile page, each character can optionally add these variable templates. Once added, the variable belongs to that character and has an independent value.

Using Variables in Stories

The main use of variables is to drive story branches in the Story System:

Condition Nodes

In the Story System's Condition nodes, you can set conditions based on variable values. For example:

  • When "Affection > 50," go to the confession branch
  • When "Has Key = true," allow entry to the secret room

Set Variable Nodes

Modify variable values through Set Variable nodes. For example:

  • After completing a task: "Gold + 100"
  • After making a choice: "Affection + 10"
  • After triggering an event: "Event Triggered = true"

Variable Selector

When referencing variables in the Story System, a variable selector appears. The selector supports filtering by scope:

  • Global: Shows all global variables.
  • Episode: Shows the current Episode's local variables.
  • Character: Shows character variables.

Global vs. Episode Variables

FeatureGlobal VariablesEpisode Variables
ScopeEntire gameWithin a single Episode
Cross-chapter sharingYesNo
Definition locationVariables panelStory Planner
Typical useLong-term state trackingTemporary state within a chapter

Tips

  • Use clear, descriptive names for variables, e.g., "Player Gold" rather than "v1."
  • Keep the number of global variables moderate; only data that truly needs to be shared across chapters should use global variables.
  • Character variable templates are suitable for defining attributes common to all characters, avoiding redundant creation for each character.
  • Use the description field to document variable purposes for team collaboration and future maintenance.