Structured Pacenote Schema
Defines the schema for structured pacenote fields - the machine-readable description format for rally corners, caution levels, modifiers, and special events. Provides field definitions with types, def
Defines the schema for structured pacenote fields - the machine-readable description format for rally corners, caution levels, modifiers, and special events. Provides field definitions with types, defaults, and valid ranges/values.
Public API
| Function | Signature | Returns | Description |
|---|---|---|---|
M.default | (keyName) | any | Returns the default value for a schema field |
M.initDefaultFields | (fields) | nil | Populates a table with all default field values |
M.schema | value | - | schema handler |
Schema Fields
Corner Descriptors
| Field | Type | Default | Range/Values | Description |
|---|---|---|---|---|
cornerSeverity | number | -1 | -1 to 100 | Corner tightness (-1 = unset, 0 = gentle, 100 = tightest) |
cornerDirection | enum | 0 | -1, 0, 1 | Left (-1), straight (0), right (1) |
cornerLength | number | 50 | 0 to 100 | Normalized length (0 = short, 100 = extra long) |
cornerRadiusChange | number | 50 | 0 to 100 | Normalized radius change (0 = opens, 100 = tightens) |
cornerSquare | boolean | false | - | Special square/switchback corner type |
Caution Descriptors
| Field | Type | Default | Values | Description |
|---|---|---|---|---|
caution | enum | 0 | 0, 1, 2, 3 | None, caution, double caution, triple caution |
Modifiers
| Field | Type | Default | Description |
|---|---|---|---|
modDontCut | boolean | false | "Don't cut" warning |
modNarrows | boolean | false | Road narrows |
modWater | boolean | false | Water crossing/splash |
modBumpy | boolean | false | Bumpy surface |
modBump | boolean | false | Single bump |
modJump | boolean | false | Jump/crest with air |
modCrest | boolean | false | Blind crest |
Special
| Field | Type | Default | Description |
|---|---|---|---|
finishLine | boolean | false | Finish line announcement |
System Pacenotes
The schema also defines system pacenote names (not structured fields, but listed for reference):
system = {
'damage', 'go',
'countdown1', 'countdown2', 'countdown3', 'countdown4', 'countdown5',
'firstnoteintro', 'firstnoteoutro',
'finish'
}How It Works
- Schema defines the contract for structured pacenote data
initDefaultFields(fields)populates a table with all defaults - used byStructured:init()default(keyName)provides individual field defaults- The text compositor uses this schema to know which fields exist and their types
- Legacy migrations in
Structured:onDeserializedhandle old value ranges (e.g.,cornerLength20 → 50)
Usage Example
local Schema = require('gameplay/rally/notebook/structured/schema')
-- Initialize a fields table with defaults
local fields = {}
Schema.initDefaultFields(fields)
-- fields.cornerSeverity == -1
-- fields.cornerDirection == 0
-- fields.modDontCut == false
-- etc.
-- Get a single default
local defaultSeverity = Schema.default('cornerSeverity') -- -1
-- Check schema definition
local severityDef = Schema.schema.cornerSeverity
-- { type='number', default=-1, min=-1, max=100 }See Also
- Library Compositor - Related reference
- TextCompositor - Structured Pacenote Text Generation - Related reference
- VisualCompositor - Pacenote Visual Icon Generation - Related reference
- Gameplay Systems Guide - Guide
Library Compositor
Core composition engine that converts structured pacenote fields into human-readable text phrases. Handles corner calls, caution phrases, modifiers, distance calls, finish lines, and phrase enumeratio
Text Compositor
Converts structured pacenote data into human-readable text strings for co-driver audio. Handles distance rounding, unit conversions, and phrase enumeration for TTS audio generation.