Session Zero Format (.szf) Specification

Overview

The Session Zero Format (.szf) is a structured, human-readable data format for defining and storing tabletop RPG data, including characters, templates, and game assets. It is designed to be simple to write by hand, easy to parse, and flexible enough to support a wide variety of game systems.

Core Principles

  • Human-Readable: The format uses plain text and a clear, indented structure that is easy to read and edit.
  • Structured & Typed: Data is organized into logical sections with explicitly declared field types defined in templates.
  • Extensible: The format can be extended with new fields and sections without breaking existing parsers.
  • Portable: .szf files are self-contained and can be easily shared and used across different platforms.

File Structure

Every .szf file consists of three main parts: a Header, a Metadata Section, and one or more Content Sections.

The header is mandatory and must be the first two lines of the file. It declares the file type and the schema version.

!type: [file_type]
!schema: [schema_version]
  • !type: Defines the purpose of the file. Valid types are:
    • dataset: A collection of related game elements (e.g., items, spells).
    • character_template: A blueprint defining the structure of a character sheet.
    • character: An instance of a character created from a template.
    • session: Data related to a specific game session (future use).
  • !schema: The version of the .szf specification the file adheres to (e.g., 1.1.0).

Sections

Data is organized into named sections. Sections create a hierarchical structure for organizing related fields.

Syntax: [SectionName]

SectionName must be a single word, is case-sensitive, and must use PascalCase (e.g., AbilityScores, CharacterInfo).

Nested Sections

Sections can be nested to create a logical hierarchy. The dot (.) notation is used to define a parent-child relationship.

Syntax: [ParentSection.ChildSection]

[AbilityScores]
Strength (number) = 10

[AbilityScores.Modifiers]
StrengthMod (calculated) = (AbilityScores.Strength - 10) / 2

Fields

Fields represent individual pieces of data within a section. Each field has a name, a type, and a value.

Syntax: FieldName (type) = value

  • FieldName: The name of the field. Must be a single word, is case-sensitive, and must use PascalCase.
  • (type): The data type of the field, enclosed in parentheses.
  • =: The assignment operator.
  • value: The data assigned to the field.

Comments

