Templates in SceneGrinder

How templates work

Introduction

Templates in role-playing games on SceneGrinder are essential blueprints for creating diverse entities such as characters, monsters, NPCs, or any interactable element. These templates not only define the structure and constraints of data entries, ensuring consistency and automation within the game but also serve as the backbone for both character views and data views, enhancing the interactive experience for players and game masters (GMs).

Understanding Templates

Templates are predefined sets of attributes that describe the specific elements within the game, providing a scaffold for users to generate their distinct instances. They encapsulate all the properties that an entity should possess for interaction within the game's world.

Types of Template Attributes

  • Collections: Groups of related attributes defining a complex element.
  • Lists: Dynamic sequences of items for abilities, items, or data enumeration.
  • Expressions: Custom scripts for dynamic value calculations.
  • Text: Freeform fields for names, descriptions, and other textual data.
  • Numeric: Fields for numerical data like levels, stats, or quantities.
  • Choice: Predefined options for selecting types, classes, or categories.
  • Lookups: Links to other templates or data sources for relational structures.

Collections

Collections are groups of related attributes that together define a complex element within the template. They are typically used to group similar attributes under a single category.

Example of a Collection:

  • ATTRIBUTES: A collection that groups the fundamental character stats. Each attribute within this collection is itself a nested collection consisting of a VALUE and a MOD attribute.
ATTRIBUTES
├── Strength
│   ├── VALUE: Numeric - Represents the raw strength score.
│   └── MOD: Lookup - References a calculation or table for the strength modifier.
├── Dexterity
│   ├── VALUE: Numeric - Represents the raw dexterity score.
│   └── MOD: Lookup - References a calculation or table for the dexterity modifier.
├── Constitution
│   ├── VALUE: Numeric - Represents the raw constitution score.
│   └── MOD: Lookup - References a calculation or table for the constitution modifier.
├── Intelligence
│   ├── VALUE: Numeric - Represents the raw intelligence score.
│   └── MOD: Lookup - References a calculation or table for the intelligence modifier.
├── Wisdom
│   ├── VALUE: Numeric - Represents the raw wisdom score.
│   └── MOD: Lookup - References a calculation or table for the wisdom modifier.
└── Charisma
    ├── VALUE: Numeric - Represents the raw charisma score.
    └── MOD: Lookup - References a calculation or table for the charisma modifier.

Lists

Lists are ordered collections of items that can hold multiple instances of a template or basic types. They are useful for managing repetitive data where each item follows the same structure. In a gaming context, lists can be used to manage inventories, spellbooks, or a list of abilities that a character can use.

Example of a List:

  • SPELLBOOK: A list that contains the spells a character has learned. Each entry in the list represents a spell, which is a collection of attributes like name, level, and description. Players and Game Masters can dynamically add and remove entries to the list. Each entry will have the "data shape" of the collection specified for the list. In this case, it's a "spell."
SPELLBOOK
├── Spell
│   ├── NAME: Text - The name of the spell.
│   ├── LEVEL: Numeric - The power level of the spell.
│   └── DESCRIPTION: Text - A brief description of the spell's effects.
├── Spell
│   ├── NAME: Text - The name of the spell.
│   ├── LEVEL: Numeric - The power level of the spell.
│   └── DESCRIPTION: Text - A brief description of the spell's effects.

Expression Attributes

Expressions in SceneGrinder are powerful tools that allow you to define dynamic values based on other attributes within the template. They are written using a special syntax that facilitates the calculation of values in real-time.

The $() Syntax

The $() syntax is used to reference attributes within expressions. When an attribute's value is required for a calculation, it is enclosed in $() which tells SceneGrinder to fetch the current value of that attribute.

Example of Expression:
  • DEX Mod: An attribute that calculates the dexterity modifier for a character. The expression for calculating this might look like floor((${ATTRIBUTES.DEX.VALUE} - 10) / 2). Here's what each part means:
    • floor(): A mathematical function that rounds down to the nearest whole number.
    • ${}: The syntax used to denote that we are referencing an attribute's value.
    • ATTRIBUTES.DEX.VALUE: The path to the dexterity value attribute in the character's template.

How It Works:

  • The expression first calculates the difference between the dexterity value and 10.
  • It then divides that number by 2 to find the modifier according to typical RPG rules.
  • Finally, it rounds down the result to the nearest whole number to get the modifier.

Using Expressions

Expressions can be used for various purposes within SceneGrinder, from simple calculations like the above to more complex conditional logic. They are evaluated whenever the referenced attributes change, ensuring that the derived values are always up-to-date.

Check Properties

When setting up expressions, you can also specify certain properties:

  • Check Source: Verifies the source of the attribute value.
  • Check Name: Ensures the attribute name is valid.
  • Check Modifier: Applies a check to the modifier being used in the expression.
  • Check Visibility: Determines if the attribute should be visible based on the expression.

Modifiers and Labels

In SceneGrinder, expressions can be linked to modifiers, which are labels used for specific calculations (e.g., strength, attack). Modifiers can be shown on the character's avatar if 'Show On Avatar' is checked, and can be marked as private. The 'Don't Sort' option is available to maintain the order of modifiers as entered.

Attribute Path Notation

Within the template, the path to access these nested attributes would be represented in uppercase dotted notation. For example:

  • ATTRIBUTES.STRENGTH.VALUE would be the path to access the numeric value of the character's strength.
  • ATTRIBUTES.WISDOM.MOD would be the path to access the lookup for the wisdom modifier.

Template's Role in Character and Data Views

Templates dictate the 'Data Shape' and define the attributes of the entities in SceneGrinder. While templates set this underlying structure, the character views are responsible for the presentation layer.

Character Views

Character views are the user-facing representation of the data defined by the template. They are customizable and can be tailored to display the information in a way that's most coherent and visually appealing for the game being played. Learn more about character views.

Data Views

Data views provide a default or a customized systematic presentation of the template data. It ensures that the user interface reflects the data accurately and efficiently, allowing for effective management and interaction with the game elements.

Implementing Templates in SceneGrinder

Templates in SceneGrinder standardize the creation of new game elements. Through the UI, users fill out the attributes on the templates, resulting in new instances that conform to the game's rules.

Conclusion

Templates in SceneGrinder are the foundation for creating consistent and customizable game elements. They are integral to the game management system, connecting the data's structure with the way it's viewed and interacted with by users.

Back To SceneGrinder Documentation Back To Whatever You Were Reading Before