Repository navigation
MSTS Path Files
An MSTS path file defines a train path through a route's track network. It stores path data points in world coordinates and a linked sequence of path nodes that describes the main route and optional siding or alternate branches. Path files normally reside in ROUTES/<route>/PATHS/ and are consumed together with the route's .tdb.
The schema below is reconstructed primarily from FTS/Open Rails parser and path-editing code, plus community documentation for path editing. FTS and Open Rails share parser ancestry and count as one derived implementation lineage. The original MSTS/Kuju documentation and an independent non-derived parser have not yet supplied a complete .pat specification.
On this page
- Structure: Serialization · Track data points · Path nodes
- Relationships: Cross-file references · Flags and variants
- Preservation: Validation · Open questions · Sources
A path is a Kuju/SIMISA structured file. A simplified structured-text outline is:
SIMISA...signature...
Serial ( version )
TrackPDPs (
TrackPDP ( tile-x tile-z x y z junction-flag validity-flag )
...
)
TrackPath (
TrPathName ( path-id )
Name ( "display name" )
TrPathFlags ( flags )
TrPathStart ( "start label" )
TrPathEnd ( "end label" )
TrPathNodes ( node-count
TrPathNode ( path-flags next-main next-siding from-pdp )
...
)
)
The outline is illustrative, not a complete valid file. Text and structured-binary variants can use the same schema, and the actual envelope and encoding must be detected from bytes. Preserve the declared counts, record order, unknown records, and raw numeric values.
TrackPDP is a path data point. It stores a tile coordinate, a local three-dimensional position, and two flag values. The local position is interpreted as metres by the examined implementations.
| Serialized position | Working interpretation | Evidence status |
|---|---|---|
tile-x |
Signed world tile X coordinate | Implementation and route-content evidence. |
tile-z |
Signed world tile Z coordinate | Implementation and route-content evidence. |
x |
Local X offset in the tile | Implementation evidence; preserve the serialized sign. |
y |
Local elevation | Implementation evidence; exact original units need confirmation. |
z |
Local Z offset in the tile | Implementation evidence; preserve the serialized sign. |
junction-flag |
Commonly 0 for an intermediate point, 1 for an end/return point, and 2 for a junction point |
Repeated implementation interpretation; original semantics remain unverified. |
validity-flag |
Opaque validity or editing state | Values such as 0, 8, 9, 12, and 13 occur in implementation comments and route content; the meaning is unresolved. |
The tile and local values use the shared MSTS coordinate model, but a path point is not itself a placed world object. Do not require a matching world-file UID. The path point instead supplies a location from which the path can be resolved against the route's track database.
Each TrPathNode links a path data point to the path graph and records node flags. The examined implementations use zero-based indices within their respective arrays.
The common rules for collection-local domains, zero-based indices, sentinels, graph links, and unresolved targets are defined in MSTS references, collections, and graphs.
| Serialized value | Working interpretation |
|---|---|
path-flags |
A 32-bit flag value. The upper 16 bits are interpreted by FTS/Open Rails as a wait duration; the lower bits contain path-node state flags. |
next-main-node |
Index of the next node in the main path. 0xFFFFFFFF is used as an end-of-chain sentinel. |
next-siding-node |
Index of the next node on a siding or alternate branch, or 0xFFFFFFFF when no branch is present. |
from-pdp |
Zero-based index into the enclosing TrackPDPs collection. |
next-main-node and next-siding-node are links into the same TrPathNodes collection. A branch may reconnect to the main chain or terminate independently. Consumers should validate indices before traversing and retain the original links even when a path is malformed.
| Record | Meaning and status |
|---|---|
TrPathName |
Stable path identifier, normally related to the .pat filename. |
Name |
Display name shown by editors and tools. |
TrPathFlags |
Optional path-level flags. Presence and exact meanings vary in the examined implementations. |
TrPathStart |
Human-readable start-location label. |
TrPathEnd |
Human-readable end-location label. |
TrPathNodes |
Counted collection of TrPathNode records. |
Serial ( 1 ) is common in observed files, but version negotiation and accepted alternate values have not been established.
A path's data points provide spatial anchors; the .tdb supplies the route network against which those anchors are resolved.
flowchart LR
PAT[path.pat] -->|TrackPDP coordinates| TILE[world tile coordinate model]
PAT -->|TrPathNode links| GRAPH[ordered path graph]
GRAPH -->|resolved path points| TDB[route.tdb]
TDB -->|vector and junction nodes| NETWORK[route track network]
TDB -->|section and shape IDs| TSECTION[global or route tsection.dat]
The usual relationship is:
-
TrPathNode.fromPDPselects aTrackPDPin the same file. - The selected point's tile and local coordinates identify a location in the route coordinate system.
- The path editor or runtime searches the route
.tdbfor the corresponding vector, junction, or end-node context. - The resulting graph traversal follows
next-main-nodeand, where present,next-siding-node.
The exact spatial tolerance, junction selection algorithm, and behavior when no TDB match exists remain implementation-specific. A preservation tool should retain a path even when resolution fails, reporting the unresolved relationship rather than deleting the point.
Interpret the complete source word, provisional labels, packed values, and unknown bits through MSTS flags, selectors, and enumerations.
FTS exposes symbolic names for several low-order path-flags bits, and Open Rails runtime code interprets some of the same values. The following labels are useful hypotheses, not an original MSTS field specification:
| Mask | Common implementation or community label | Status |
|---|---|---|
0x0001 |
Reversal point | Derived implementation and community interpretation. |
0x0002 |
Wait or stop point | Derived implementation and community interpretation. |
0x0004 |
Intermediate point | Derived implementation interpretation. |
0x0008 |
Other exit, or broken/unfinished path marker | Conflicting implementation comments; unresolved. |
0x0010 |
Optional or alternate route | Implementation interpretation; corpus confirmation needed. |
0x0020 |
Not-player-path or reserved | Named by FTS but not independently confirmed. |
0xFFFF0000 |
Wait duration extracted from the upper 16 bits | Shared derived implementation behavior; units and packing rules need original or experimental confirmation. |
Do not rewrite opaque flags into these labels during serialization. In particular, a nonzero validity-flag is not proof that a path should be discarded: implementation comments associate some values with changed, broken, or unfinished paths, but the causal rule is unknown.
FTS and Open Rails share parser ancestry and should be treated as one derived lineage. Their code preserves the main path fields and uses 0xFFFFFFFF as the no-next-node sentinel. Their comments also acknowledge incomplete understanding of the two TrackPDP flags and some path-node flags.
The FTS/Open Rails TrackViewer editing code supplies additional authoring and round-trip evidence, but editor behavior is not automatically original MSTS behavior. No independent TSRE5 path parser was located during this documentation slice. The meaning of path flags, spatial matching tolerance, and repair behavior therefore remain provisional.
- Confirm the SIMISA envelope and text/binary encoding before parsing.
- Validate
Serial, collection counts, and theTrackPDPsandTrPathNodesrecord counts without assuming they are always truthful. - Check every
from-pdpagainst the actualTrackPDPscollection. - Check
next-main-nodeandnext-siding-nodeagainst the actual node collection, allowing0xFFFFFFFFas the terminator. - Detect cycles, unreachable nodes, duplicate path identifiers, and branches that leave the node collection.
- Resolve data-point coordinates against the route
.tdbusing a producer-specific tolerance, while retaining unresolved points. - Preserve both main and siding links; do not flatten the path into one list.
- Preserve unknown flags, validity values, absent versus explicit path-level fields, and original numeric tokens.
- Validate resolved TDB section and shape references through compatible
tsection.datfiles.
- Confirm the complete root grammar, required fields, and ordering rules against original MSTS path files.
- Determine the meaning of
validity-flagvalues and whether they are error, editing, or route-state markers. - Resolve the conflicting interpretation of path-node bit
0x0008. - Confirm bit
0x0020, path-levelTrPathFlags, and the upper-half wait-time encoding. - Establish whether wait values are seconds in original MSTS and how overflow or signed values are handled.
- Measure the spatial matching tolerance and junction/branch selection behavior in MSTS and the Route Editor.
- Test missing TDBs, changed track geometry, broken links, cycles, and alternate path names.
- Locate an independent path-file implementation or original-content corpus for corroboration.
- FTS
PathFile.cs,Path.cs, andEnums.cs: path parsing, models, and flag names. - Open Rails
PathFile.cs,AIPath.cs, and TrackViewerSavePatFile.cs: derived runtime interpretation and path writing. - ORTS TrackViewer: Viewing MSTS tracks and editing MSTS paths, recorded in the MSTS research source register: Open Rails tool documentation and editing context.
- The [[track database (
.tdb)|MSTS-Track-Database]] and [[world files (.w)|MSTS-World-Files]] pages: related coordinate and network contracts.
See MSTS content for the documentation roadmap.
- MSTS Content
- Research Sources
- Kuju File Format
- Coordinates and Identity
- References, Collections, and Graphs
- Units and Numeric Values
- Flags, Selectors, and Enumerations
- Names and Resource Lookup
- Track Database (.tdb)
- Track Sections (tsection.dat)
- Route Definition (.trk)
- Path Files (.pat)
- Activity Files (.act)
- Service Files (.srv)
- Traffic Files (.trf)
- Consist Files (.con)
- Vehicles and Rolling Stock
- Shape Files (.s and .sd)
- Texture Files (.ace)
- Sound Assets (.sms, .wav, .ws)
- Track Types (ttype.dat)
- Speedpost Configuration (speedpost.dat)
- Car-Spawner Configuration (carspawn.dat)
- Route Editor Reference Files (.ref)
- Route Editor Marker Files (.mkr)
- Hazard Configuration (.haz)
- Pickup Authoring and Configuration
- Gantry Configuration (gantry.dat)
- Signals and Scripting
- Validation Experiments
- World Files (.w)