Rally Pacenote
Core class representing a single pacenote in a rally notebook. Manages note text (freeform + structured), waypoints (corner start/end), audio compilation, validation, debug drawing, trigger types, and
Core class representing a single pacenote in a rally notebook. Manages note text (freeform + structured), waypoints (corner start/end), audio compilation, validation, debug drawing, trigger types, and serialization. This is one of the largest classes in the rally system.
Constructor
local Pacenote = require('gameplay/rally/notebook/pacenote')
local pn = Pacenote(notebook, name, forceId)Public API (Key Methods)
Note Content
| Method | Signature | Returns | Description |
|---|---|---|---|
noteOutputFreeform | (lang?) | string | Renders freeform note with variable interpolation |
noteOutputStructured | (lang?) | table | Returns array of structured note strings |
getNoteFieldBefore | (lang?) | string | Distance call before the note |
getNoteFieldAfter | (lang?) | string | Distance call after the note |
getNoteFieldFreeform | (lang?) | string | Raw freeform note text |
getNoteFieldStructured | (lang?) | table | Raw structured note array |
setNoteFieldFreeform | (val, lang?) | nil | Sets freeform note text |
setNoteFieldStructured | (val, lang?) | nil | Sets structured note array |
setNoteFieldBefore | (val, meters) | nil | Sets before distance call + meters |
setNoteFieldAfter | (val, meters) | nil | Sets after distance call + meters |
Audio
| Method | Signature | Returns | Description |
|---|---|---|---|
getAudioMode | () | enum | Active audio mode (freeform/structuredOnline/structuredOffline/custom) |
audioObjs | () | table|nil | Returns compiled audio objects for active mode |
audioLenTotal | () | number | Total audio duration in seconds |
asCompiled | () | table|nil | Returns cached compiled pacenote data |
Waypoints
| Method | Signature | Returns | Description |
|---|---|---|---|
getCornerStartWaypoint | () | wp|nil | Returns the CS waypoint |
getCornerEndWaypoint | () | wp|nil | Returns the CE waypoint |
getNextWaypointType | () | string|nil | Returns next needed waypoint type |
setAllRadii | (radius, wpType?) | nil | Sets radius on all (or filtered) waypoints |
Validation & State
| Method | Signature | Returns | Description |
|---|---|---|---|
validate | () | nil | Populates validation_issues array |
is_valid | () | boolean | True if no validation issues |
setTriggerType | (val) | nil | Sets trigger type enum |
toggleSlowCorner | () | nil | Toggles slow corner flag |
toggleIsolate | () | nil | Toggles isolation (suppresses distance calls) |
Drawing
| Method | Signature | Returns | Description |
|---|---|---|---|
drawDebugPacenoteSelected | (toolsState, opacity) | nil | Draws selected pacenote with full detail |
drawDebugPacenoteBackground | (toolsState, opacity) | nil | Draws as background context |
drawDebugPacenoteNoSelection | (toolsState, opacity) | nil | Draws in no-selection mode |
Internals
Note Fields Structure
Per-language storage:
notes[lang] = {
before = "", -- distance call before
beforeMeters = -1, -- raw distance in meters
note = {
freeform = "", -- text string with $db/$da vars
structured = {}, -- array of phrase strings
custom = { audioFile = "", description = "" }
},
after = "", -- distance call after
afterMeters = -1
}Audio Modes
| Mode | Source | Description |
|---|---|---|
freeform | Mission-specific TTS | Single audio file from freeform text |
structuredOnline | Mission-specific TTS | Per-phrase audio files from structured notes |
structuredOffline | Pre-generated library | Phrase audio from compositor voice library |
custom | User-provided | Custom audio file with description |
auto | Notebook default | Inherits from notebook's audio mode |
Trigger Types
| Type | Indicator | Description |
|---|---|---|
dynamic | (none) | Default dynamic trigger |
csImmediate | I | Immediate at corner start |
csStatic | csS | Static at corner start |
csHalf | cs+50% | Halfway through corner start |
ceMinus5 | ce-5m | 5m before corner end |
ceStatic | ceS | Static at corner end |
Compilation
asCompiled() caches compiled data including:
- Audio objects and lengths for ALL four modes
- Visual pacenote events for HUD display
- Distance before/after strings
- Breath timing configuration
Validation Checks
- Missing CS or CE waypoint
- Empty pacenote name
- Missing freeform or structured note text
- TODO marker set
How It Works
- Created by notebook's
sortedListsystem with waypoints as sub-list - Notes are stored per-language with freeform and structured variants
asCompiled()builds cached audio/visual data on first access- Drawing methods use configurable draw configs for different selection states
- Serialization includes all note data, waypoints, metadata, and structured fields
Usage Example
-- Access pacenote data
local text = pacenote:noteOutputFreeform("english")
local cs = pacenote:getCornerStartWaypoint()
local ce = pacenote:getCornerEndWaypoint()
-- Compile for playback
local compiled = pacenote:asCompiled()
local audioObjs = pacenote:audioObjs()
-- Validate
pacenote:validate()
if not pacenote:is_valid() then
log('W', '', 'Issues: ' .. dumps(pacenote.validation_issues))
endSee Also
- Rally Codriver - Related reference
- Rally Mission Settings - Related reference
- Pacenote Generator - Related reference
- Gameplay Systems Guide - Guide
Rally Mission Settings
Class managing per-mission rally settings stored as a JSON file alongside mission data. Handles notebook filename selection, codriver selection, and persistence. Auto-creates defaults if the settings
Pacenote Generator
Simplified corner detection system that generates pacenotes from driveline points. Analyzes road geometry using circle-fitting to identify direction changes, then groups consecutive nodes into corners