Difference between revisions of "Track element building"

From Stunts Wiki
(→‎List of planes: Replaced with a proper table)
Line 33: Line 33:
 
====List of planes====
 
====List of planes====
  
Block Line Address Description
+
{|class="wikitable collapsible collapsed"
1 1 37E Flat ground
+
!Block !!Line !!Address !!Description
2 5 406 Boulevard divider
+
|-
3 9 48E Bridges (Viaducts may not work if set too low)
+
|1 ||1 ||37E ||Flat ground
4 13 516 Ramps and hill slopes
+
|-
5 17 59E Angled hill slopes (outer)
+
|2 ||5 ||406 ||Boulevard divider
6 21 626 Angled hill slopes (inner)
+
|-
7 25 6AE Straight banked road
+
|3 ||9 ||48E ||Bridges (Viaducts may not work if set too low)
8 29 736 Banked corner
+
|-
9 33 7BE Banked corner
+
|4 ||13 ||516 ||Ramps and hill slopes
10 37 846 Banked corner
+
|-
11 41 8CE Banked corner
+
|5 ||17 ||59E ||Angled hill slopes (outer)
12 45 956 Banked corner
+
|-
13 49 9DE Banked corner
+
|6 ||21 ||626 ||Angled hill slopes (inner)
14 53 A66 Banked corner
+
|-
15 57 AEE Banked corner
+
|7 ||25 ||6AE ||Straight banked road
16 61 B76 Banked corner
+
|-
17 65 BFE Banked corner
+
|8 ||29 ||736 ||Banked corner
18 69 C86 Banked corner
+
|-
19 73 D0E Banked corner
+
|9 ||33 ||7BE ||Banked corner
20 77 D96 Banked corner
+
|-
21 81 E1E Banked corner
+
|10 ||37 ||846 ||Banked corner
22 85 EA6 Banked corner
+
|-
23 89 F2E Banked corner
+
|11 ||41 ||8CE ||Banked corner
24 93 FB6 Banked corner
+
|-
25 97 103E Banked corner
+
|12 ||45 ||956 ||Banked corner
26 101 10C6 Banked road entrance (1st orientation is inner=left)
+
|-
27 105 114E Banked road entrance
+
|13 ||49 ||9DE ||Banked corner
28 109 11D6 Banked road entrance
+
|-
29 113 125E Banked road entrance
+
|14 ||53 ||A66 ||Banked corner
30 117 12E6 Banked road entrance
+
|-
31 121 136E Banked road entrance
+
|15 ||57 ||AEE ||Banked corner
32 125 13F6 Banked road entrance
+
|-
33 129 147E Banked road entrance
+
|16 ||61 ||B76 ||Banked corner
34 133 1506 Banked road entrance
+
|-
35 137 158E Banked road entrance
+
|17 ||65 ||BFE ||Banked corner
36 141 1616 (unknown)
+
|-
37 145 169E (unknown)
+
|18 ||69 ||C86 ||Banked corner
38 149 1726 (unknown)
+
|-
39 153 17AE (unknown)
+
|19 ||73 ||D0E ||Banked corner
40 157 1836 (unknown)
+
|-
41 161 18BE (unknown)
+
|20 ||77 ||D96 ||Banked corner
42 165 1946 (unknown)
+
|-
43 169 19CE (unknown)
+
|21 ||81 ||E1E ||Banked corner
44 173 1A56 (unknown)
+
|-
45 177 1ADE (unknown)
+
|22 ||85 ||EA6 ||Banked corner
46 181 1B66 Loop surface
+
|-
47 185 1BEE Loop surface
+
|23 ||89 ||F2E ||Banked corner
48 189 1C76 Loop surface
+
|-
49 193 1CFE Loop surface
+
|24 ||93 ||FB6 ||Banked corner
50 197 1D86 Loop surface
+
|-
51 201 1E0E Loop surface
+
|25 ||97 ||103E ||Banked corner
52 205 1E96 Loop surface
+
|-
53 209 1F1E Loop surface
+
|26 ||101 ||10C6 ||Banked road entrance (1st orientation is inner=left)
54 213 1FA6 Loop surface
+
|-
55 217 202E Loop surface
+
|27 ||105 ||114E ||Banked road entrance
56 221 20B6 Loop surface
+
|-
57 225 213E Loop surface
+
|28 ||109 ||11D6 ||Banked road entrance
58 229 21C6 Pipe surface (grounded)
+
|-
59 233 224E Pipe, cork l/r surface
+
|29 ||113 ||125E ||Banked road entrance
60 237 22D6 Pipe, cork l/r surface
+
|-
61 241 235E Pipe, cork l/r surface
+
|30 ||117 ||12E6 ||Banked road entrance
62 245 23E6 Pipe, cork l/r surface
+
|-
63 249 246E Pipe, cork l/r surface
+
|31 ||121 ||136E ||Banked road entrance
64 253 24F6 Pipe, cork l/r surface
+
|-
65 257 257E Pipe, cork l/r surface
+
|32 ||125 ||13F6 ||Banked road entrance
66 261 2606 Pipe, cork l/r surface
+
|-
67 265 268E Pipe, cork l/r surface
+
|33 ||129 ||147E ||Banked road entrance
68 269 2716 Pipe, cork l/r surface
+
|-
69 273 279E Pipe, cork l/r surface
+
|34 ||133 ||1506 ||Banked road entrance
70 277 2826 Pipe obstacle
+
|-
71 281 28AE Pipe entrance (grounded)
+
|35 ||137 ||158E ||Banked road entrance
72 285 2936 Pipe entrance
+
|-
73 289 29BE Pipe entrance
+
|36 ||141 ||1616 ||(unknown)
74 293 2A46 Pipe entrance
+
|-
75 297 2ACE Pipe entrance
+
|37 ||145 ||169E ||(unknown)
76 301 2B56 Pipe entrance
+
|-
77 305 2BDE Pipe entrance
+
|38 ||149 ||1726 ||(unknown)
78 309 2C66 Pipe entrance
+
|-
79 313 2CEE Pipe entrance
+
|39 ||153 ||17AE ||(unknown)
80 317 2D76 LH cork u/d entrance
+
|-
81 321 2DFE Left-handed cork u/d
+
|40 ||157 ||1836 ||(unknown)
82 325 2E86 Left-handed cork u/d
+
|-
83 329 2F0E Left-handed cork u/d
+
|41 ||161 ||18BE ||(unknown)
84 333 2F96 Left-handed cork u/d
+
|-
85 337 301E Left-handed cork u/d
+
|42 ||165 ||1946 ||(unknown)
86 341 30A6 Left-handed cork u/d
+
|-
87 345 312E Left-handed cork u/d
+
|43 ||169 ||19CE ||(unknown)
88 349 31B6 Left-handed cork u/d
+
|-
89 353 323E Left-handed cork u/d
+
|44 ||173 ||1A56 ||(unknown)
90 357 32C6 Left-handed cork u/d
+
|-
91 361 334E Left-handed cork u/d
+
|45 ||177 ||1ADE ||(unknown)
92 365 33D6 Left-handed cork u/d
+
|-
93 369 345E Left-handed cork u/d
+
|46 ||181 ||1B66 ||Loop surface
94 373 34E6 Left-handed cork u/d
+
|-
95 377 356E Left-handed cork u/d
+
|47 ||185 ||1BEE ||Loop surface
96 381 35F6 Left-handed cork u/d
+
|-
97 385 367E Left-handed cork u/d
+
|48 ||189 ||1C76 ||Loop surface
98 389 3706 Left-handed cork u/d
+
|-
99 393 378E Left-handed cork u/d
+
|49 ||193 ||1CFE ||Loop surface
100 397 3816 Left-handed cork u/d
+
|-
101 401 389E Left-handed cork u/d
+
|50 ||197 ||1D86 ||Loop surface
102 405 3926 Left-handed cork u/d
+
|-
103 409 39AE Left-handed cork u/d
+
|51 ||201 ||1E0E ||Loop surface
104 413 3A36 Left-handed cork u/d
+
|-
105 417 3ABE LH cork u/d bridge
+
|52 ||205 ||1E96 ||Loop surface
106 421 3B46 RH cork u/d entrance
+
|-
107 425 3BCE Right-handed cork u/d
+
|53 ||209 ||1F1E ||Loop surface
108 429 3C56 Right-handed cork u/d
+
|-
109 433 3CDE Right-handed cork u/d
+
|54 ||213 ||1FA6 ||Loop surface
110 437 3D66 Right-handed cork u/d
+
|-
111 441 3DEE Right-handed cork u/d
+
|55 ||217 ||202E ||Loop surface
112 445 3E76 Right-handed cork u/d
+
|-
113 449 3EFE Right-handed cork u/d
+
|56 ||221 ||20B6 ||Loop surface
114 453 3F86 Right-handed cork u/d
+
|-
115 457 400E Right-handed cork u/d
+
|57 ||225 ||213E ||Loop surface
116 461 4096 Right-handed cork u/d
+
|-
117 465 411E Right-handed cork u/d
+
|58 ||229 ||21C6 ||Pipe surface (grounded)
118 469 41A6 Right-handed cork u/d
+
|-
119 473 422E Right-handed cork u/d
+
|59 ||233 ||224E ||Pipe, cork l/r surface
120 477 42B6 Right-handed cork u/d
+
|-
121 481 433E Right-handed cork u/d
+
|60 ||237 ||22D6 ||Pipe, cork l/r surface
122 485 43C6 Right-handed cork u/d
+
|-
123 489 444E Right-handed cork u/d
+
|61 ||241 ||235E ||Pipe, cork l/r surface
124 493 44D6 Right-handed cork u/d
+
|-
125 497 455E Right-handed cork u/d
+
|62 ||245 ||23E6 ||Pipe, cork l/r surface
126 501 45E6 Right-handed cork u/d
+
|-
127 505 466E Right-handed cork u/d
+
|63 ||249 ||246E ||Pipe, cork l/r surface
128 509 46F6 Right-handed cork u/d
+
|-
129 513 477E Right-handed cork u/d
+
|64 ||253 ||24F6 ||Pipe, cork l/r surface
130 517 4806 Right-handed cork u/d
+
|-
131 521 488E RH corh u/d bridge
+
|65 ||257 ||257E ||Pipe, cork l/r surface
132 525 4916
+
|-
133 529 499E
+
|66 ||261 ||2606 ||Pipe, cork l/r surface
134 533 4A26 Tunnel roof
+
|-
 +
|67 ||265 ||268E ||Pipe, cork l/r surface
 +
|-
 +
|68 ||269 ||2716 ||Pipe, cork l/r surface
 +
|-
 +
|69 ||273 ||279E ||Pipe, cork l/r surface
 +
|-
 +
|70 ||277 ||2826 ||Pipe obstacle
 +
|-
 +
|71 ||281 ||28AE ||Pipe entrance (grounded)
 +
|-
 +
|72 ||285 ||2936 ||Pipe entrance
 +
|-
 +
|73 ||289 ||29BE ||Pipe entrance
 +
|-
 +
|74 ||293 ||2A46 ||Pipe entrance
 +
|-
 +
|75 ||297 ||2ACE ||Pipe entrance
 +
|-
 +
|76 ||301 ||2B56 ||Pipe entrance
 +
|-
 +
|77 ||305 ||2BDE ||Pipe entrance
 +
|-
 +
|78 ||309 ||2C66 ||Pipe entrance
 +
|-
 +
|79 ||313 ||2CEE ||Pipe entrance
 +
|-
 +
|80 ||317 ||2D76 ||LH cork u/d entrance
 +
|-
 +
|81 ||321 ||2DFE ||Left-handed cork u/d
 +
|-
 +
|82 ||325 ||2E86 ||Left-handed cork u/d
 +
|-
 +
|83 ||329 ||2F0E ||Left-handed cork u/d
 +
|-
 +
|84 ||333 ||2F96 ||Left-handed cork u/d
 +
|-
 +
|85 ||337 ||301E ||Left-handed cork u/d
 +
|-
 +
|86 ||341 ||30A6 ||Left-handed cork u/d
 +
|-
 +
|87 ||345 ||312E ||Left-handed cork u/d
 +
|-
 +
|88 ||349 ||31B6 ||Left-handed cork u/d
 +
|-
 +
|89 ||353 ||323E ||Left-handed cork u/d
 +
|-
 +
|90 ||357 ||32C6 ||Left-handed cork u/d
 +
|-
 +
|91 ||361 ||334E ||Left-handed cork u/d
 +
|-
 +
|92 ||365 ||33D6 ||Left-handed cork u/d
 +
|-
 +
|93 ||369 ||345E ||Left-handed cork u/d
 +
|-
 +
|94 ||373 ||34E6 ||Left-handed cork u/d
 +
|-
 +
|95 ||377 ||356E ||Left-handed cork u/d
 +
|-
 +
|96 ||381 ||35F6 ||Left-handed cork u/d
 +
|-
 +
|97 ||385 ||367E ||Left-handed cork u/d
 +
|-
 +
|98 ||389 ||3706 ||Left-handed cork u/d
 +
|-
 +
|99 ||393 ||378E ||Left-handed cork u/d
 +
|-
 +
|100 ||397 ||3816 ||Left-handed cork u/d
 +
|-
 +
|101 ||401 ||389E ||Left-handed cork u/d
 +
|-
 +
|102 ||405 ||3926 ||Left-handed cork u/d
 +
|-
 +
|103 ||409 ||39AE ||Left-handed cork u/d
 +
|-
 +
|104 ||413 ||3A36 ||Left-handed cork u/d
 +
|-
 +
|105 ||417 ||3ABE ||LH cork u/d bridge
 +
|-
 +
|106 ||421 ||3B46 ||RH cork u/d entrance
 +
|-
 +
|107 ||425 ||3BCE ||Right-handed cork u/d
 +
|-
 +
|108 ||429 ||3C56 ||Right-handed cork u/d
 +
|-
 +
|109 ||433 ||3CDE ||Right-handed cork u/d
 +
|-
 +
|110 ||437 ||3D66 ||Right-handed cork u/d
 +
|-
 +
|111 ||441 ||3DEE ||Right-handed cork u/d
 +
|-
 +
|112 ||445 ||3E76 ||Right-handed cork u/d
 +
|-
 +
|113 ||449 ||3EFE ||Right-handed cork u/d
 +
|-
 +
|114 ||453 ||3F86 ||Right-handed cork u/d
 +
|-
 +
|115 ||457 ||400E ||Right-handed cork u/d
 +
|-
 +
|116 ||461 ||4096 ||Right-handed cork u/d
 +
|-
 +
|117 ||465 ||411E ||Right-handed cork u/d
 +
|-
 +
|118 ||469 ||41A6 ||Right-handed cork u/d
 +
|-
 +
|119 ||473 ||422E ||Right-handed cork u/d
 +
|-
 +
|120 ||477 ||42B6 ||Right-handed cork u/d
 +
|-
 +
|121 ||481 ||433E ||Right-handed cork u/d
 +
|-
 +
|122 ||485 ||43C6 ||Right-handed cork u/d
 +
|-
 +
|123 ||489 ||444E ||Right-handed cork u/d
 +
|-
 +
|124 ||493 ||44D6 ||Right-handed cork u/d
 +
|-
 +
|125 ||497 ||455E ||Right-handed cork u/d
 +
|-
 +
|126 ||501 ||45E6 ||Right-handed cork u/d
 +
|-
 +
|127 ||505 ||466E ||Right-handed cork u/d
 +
|-
 +
|128 ||509 ||46F6 ||Right-handed cork u/d
 +
|-
 +
|129 ||513 ||477E ||Right-handed cork u/d
 +
|-
 +
|130 ||517 ||4806 ||Right-handed cork u/d
 +
|-
 +
|131 ||521 ||488E ||RH corh u/d bridge
 +
|-
 +
|132 ||525 ||4916 ||
 +
|-
 +
|133 ||529 ||499E ||
 +
|-
 +
|134 ||533 ||4A26 ||Tunnel roof
 +
|-
 +
|}
  
 
===The wall resource===
 
