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:

  1. Open your game settings or game variable editor
  2. Add a new variable with a name and value
  3. Use the variable in any template across any design: {{ game.vars.variableName }}
Naming Convention

Use clear, descriptive names for your game variables. Good examples: primaryColor, copyright, gameVersion, iconSize.

Practical Examples

Example 1: Brand Colors

Define Colors Once, Use Everywhere

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:

{{ game.vars.primaryColor }}

If you decide to change your primary color, update the variable once and all designs automatically update!

Example 2: Copyright Text

Consistent Legal Text

Create a variable for copyright information:

  • game.vars.copyright = © 2025 Your Company. All rights reserved.

Use it in a text layer:

{{ game.vars.copyright }}

Every card in every design will show the same copyright text.

Example 3: Shared Dimensions

Consistent Sizing

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:

Width: {{ game.vars.iconSize }} Height: {{ game.vars.iconSize }} Font Size: {{ game.vars.titleFontSize }}

Example 4: Conditional Content

Feature Flags

Use game variables as toggles:

  • game.vars.showVersion = true
  • game.vars.edition = standard

Then use conditional logic:

{{#if game.vars.showVersion}} Version: {{ game.vars.gameVersion }} {{/if}} {{#if game.vars.edition === 'deluxe'}} ⭐ Deluxe Edition {{/if}}

Example 5: Mathematical Calculations

Using Variables in Expressions

Store base values and use them in calculations:

  • game.vars.cardMargin = 20
  • game.vars.iconPadding = 10

Combine with other values:

X Position: {{ design.safe.left + game.vars.cardMargin }} Y Position: {{ design.safe.top + game.vars.cardMargin }} Width: {{ design.safe.width - (game.vars.cardMargin * 2) }}

Accessing Game Variables

Game Helper Button

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:

{{ game.vars.yourVariableName }}

You can also access the game ID and name:

{{ game.id }} {{ game.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

Color Themes

Store all your game's colors as variables, making it easy to try different color schemes or create variant editions.

Version Information

Store version numbers, edition names, or release dates that appear on multiple cards.

Publisher Information

Copyright notices, publisher name, website URL - anything that needs to be consistent across all components.

Layout Constants

Standard margins, padding, icon sizes, or font sizes that should be consistent throughout your game.

Shared Icons or Symbols

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.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us