Game Template Variables
Game variables are global and available everywhere in your templates. They're perfect for sharing colors, text, numbers, and other information across multiple designs, datasets, and components.
Available Variables
| Variable | Description |
|---|---|
| game.id | The unique identifier for this game. |
| game.name | The name of the game. |
| game.vars | An object containing all custom variables you create in the game variable editor. Access individual variables using game.vars.variableName. |
Why Use Game Variables?
Game variables are ideal when you need to:
- Share colors across designs - Define brand colors once and use them everywhere
- Maintain consistency - Update a value in one place and see it reflected across all designs
- Store game-wide settings - Version numbers, copyright text, publisher name, etc.
- Reduce duplication - Instead of typing the same value repeatedly, reference a variable
- Easy updates - Change a game variable and all designs update instantly
Creating Game Variables
To create game variables:
- Open your game settings or game variable editor
- Add a new variable with a name and value
- Use the variable in any template across any design: {{ game.vars.variableName }}
Use clear, descriptive names for your game variables. Good examples: primaryColor, copyright, gameVersion, iconSize.
Practical Examples
Example 1: Brand Colors
Create game variables for your brand colors:
- game.vars.primaryColor = #FF5733
- game.vars.secondaryColor = #33FF57
- game.vars.textColor = #333333
Then use them in any layer's fill color property:
If you decide to change your primary color, update the variable once and all designs automatically update!
Example 2: Copyright Text
Create a variable for copyright information:
- game.vars.copyright = © 2025 Your Company. All rights reserved.
Use it in a text layer:
Every card in every design will show the same copyright text.
Example 3: Shared Dimensions
Define standard sizes for elements:
- game.vars.iconSize = 64
- game.vars.titleFontSize = 36
- game.vars.bodyFontSize = 18
Use them for consistent sizing across all designs:
Example 4: Conditional Content
Use game variables as toggles:
- game.vars.showVersion = true
- game.vars.edition = standard
Then use conditional logic:
Example 5: Mathematical Calculations
Store base values and use them in calculations:
- game.vars.cardMargin = 20
- game.vars.iconPadding = 10
Combine with other values:
Accessing Game Variables
In the designer, click the Game button in the properties panel to see a menu of all available game variables. You can click any variable to insert it, or use the copy button to copy it to your clipboard.
Game variables are accessible in templates using the game.vars object:
You can also access the game ID and name:
Variable Types
Game variables can store different types of data:
| Type | Example | Use Case |
|---|---|---|
| Text/String | "Fantasy Quest" | Names, descriptions, copyright text |
| Number | 42 or 3.14 | Sizes, margins, counts, multipliers |
| Color | #FF5733 or rgb(255,87,51) | Brand colors, theme colors |
| Boolean | true or false | Feature flags, conditional rendering |
| URL | https://example.com/icon.png | Common image sources, external assets |
Best Practices
Use Descriptive Names
Choose clear, self-explanatory variable names. primaryColor is better than color1.
Group Related Variables
Use naming conventions to group related variables:
- color_primary, color_secondary, color_accent
- font_title, font_body, font_caption
- size_small, size_medium, size_large
Document Your Variables
Keep a list of what each game variable is for, especially on large projects with many designers.
Don't Overuse Variables
Not everything needs to be a game variable. Use them for values that are truly shared across multiple designs or that you expect to change frequently.
Test Changes
When updating a game variable, preview multiple designs to ensure the change looks good everywhere.
Common Use Cases
Store all your game's colors as variables, making it easy to try different color schemes or create variant editions.
Store version numbers, edition names, or release dates that appear on multiple cards.
Copyright notices, publisher name, website URL - anything that needs to be consistent across all components.
Standard margins, padding, icon sizes, or font sizes that should be consistent throughout your game.
Store URLs or template references to frequently used icons or images.
Differences from Dataset Variables
| Game Variables | Dataset Variables |
|---|---|
| Global - Available everywhere | Local - Only available within specific dataset |
| Same value for all cards/components | Can vary per row or per dataset |
| Best for shared constants | Best for per-card or per-dataset data |
| Accessed via game.vars.* | Accessed via dataset.vars.* |
| Changed in game settings | Changed in dataset editor |
Video Tutorial
Summary
Game variables are powerful tools for maintaining consistency across your entire game. By storing commonly used values like colors, text, and dimensions in game variables, you can:
- Make global updates instantly
- Ensure visual consistency
- Reduce errors from typos or inconsistent values
- Make it easier for teams to collaborate
- Experiment with different themes or editions quickly
Think of game variables as your game's settings panel - anything that should be the same everywhere or that you might want to change globally belongs in game variables.