===The wall resource===

Revision as of 16:44, 24 February 2010

This article aims to present what is currently know on how Stunts stores the data which is used to assemble track elements such as roads, bridges, loops and scenery. The ultimate goal is to be able to effectively modify the existing elements and create new ones. There is still much to learn before that becomes possible, though - which also means there will be large gaps on this article for the time being.

General observations

Track elements have two different models. The graphical model consists of a 3D shape stored in either of GAME1.P3S or GAME2.P3S . Like any regular 3D shape, it can be modified using stressed. The graphical model, however, only controls the looks of the element. Actual physical behaviour is determined by a physical model. The physical model data appears to be spread over a number of files, and only parts of such data were located thus far. Briefly, track elements are made of potentially several plane surfaces, whose description is stored at the plan resource of GAME.PRE . Such plane surfaces, which are in principle boundless, are then weld together by a set of rules stored elsewhere. Another important piece of data which is not in plan is the type of surface associated with each plane (asphalt, grass, etc.). It is important to notice that plane surfaces in plan are not unique - for instance, the same planes are used for creating hill slopes and bridge ramps, and thus alterations to the plane surfaces will be reflected in both elements. The difference between the two elements is merely one of assembly - that is, where the planes are cut within the track tile in order to result in the track element shape. A similar situation is observed for the cork l/r and the pipe round surface. GAME.PRE also contains the wall resource, which stores data for non-drivable surfaces (such as bridge and building walls) in a poorly understood format.

