-
Notifications
You must be signed in to change notification settings - Fork 13
Track Pieces Format
The track pieces format is a JSON file format used to define track pieces. Track pieces are separate from track types. Track types refer to predefined track pieces from the main track pieces file which is written in this format.
At the root of the file format lies an array containing track piece elements. The format for a track piece element is defined in the next section.
A basic example of a track pieces file defining one simple track piece:
[
{
"name": "flat_straight",
"spline_points": [
{
"position": [-2, 0, 0],
"direction": "north",
"is_entry_connection": true
},
{
"position": [2, 0, 0],
"direction": "north",
"is_exit_connection": true
}
]
}
]
Each track piece primarily defines the shape of a track piece, as well as how the rendered sprites are processed.
Example:
{
"name": "flat_straight_station",
"spline_points": [...],
"width": 1,
"length": 1,
"orientations": [...]
}
The name field contains the internal name of the track piece. This has to be unqique and should follow the snake_case
naming convention.
A list of spline points. These spline points define the shape of the track.
Default value: 1
The width of the track piece (along the Y-axis). This is used for track pieces that take up more then one tile.
Default value: 1
The length of the track piece (along the X-axis). This is used for track pieces that take up more then one tile.
Default value: [ {"view_angle": 0}, {"view_angle": 1}, {"view_angle": 2}, {"view_angle": 3} ]
The orientations for which the track piece can be rendered.
Range (inclusive): 0
-3
The view angle defines the direction from which the scene is rendered. The camera turns anti-clockwise around the object as the value increases.
- A value of 0 represents the camera at -x, -y (0 degrees)
- A value of 1 represents the camera at x, -y (90 degrees)
- A value of 2 represents the camera at x, y (180 degrees)
- A value of 3 represents the camera at -x, y (270 degrees)
A list of outputs. Track pieces that take up several tiles may require tiles, or quadrants of tiles to be merged into a single sprite.
E.g: A medium turn takes up 2*2 tiles, but only consists of 3 sprites. The fourth tile is included in some of the 3 sprites depending on the viewing angle.
The output object is used for advanced control of a view-angle's sprite processing. This is usually only necessary for track pieces that take up multiple tiles.
Default value: First tile_index
from the coverage
field
The tile index of the tile from which the sprite is drawn in-game.