Comments are denoted by a hash symbol (#) at the beginning of a line. Parsers should ignore comments.

# This is a full-line comment.
FieldName (text) = Some Value

Field Types

The .szf format supports a variety of field types to handle different kinds of data:

Type Description Example Value
text A single line of text. Elara the Brave
text-field A multi-line block of text. A long sword forged by...\nIt glows faintly.
number An integer or floating-point number. 16 or 3.5
bool A boolean value. true or false
calculated A value derived from a formula. (Strength - 10) / 2
system A special field that controls application behavior.
entry-reference A reference to a single entry from a dataset. ClassData or ItemData.Longsword
entry-reference-list A comma-separated list of references to entries from a dataset. CoreFeats.PowerAttack, CoreFeats.Cleave

File Type Specifications

Dataset (!type: dataset)

A dataset file is a collection of structured entries.

Structure:

  • [Metadata] Section: Contains information about the dataset.
    • Name (text): The human-readable name of the dataset.
    • Type (text): The category of the dataset (e.g., items, spells, classes, etc.). This is a completely arbitrary value, and user-definable, but should match the intended use of the dataset.
    • Guid (text): A globally unique identifier. Optional: If left blank, the system can generate one.
    • Version (text): The semantic version of the dataset.
  • [EntryName] Section: In datasets, sections are referred to as entries. Each entry represents a specific item, spell, or other game element.
    • EntryName is the unique key for the entry within the dataset.
    • Every entry must have a non-empty Name (text) field. This is the display name for the entry.

Example: CoreItems.szf

!type: dataset
!schema: 1.1.0

# Metadata for the entire item collection
[Metadata]
# Required metadata for datasets
Name (text) = Core Fantasy Items
Type (text) = items
Guid (text) = c3d4e5f6-g7h8-9012-cdef-123456789012
Version (text) = 1.0.0

# Optional metadata
Author (text) = Fantasy Creator
Description (text-field) = A collection of basic items for any fantasy campaign.

# Definition for a Longsword
[Longsword]
Name (text) = Longsword
Description (text-field) = A standard sword with a long blade and crossguard.
Category (text) = Weapon

[Longsword.Stats]
Damage (text) = 1d8 slashing
Weight (number) = 3
Cost (number) = 15
IsMartial (bool) = true

Character Template (!type: character_template)

A character_template defines the structure, fields, and rules for a character sheet.

Structure:

  • [Metadata] Section: Contains information about the template.
  • [RequiredDatasets] Section: Lists all datasets required by this template.
    • The field name is a local alias for the dataset (e.g., CoreItems).
    • The value is a pipe-separated string: DatasetName|GUID|Version.
  • [SectionName]: Defines sections on the character sheet with fields, types, and default values.
    • Subsections can be defined using dot notation (e.g., [AbilityScores.Modifiers]).
  • System Fields: Special fields that modify section behavior:
    • DatasetType (system): Restricts a section to hold references from datasets of a specific type (e.g., items).
    • DatasetReference (system): Restricts a section to hold references from a specific dataset, identified by its alias from [RequiredDatasets].
    • AllowQuantity (system): When set, allows entry-reference fields within that section to have an associated quantity field.

Example: FantasyTemplate.szf

!type: character_template
!schema: 1.1.0

[Metadata]
# Required metadata for character templates
Name (text) = Standard Fantasy Character
Guid (text) = f9e8d7c6-b5a4-3210-9876-543210fedcba
Version (text) = 2.1.0

# Optional metadata
Author (text) = Template Master

# Datasets needed for this character sheet
[RequiredDatasets]
ClassData (text) = Core Classes|aaa-bbb-ccc|1.5.0
ItemData (text) = Core Fantasy Items|c3d4e5f6-g7h8-9012-cdef-123456789012|1.0.0
WeaponData (text) = Core Weapons|12345678-90ab-cdef-1234567890ab|1.0.0

# Character information section
[Info]
CharacterName (text) =
# This field expects a single entry from the 'ClassData' dataset.
Class (entry-reference) = ClassData

# Ability scores with default values
[AbilityScores]
Strength (number) = 10
Dexterity (number) = 10

[AbilityScores.Modifiers]
StrengthMod (calculated) = (AbilityScores.Strength - 10) / 2
DexterityMod (calculated) = (AbilityScores.Dexterity - 10) / 2

# An equipment section linked to a specific dataset `WeaponData`
# This section can only contain references to entries in the `WeaponData` dataset.
[Equipment]
DatasetReference (system) = WeaponData

# An inventory section that can hold multiple items from the `ItemData` dataset.
[Inventory]
DatasetType (system) = items
AllowQuantity (system) = true

Character (!type: character)

Structure:

  • [Metadata] Section: Contains information about the character.
    • TemplateRef (text): A mandatory reference to the source template: TemplateName|GUID|Version.
  • Content Sections: The sections defined in the template are populated with the character's specific values. Field types are not re-declared.

A character file is an instance of a character_template filled with specific data. It only contains values, as the structure and types are defined by the template.

Structure:

  • [Metadata] Section: Contains information about the character.
    • TemplateRef (text): A mandatory reference to the source template: TemplateName|GUID|Version.
  • Content Sections: The sections defined in the template are populated with the character's specific values. Field types are not re-declared.

Example: Aela.szf

!type: character
!schema: 1.1.0

[Metadata]
# Required metadata for character files
Name = Aela the Huntress
Guid = a1b2c3d4-e5f6-7890-abcd-ef1234567890
Version = 1.0.0
TemplateRef = Standard Fantasy Character|f9e8d7c6-b5a4-3210-9876-543210fedcba|2.1.0

[Info]
CharacterName = Aela the Huntress
# The value 'Ranger' is an entry from the 'ClassData' dataset,
# as specified by the 'Class' field in the template.
Class = Ranger

[AbilityScores]
Strength = 16
Dexterity = 14

# Calculated values are not stored in the character file.

[Equipment]
# This section becomes an addable list of items with quantities restricted to the `WeaponData` dataset, as defined in the template.
# 'PrimaryWeapon' is a user-defined field name for the item.
# The value 'Longsword' refers to the 'Longsword' entry in the 'WeaponData' dataset.
PrimaryWeapon = ItemData.Longsword
PrimaryWeapon.Quantity = 1

[Inventory]
# This section becomes an addable list of items from any dataset of type 'items', and allows specifying quantities.
# 'HealingPotion' and 'HempRope' are user-defined field names for the items,
# collected from the 'ItemData' notated by the prefix.
HealingPotion = ItemData.HealingPotion
HealingPotion.Quantity = 5
HempRope = ItemData.HempRope
HempRope.Quantity = 2

Advanced Features

System Properties

System properties are special fields within a character_template that modify the behavior of a section:

  • DatasetType (system) = type: Restricts a section to holding references from datasets of a specific type (e.g., items).
  • DatasetReference (system) = alias: Restricts a section to holding references from a specific dataset, identified by its alias from [RequiredDatasets].
  • Note: A section can have DatasetType or DatasetReference, but not both.
  • AllowQuantity (system) = true: When set, allows entry-reference fields within that section to have an associated quantity field.

Quantity Fields

If a template section has AllowQuantity (system) = true, a character file can specify quantities using:

Syntax: ReferenceFieldName.Quantity = value

Calculated Fields

Fields of type calculated contain formulas that are evaluated by the application:

  • Formulas can reference other fields using dot notation to access other sections (e.g., AbilityScores.Strength).
  • Supported operations should include basic arithmetic (+, -, *, /), and parentheses for grouping.

Wildcard Calculations

For sections where AllowQuantity is enabled, special wildcard syntax can be used in calculated fields to perform aggregate calculations:

  • SectionName.*.FieldName: Refers to the FieldName property of all items referenced in SectionName.

Example (in a template):

[Inventory]
DatasetType (system) = items
AllowQuantity (system) = true
TotalWeight (calculated) = Inventory.*.Weight * Inventory.*.Quantity

Best Practices

  1. GUIDs: Leave this blank, and the system will generate a GUID for you. This ensures uniqueness across datasets and templates. If you need to specify one, use a valid GUID format.
  2. Versioning: Use semantic versioning for your files to manage updates and breaking changes.
  3. Naming Convention: Strictly use PascalCase for all SectionNames and FieldNames.
  4. Nested sections/Sub-sections: Use dot notation to create logical hierarchies but avoid excessive nesting to maintain readability.
  5. Dependencies: Explicitly list all required datasets in templates.
  6. Validation: Before use, validate that a file's structure is correct and all references are valid.
↑ Top