GAME.PRE data

The plan resource

plan is composed of 536 structures of 34 bytes each, each associated with a plane which in turn forms part of a drivable surface. The structures consist of:

struct PLANE {
    WORD angleYZ;
    WORD angleXY;
    VECTOR origin;
    VECTOR normal;
    VECTOR[3] rotationMatrix;
};

In the above, WORD = 2-byte signed integer and:

struct VECTOR {
    WORD x;
    WORD y;
    WORD z;
};

origin sets a point in space belonging to the plane (coordinate system is the same track tile system of the 3D shapes in GAME1/2), and normal sets a normal vector to the plane "normalized" to a length of 8192. These two vectors are enough to define a (boundless) plane. angleYZ and angleXY appear to contain the inclination of the planes (given in units of 360/1024 degree, with values ranging form 0 to 1023). Since such data is made redundant by origin and normal and the values have no obvious effect on the surface behaviour their actual function is unknown. Finally, rotationMatrix appears to be a rotation matrix (of column vectors "normalized" to 16384) which changes the orientation of the car normal vector when it changes surfaces. It must be correctly set so that the surface displays reasonable physical behaviour.

The 536 structures in plan are arranged in 134 sets of 4 plane surfaces. Each plane in these quartets corresponds to the same part of the associated track element(s), the only difference being orientation relative to the track grid. The order on each quartet is predictable: the first one is in S->N orientation (pointing to +z) and the others correspond to counter-clockwise rotations (for pieces of bridge corners and banked roads, the first plane of the quartet is from the corner going S->W, the second one E->S and so on.).

List of planes

The wall resource

wall is composed of the following structures:

struct WALL {
    WORD angleXZ;
    WORD x;
    WORD z;
};

The data in these structures appear to be ground-plane projections of wall segments, with x and z making endpoints and angleXZ defining segment angles. Verification of that, and identification of wall pieces, is best performed by plotting the x and z values. There must be additional pieces of data involved in wall assembly through, as there is no info on wall heights, nor any obvious link to data in plan; also, simple alterations to wall pieces associated with elements such as block houses or slalom blocks do not work as intended.

External links