Difference between revisions of "Track file"

From Stunts Wiki
(→‎Track codification: And so it begins...)
(→‎Track codification: PHEW! Hopefully there are no mistakes in these tables, I'm gonna need them soon :-))
Line 50: Line 50:
  
 
==Track codification==
 
==Track codification==
 
''(to be completed - for the moment, see the external links {{ToFoot|2}})''
 
  
 
''Adapted from [[Jonas Baehr]]'s page {{ToFoot|2}}''
 
''Adapted from [[Jonas Baehr]]'s page {{ToFoot|2}}''
Line 59: Line 57:
 
* '''Element''': Terrain element name.
 
* '''Element''': Terrain element name.
 
* '''Orientation reference''': for elements with multiple possible orientations, the feature of the element to which the orientation columns refer to.
 
* '''Orientation reference''': for elements with multiple possible orientations, the feature of the element to which the orientation columns refer to.
* '''Orientation''': Orientation of the reference feature. "Any" indicates there is just one orientation. The other columns refer to map sides as cardinal points (N, S, W, E = top, bottom, left, right). The ">" sign indicates direction, so S>N means vertical orientation, bottom to top. Compass points indicate the corners of a tile or element (NW, SW, SE, NE = top left, bottom left, bottom right, top right).
+
* '''Orientation''': Orientation of the reference feature. "Any" indicates there is just one orientation. The other columns refer to map/tile sides as cardinal points (N, S, W, E = top, bottom, left, right). The ">" sign indicates direction, so S>N means vertical orientation, bottom to top. Compass points indicate the corners of a tile or element (NW, SW, SE, NE = top left, bottom left, bottom right, top right).
  
To find the ''hexadecimal'' value for a certain element, find its entry under the row of the element name and the column of the desired orientation.  
+
To find the ''hexadecimal'' value for a certain element, find its entry under the row of the element name and the column of the desired orientation. Since the description of the orientation of some track pieces can be quite complex, the codes are presented in multiple tables to facilitate comprehension. We suggest you to use the "Find" command of your browser for efficiently locating track elements.
  
As the description of the orientation of some track pieces can be quite complex, the codes are presented in multiple tables to facilitate comprehension. We suggest you to use the "Find" command of your browser for efficiently locating the track elements.
+
'''Important observation''': For ''multi-tile elements'' (loops, corks, large corners and splits), the value given in the tables should be used for the top, left or top left (N/W/NW) tile ''only''. The remaining tile(s) must be the adequate filler element(s), as described in the [[Track file#Fillers|corresponding section]].
  
 
=== Linear elements ===
 
=== Linear elements ===
 +
 +
By "linear" it is meant that the orientation of the element can be described unambiguously with a straight arrow. That includes most types of straight roads and ramps, as well as most stunt elements.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
|- align="center"
 
|- align="center"
! rowspan=2 | Element !! rowspan=2 | Orientation<br>reference !! colspan=9 | Orientation
+
! rowspan=2 | Element !! rowspan=2 | Orientation<br>reference !! colspan=5 | Orientation
 
|-
 
|-
 
! Any !! S>N !! E>W !! N>S !! W>E
 
! Any !! S>N !! E>W !! N>S !! W>E
Line 148: Line 148:
 
||    || 53 || 54 ||    ||  
 
||    || 53 || 54 ||    ||  
 
|-
 
|-
| Pipe entrance || Entering pipe direction
+
| Pipe start/end || Entering pipe direction
 
||    || 46 || 48 || 47 || 49
 
||    || 46 || 48 || 47 || 49
 
|-
 
|-
Line 154: Line 154:
 
||    || 6D || 6E ||    ||  
 
||    || 6D || 6E ||    ||  
 
|-
 
|-
| Highway entrance || Entering highway direction
+
| Highway start/end || Entering highway direction
 
||    || 6F || 72 || 71 || 70
 
||    || 6F || 72 || 71 || 70
 +
|-
 +
| Banked road || Ascending direction <br>''*of the banking*''
 +
||    || 32 || 30 || 33 || 31
 +
|}
 +
 +
In order to distinguish left-handed and right-handed corks u/d, picture a car moving along the corkscrew. Stick your right thumb along the vertical direction of the car (upwards or downwards) and rotate your other fingers around it. If your fingers' rotating movement matches that of the car, the cork is right-handed; otherwise, it is left-handed.
 +
 +
=== Corners and splits ===
 +
 +
{| class="wikitable"
 +
|+ '''Simple corners'''
 +
|- align="center"
 +
! rowspan=2 | Element !! rowspan=2 | Orientation<br>reference !! colspan=4 | Orientation
 +
|-
 +
! S-E !! W-S !! N-E !! W-N
 +
|-
 +
| Paved sharp corner || Connected sides
 +
|| 06 || 07 || 08 || 09
 +
|-
 +
| Paved large corner || Connected sides
 +
|| 0A || 0B || 0C || 0D
 +
|-
 +
| Dirt sharp corner || Connected sides
 +
|| 10 || 11 || 12 || 13
 +
|-
 +
| Dirt large corner || Connected sides
 +
|| 14 || 15 || 16 || 17
 +
|-
 +
| Icy sharp corner || Connected sides
 +
|| 1A || 1B || 1C || 1D
 +
|-
 +
| Icy large corner || Connected sides
 +
|| 1E || 1F || 20 || 21
 +
|-
 +
| Banked corner || Connected sides
 +
|| 34 || 35 || 36 || 37
 +
|-
 +
| Elevated corner || Connected sides
 +
|| 69 || 6A || 6B || 6C
 +
|}
 +
 +
{| class="wikitable"
 +
|+ '''Split corners'''
 +
|- align="center"
 +
! rowspan=2 colspan=2 | Element !! rowspan=2 | Orientation<br>reference !! colspan=4 | Orientation
 +
|-
 +
! S-E !! W-S !! N-E !! W-N
 +
|-
 +
| rowspan=2 | Paved sharp corner
 +
|| North-south road || Corner orientation
 +
|| 4F || 4B || 4D || 51
 +
|-
 +
|| East-west road || Corner orientation
 +
|| 4C || 52 || 50 || 4E
 +
|-
 +
| rowspan=2 | Paved large corner
 +
|| North-south road || Corner orientation
 +
|| 5B || 57 || 59 || 5D
 +
|-
 +
|| East-west road || Corner orientation
 +
|| 58 || 5E || 5C || 5A
 +
|-
 +
| rowspan=2 | Dirt sharp corner
 +
|| North-south road || Corner orientation
 +
|| 82 || 7E || 80 || 84
 +
|-
 +
|| East-west road || Corner orientation
 +
|| 7F || 85 || 83 || 81
 +
|-
 +
| rowspan=2 | Icy sharp corner
 +
|| North-south road || Corner orientation
 +
|| 8F || 8B || 8D || 91
 +
|-
 +
|| East-west road || Corner orientation
 +
|| 8C || 92 || 90 || 8E
 
|}
 
|}
 +
 +
=== Miscellaneous track elements ===
 +
 +
Special cases in which the orientation cannot be described through the simpler conventions used elsewhere.
 +
 +
{| class="wikitable"
 +
|+ '''Chicanes'''
 +
|- align="center"
 +
! rowspan=2 colspan=2 | Element !! rowspan=2 | Orientation<br>reference !! colspan=2 | Orientation
 +
|-
 +
! SW-NE !! SE-NW
 +
|-
 +
| rowspan=2 | Chicane
 +
|| North-south road || Connected tiles
 +
|| 3C || 3E
 +
|-
 +
| East-west road || Connected tiles
 +
|| 3D || 3F
 +
|}
 +
 +
{| class="wikitable"
 +
|+ '''Banked road entrances'''
 +
|- align="center"
 +
! rowspan=2 colspan=2 | Element !! rowspan=2 | Orientation<br>reference !! colspan=4 | Orientation
 +
|-
 +
! NW !! SW !! SE !! NE
 +
|-
 +
| rowspan=2 | Banked road start/end
 +
|| North-south road || Highest corner of the banking
 +
|| 28 || 2E || 2A || 2C
 +
|-
 +
| East-west road || Highest point of the banking
 +
|| 2F || 2B || 2D || 29
 +
|}
 +
 +
=== Scenery ===
 +
 +
{| class="wikitable"
 +
|- align="center"
 +
! rowspan=2 | Element !! rowspan=2 | Orientation<br>reference !! colspan=5 | Orientation
 +
|-
 +
! Any !! S !! N !! E !! W
 +
|-
 +
| Ghost car (player) ||
 +
|| 02
 +
|-
 +
| Ghost car (opponent) ||
 +
|| 03
 +
|-
 +
| Palm tree ||
 +
|| 97
 +
|-
 +
| Cactus ||
 +
|| 98
 +
|-
 +
| Pine tree ||
 +
|| 99
 +
|-
 +
| Tennis court ||
 +
|| 9A
 +
|-
 +
| Gas station || Building front
 +
||    || 9B || 9C || 9D || 9E
 +
|-
 +
| Barn || Building front
 +
||    || 9F || A0 || A1 || A2
 +
|-
 +
| Office building || Building front
 +
||    || A3 || A4 || A5 || A6
 +
|-
 +
| Windmill || Building front
 +
||    || A7 || A8 || A9 || AA
 +
|-
 +
| Ship || Ship bow
 +
||    || AD || AE || AC || AB
 +
|-
 +
| Joe's Dinner || Building front
 +
||    || AF || B0 || B1 || B2
 +
|}
 +
 +
The ghost cars were not intended to be actual scenery elements and thus are not available form the [[in-game editor]]. [[Track Blaster]] is able to insert the player ghost car as a regular track piece.
 +
 +
=== Fillers ===
 +
 +
{| class="wikitable"
 +
|- align="center"
 +
! rowspan=2 | Element !! rowspan=2 | Orientation<br>reference !! colspan=4 | Orientation
 +
|-
 +
! NW !! SW !! SE !! NE
 +
|-
 +
| Filler || Tile position
 +
|| ** || FE || FD || FF
 +
|}
 +
 +
Filler tiles are necessary for multi-part track elements to be built correctly. The proper positioning of such tiles will be described using a 2x2 grid of tiles in which the NW tile contains the value of the actual track element. For 2x1 elements (loops and corks l/r), the track element tile is either the top or the left one (depending on orientation), and so the correct fillers are either SW or NE respectively. For 2x2 elements (corks u/d, chicanes and large corners) all three fillers should be used.
 +
 +
Editing track files with external tools such as [[Track Blaster]] gives the user liberty to ''omit'' filler tiles, either leaving the other tiles blank or filling them with other elements. That is the main trick deployed to build [[illusion tracks]], as the space where the fillers would be will appear to contain the full NW track element except for very short distances and yet the physical behaviour will be set by whatever element the designer put in its place.
  
 
==Horizon codification==
 
==Horizon codification==

Revision as of 04:42, 28 February 2010

General infos

One of the most interesting features of Stunts is the possibility to create your own tracks, whatever the editor you choose to do so.

Each track is composed of 30x30 squares, one byte for each square. That is 900 bytes for track layout, with 1 additionnal byte for horizon. Terrain information (fills, water) is recorded the same way, that is 900 bytes for terrain information too. Last byte is a padding zero. Therefore, any track file (extension .TRK) should be 1,802 bytes long.

Track layout starts at offset 0x0000. Horizon is at offset 0x0384. Terrain information starts at offset 0x0385 and the zero byte is at offset 0x0709. Information is recorded row by row : left to right, bottom to top for the track layout block but left to right and top to bottom for the terrain block.

Terrain codification

Adapted from Jonas Baehr's page [2]

Key to the table columns:

  • Element: Terrain element name.
  • Orientation reference: for elements with multiple possible orientations, the feature of the element to which the orientation columns refer to.
  • Orientation: Orientation of the reference feature. "Any" indicates there is just one orientation. The other columns refer to map sides as cardinal points (N, S, W, E = top, bottom, left, right). The ">" sign indicates direction, so S>N means vertical orientation, bottom to top. Compass points indicate the corners of a tile or element (NW, SW, SE, NE = top left, bottom left, bottom right, top right).

To find the hexadecimal value for a certain element, find its entry under the row of the element name and the column of the desired orientation.

Element Orientation
reference
Orientation
Any NW SW SE NE S>N E>W N>S W>E
Flat ground 00
Water 01
Diagonal coast Corner inside water 05 02 03 04
Flat hill 06
Hill slope (straight) Uphill direction 07 08 09 0A
Angled slope (outer edge) Heightened corner 0B 0C 0D 0E
Angled slope (inner edge) Lowered corner 11 12 0F 10

Track codification

Adapted from Jonas Baehr's page [2]

Key to the table columns:

  • Element: Terrain element name.
  • Orientation reference: for elements with multiple possible orientations, the feature of the element to which the orientation columns refer to.
  • Orientation: Orientation of the reference feature. "Any" indicates there is just one orientation. The other columns refer to map/tile sides as cardinal points (N, S, W, E = top, bottom, left, right). The ">" sign indicates direction, so S>N means vertical orientation, bottom to top. Compass points indicate the corners of a tile or element (NW, SW, SE, NE = top left, bottom left, bottom right, top right).

To find the hexadecimal value for a certain element, find its entry under the row of the element name and the column of the desired orientation. Since the description of the orientation of some track pieces can be quite complex, the codes are presented in multiple tables to facilitate comprehension. We suggest you to use the "Find" command of your browser for efficiently locating track elements.

Important observation: For multi-tile elements (loops, corks, large corners and splits), the value given in the tables should be used for the top, left or top left (N/W/NW) tile only. The remaining tile(s) must be the adequate filler element(s), as described in the corresponding section.

Linear elements

By "linear" it is meant that the orientation of the element can be described unambiguously with a straight arrow. That includes most types of straight roads and ramps, as well as most stunt elements.

Element Orientation
reference
Orientation
Any S>N E>W N>S W>E
Blank 00
Paved s/f line Track direction 01 B5 B3 B4
Dirt s/f line Track direction 86 89 87 88
Icy s/f line Track direction 93 96 94 95
Paved road Track direction 04 05
Dirt road Track direction 0E 0F
Icy road Track direction 18 19
Paved crossroad 4A
Dirt crossroad 7D
Icy crossroad 8A
Elevated road Track direction 22 23
Solid el. road Track direction 63 64
Overpass Bridge direction 65 66
Elevated span Track direction 67 68
Regular ramp Ascending direction 26 25 27 24
Bridge ramp Ascending direction 3A 39 3B 38
Solid ramp Ascending direction 61 60 62 5F
Left-handed cork u/d Ascending direction 75 76 77 78
Right-handed cork u/d Ascending direction 79 7A 7B 7C
Loop Track direction 40 41
Cork l/r Track direction 55 56
Tunnel Track direction 42 43
Slalom road Track direction 73 74
Regular pipe Track direction 44 45
Pipe with obstacle Track direction 53 54
Pipe start/end Entering pipe direction 46 48 47 49
Highway Track direction 6D 6E
Highway start/end Entering highway direction 6F 72 71 70
Banked road Ascending direction
*of the banking*
32 30 33 31

In order to distinguish left-handed and right-handed corks u/d, picture a car moving along the corkscrew. Stick your right thumb along the vertical direction of the car (upwards or downwards) and rotate your other fingers around it. If your fingers' rotating movement matches that of the car, the cork is right-handed; otherwise, it is left-handed.

Corners and splits

Simple corners
Element Orientation
reference
Orientation
S-E W-S N-E W-N
Paved sharp corner Connected sides 06 07 08 09
Paved large corner Connected sides 0A 0B 0C 0D
Dirt sharp corner Connected sides 10 11 12 13
Dirt large corner Connected sides 14 15 16 17
Icy sharp corner Connected sides 1A 1B 1C 1D
Icy large corner Connected sides 1E 1F 20 21
Banked corner Connected sides 34 35 36 37
Elevated corner Connected sides 69 6A 6B 6C
Split corners
Element Orientation
reference
Orientation
S-E W-S N-E W-N
Paved sharp corner North-south road Corner orientation 4F 4B 4D 51
East-west road Corner orientation 4C 52 50 4E
Paved large corner North-south road Corner orientation 5B 57 59 5D
East-west road Corner orientation 58 5E 5C 5A
Dirt sharp corner North-south road Corner orientation 82 7E 80 84
East-west road Corner orientation 7F 85 83 81
Icy sharp corner North-south road Corner orientation 8F 8B 8D 91
East-west road Corner orientation 8C 92 90 8E

Miscellaneous track elements

Special cases in which the orientation cannot be described through the simpler conventions used elsewhere.

Chicanes
Element Orientation
reference
Orientation
SW-NE SE-NW
Chicane North-south road Connected tiles 3C 3E
East-west road Connected tiles 3D 3F
Banked road entrances
Element Orientation
reference
Orientation
NW SW SE NE
Banked road start/end North-south road Highest corner of the banking 28 2E 2A 2C
East-west road Highest point of the banking 2F 2B 2D 29

Scenery

Element Orientation
reference
Orientation
Any S N E W
Ghost car (player) 02
Ghost car (opponent) 03
Palm tree 97
Cactus 98
Pine tree 99
Tennis court 9A
Gas station Building front 9B 9C 9D 9E
Barn Building front 9F A0 A1 A2
Office building Building front A3 A4 A5 A6
Windmill Building front A7 A8 A9 AA
Ship Ship bow AD AE AC AB
Joe's Dinner Building front AF B0 B1 B2

The ghost cars were not intended to be actual scenery elements and thus are not available form the in-game editor. Track Blaster is able to insert the player ghost car as a regular track piece.

Fillers

Element Orientation
reference
Orientation
NW SW SE NE
Filler Tile position ** FE FD FF

Filler tiles are necessary for multi-part track elements to be built correctly. The proper positioning of such tiles will be described using a 2x2 grid of tiles in which the NW tile contains the value of the actual track element. For 2x1 elements (loops and corks l/r), the track element tile is either the top or the left one (depending on orientation), and so the correct fillers are either SW or NE respectively. For 2x2 elements (corks u/d, chicanes and large corners) all three fillers should be used.

Editing track files with external tools such as Track Blaster gives the user liberty to omit filler tiles, either leaving the other tiles blank or filling them with other elements. That is the main trick deployed to build illusion tracks, as the space where the fillers would be will appear to contain the full NW track element except for very short distances and yet the physical behaviour will be set by whatever element the designer put in its place.

Horizon codification

  • 0x00 Desert
  • 0x01 Tropical
  • 0x02 Alpine
  • 0x03 City
  • 0x04 Country
  • 0x05 Chaotic scenery (can make the game react weird sometimes)


External links