Difference between revisions of "Modding Whiplash/Fatal Racing"

From The /ovg/ Wiki
Jump to navigation Jump to search
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
=TRK file structure=
 
=TRK file structure=
 +
The tracks.
 
==Definition==
 
==Definition==
 
{| class="wikitable" style="text-align: center;"
 
{| class="wikitable" style="text-align: center;"
 
|-
 
|-
|Geometry length<br><code>int</code>||0||0||<code>int</code>
+
||'''[[#Header|Header]]'''
 
|-
 
|-
|colspan=4|''Empty line''
+
||''Empty line''
 
|-
 
|-
|colspan=4|''Empty line''
+
||''Empty line''
 
|-
 
|-
|colspan=4|'''[[#Geometry|Geometry]]'''
+
||'''[[#Geometry|Geometry]]'''
 
|-
 
|-
|colspan=4|'''[[#Signs|Signs]]'''
+
||'''[[#Signs|Signs]]'''
 
|-
 
|-
|colspan=4|''Empty line''
+
||''Empty line''
 
|-
 
|-
|colspan=4|'''[[#Stunts|Stunts]]'''
+
||'''[[#Stunts|Stunts]]'''
 
|-
 
|-
|colspan=4|''Empty line''
+
||''Empty line''
 
|-
 
|-
|colspan=4|'''[[#Textures|Textures]]'''
+
||'''[[#Textures|Textures]]'''
 
|-
 
|-
|colspan=4|''Empty line''
+
||''Empty line''
 
|-
 
|-
|colspan=4|'''[[#Race info|Race info]]'''
+
||'''[[#Race info|Race info]]'''
 
|-
 
|-
|colspan=4|''Empty line''
+
||''Empty line''
 +
|}
 +
 
 +
* <code>//</code> denotes a single line comment
 +
* integer values are 32-bit signed integers
 +
* floating point values are double precision
 +
===Header===
 +
{| class="wikitable" style="text-align: center;"
 +
|-
 +
|Geometry length<br><code>int</code>||0||0||Distance between track and floor<br><code>int</code>
 
|}
 
|}
 
===Geometry===
 
===Geometry===
Line 38: Line 48:
 
|Right shoulder height<br><code>int</code>
 
|Right shoulder height<br><code>int</code>
 
|Length<br><code>int</code>
 
|Length<br><code>int</code>
|Yaw rotation, clockwise (°)<br><code>float</code>
+
|Yaw rotation, counter-clockwise (°)<br><code>float</code>
 
|Pitch rotation, upwards (°)<br><code>float</code>
 
|Pitch rotation, upwards (°)<br><code>float</code>
|Roll rotation, clockwise (°)<br><code>float</code>
+
|Roll rotation, counter-clockwise (°)<br><code>float</code>
 
|AI line<br><code>int</code>
 
|AI line<br><code>int</code>
 
|AI line<br><code>int</code>
 
|AI line<br><code>int</code>
Line 57: Line 67:
 
|Center surface type<br><code>int</code>
 
|Center surface type<br><code>int</code>
 
|Right surface type<br><code>int</code>
 
|Right surface type<br><code>int</code>
|Left wall type?<br><code>int</code>
+
|Left wall type<br><code>int</code>
|Right wall type?<br><code>int</code>
+
|Right wall type<br><code>int</code>
|Roof type?<br><code>int</code>
+
|Roof type<br><code>int</code>
|<br><code>int</code>
+
|Left upper outer wall type<br><code>int</code>
|Left outer extra wall type?<br><code>int</code>
+
|Left lower outer wall type<br><code>int</code>
|<br><code>int</code>
+
|Outer wall floor type?<br><code>int</code>
|Right outer extra wall type?<br><code>int</code>
+
|Right lower outer wall type<br><code>int</code>
|<br><code>int</code>
+
|Right upper outer wall type<br><code>int</code>
 
|Environment floor type<br><code>int</code>
 
|Environment floor type<br><code>int</code>
|Sign type?<br><code>int</code>
+
|Building/Sign type<br><code>int</code>
|<br><code>int</code>
+
|Building/Sign horizontal offset<br><code>int</code>
|<br><code>int</code>
+
|Building/Sign vertical offset<br><code>int</code>
|<br><code>float</code>
+
|Building/Sign yaw, counter-clockwise (°)<br><code>float</code>
|<br><code>float</code>
+
|Building/Sign pitch, upwards (°)<br><code>float</code>
|<br><code>float</code>
+
|Building/Sign roll, counter-clockwise (°)<br><code>float</code>
 
|-
 
|-
|Left outer upper extra wall angle?<br><code>int</code>
+
|Left upper outer wall angle?<br><code>int</code>
|Left outer lower extra wall angle?<br><code>int</code>
+
|Left lower outer wall angle?<br><code>int</code>
|<br><code>int</code>
 
|<br><code>int</code>
 
|Right outer lower extra wall angle?<br><code>int</code>
 
|Right outer upper extra wall angle?<br><code>int</code>
 
|Left outer upper extra wall height<br><code>int</code>
 
|Left outer lower extra wall height<br><code>int</code>
 
|<br><code>int</code>
 
|<br><code>int</code>
 
|Right outer lower extra wall height<br><code>int</code>
 
|Right outer upper extra wall height<br><code>int</code>
 
 
|<br><code>int</code>
 
|<br><code>int</code>
 
|<br><code>int</code>
 
|<br><code>int</code>
 +
|Right lower outer wall angle?<br><code>int</code>
 +
|Right upper outer wall angle?<br><code>int</code>
 +
|Left upper outer wall height<br><code>int</code>
 +
|Left lower outer wall height<br><code>int</code>
 
|<br><code>int</code>
 
|<br><code>int</code>
 
|<br><code>int</code>
 
|<br><code>int</code>
 +
|Right lower outer wall height<br><code>int</code>
 +
|Right upper outer wall height<br><code>int</code>
 +
|Wall/roof height<br><code>int</code>
 +
|Draw order?<br><code>int</code>
 +
|Draw order?<br><code>int</code>
 +
|Draw order<br><code>int</code>
 
|<br><code>int</code>
 
|<br><code>int</code>
 
|<br><code>int</code>
 
|<br><code>int</code>
Line 111: Line 121:
 
{| class="wikitable" style="text-align: center;"
 
{| class="wikitable" style="text-align: center;"
 
|-
 
|-
|Least significant bit||31||30||29||28||27||26||25||24||23||22||21||20||19||18||17||16||15||14||13||12||11||10||9||8||7||6||5||4||3||2||1||0
+
|'''Least significant bit'''||31||30||29||28||27||26||25||24||23||22||21||20||19||18||17||16||15||14||13||12||11||10||9||8||7||6||5||4||3||2||1||0
 
|-
 
|-
|Surface type||||||||||||||Pit||||
+
|'''Surface type'''
||Wall<br>between track<br>and shoulder
+
||Wall<br>(cannot be<br>driven on)
 +
||Bounce off walls
 +
||Echo||||||
 +
||Pit
 +
||Yellow on<br>track map||
 +
||Wall<br>(cannot be<br>driven on)
 
||Transparent<br>Requires no texture
 
||Transparent<br>Requires no texture
||Non-magnetic||
+
||Bounce off walls
 +
||Non-magnetic
 
||Flip vertically
 
||Flip vertically
 
||Non-solid
 
||Non-solid
 
||Texture pair
 
||Texture pair
||||||||Flip horizontally||||||||Apply texture
+
||||||||Flip horizontally||
 +
||Partial transparency||
 +
||Apply texture
 
|colspan=8|Texture
 
|colspan=8|Texture
 
|}
 
|}
 +
* Partial transparency
 +
** Toggles transparency on textures that contain transparent sections, e.g. guardrail
 +
** Turns palette texture index 0 transparent (<code>#000000</code>) (not to be confused with the same color at another index)
 
* Texture
 
* Texture
** Bit 0: some sort of offset?
+
** Transparent
*** For normal pair textures, left index+1 right index-3
+
*** Setting bit 0 makes it darker?
*** For transparent, makes it darker?
+
** Single
** Bits 1-7: pair index, first texture on left, second on right
+
*** Bits are just texture index
*** <code>00000010</code> is first pair, <code>00000100</code> is second pair, etc
+
** Pair
====Sign type====
+
*** Bits are texture index of left, index+1 on right
 +
** When apply texture not set
 +
*** Bits indicate a solid color corresponding to the index within <code>PALETTE.PAL</code>
 +
These apply for road surface, wall/roof, and outer wall/floor.
 +
====Building/Sign type====
 
{| class="wikitable" style="text-align: center;"
 
{| class="wikitable" style="text-align: center;"
!Value!!Name!!Description
+
!Value!!Name!!Description!!Requires apply bit?!!Texturing
 
|-
 
|-
|0||TOWER||tall box
+
|0||TOWER||tall box||Yes||Index
 
|-
 
|-
|1||TOWER 2||tall box, different texture
+
|1||TOWER 2||tall box, different texture||No||Fixed (22)
 
|-
 
|-
|2||SIGN 1||small, back upside down, on one leg
+
|2||SIGN 1||small, back upside down, on one leg||Yes, but not for legs||Index, legs fixed (20)
 
|-
 
|-
|3||SIGN 2||small, back upside down, on two legs
+
|3||SIGN 2||small, back upside down, on two legs||Yes, but not for legs||Index, legs fixed (21)
 
|-
 
|-
|4||BUILD||complex building, drawn differently, different texture
+
|4||BUILD||complex building, drawn differently, different texture||No||Fixed (20, 21)
 
|-
 
|-
|5||BUILD 1||giant tall folded boxes, different texture
+
|5||BUILD 1||giant tall folded boxes, different texture||No||Fixed (0)
 
|-
 
|-
|6||BUILD 2||giant tall box, different texture
+
|6||BUILD 2||more giant tall folded box, different texture||No||Fixed (20)
 
|-
 
|-
|7||BUILD 3||WIDE short box
+
|7||BUILD 3||WIDE short box||Yes||Index
 
|-
 
|-
|8||HEELBAR||cube, different texture
+
|8||HEELBAR||cube, different texture||No||Fixed (8)
 
|-
 
|-
|9||BALLOON||flat square, always face camera
+
|9||BALLOON||flat square, always face camera||Yes||Index
 
|-
 
|-
|10||TREE||flat skinny rectangle, always face camera
+
|10||TREE||flat skinny rectangle, always face camera||No||Fixed (1)
 
|-
 
|-
|11||ADVERT||flat small square, fixed, same back
+
|11||ADVERT||flat small square, fixed, same back||Yes||Index
 
|-
 
|-
|12||ADVERT 2||fixed flat square, back upside down
+
|12||ADVERT 2||fixed flat square, back upside down||Yes||Index
 
|-
 
|-
|13||QUAD BLD||4 tall skinny boxes
+
|13||QUAD BLD||4 tall skinny boxes||No||Fixed (23, 24, 25, 26)
 
|-
 
|-
|14||BLD 0||tall box with pyramid top, different texture
+
|14||BLD 0||tall box with pyramid top, different texture||No||Fixed (20, 21)
 
|-
 
|-
|15||BIG BALL||flat square, always face camera, larger than BALLOON
+
|15||BIG BALL||flat square, always face camera, larger than BALLOON||Yes||Index
 
|-
 
|-
|16||BIG AD||fixed flat square, back upside down, smaller than ADVERT 2
+
|16||BIG AD||fixed flat square, back upside down, smaller than ADVERT 2||Yes||Index
 
|-
 
|-
 
|>=256||no idea
 
|>=256||no idea
 
|}
 
|}
 +
Textures are determined by BLD file.
 +
* Index: first 9 bits work just like road textures
 +
* Fixed: Same texture is always applied (index in parentheses)
 
====Shoulder height====
 
====Shoulder height====
 
* >0: up
 
* >0: up
Line 180: Line 208:
 
* 0: full grip
 
* 0: full grip
 
* 12: ice
 
* 12: ice
====Surface type====
+
====Wall type====
* 524703 590082 590082 appears to define a moving ramp or at least a surface the car can fly off of vertically
+
* Left and right must exist to draw roof
====Wall type?====
+
====Outer wall floor type?====
* Left and right combine to determine ceiling
+
* -2: outer walls even with shoulder, normal solid wall
====Outer lower/upper extra wall angle?====
+
* -1: no outer walls, can fall off
 +
* >=0: texture indexing with 9 bits as usual, moves walls below track and applies to floor, can drive partially off shoulder and bounce off
 +
====Building/Sign offset====
 +
* >0: left/up
 +
* 0: center
 +
* <0: right/down
 +
====Outer lower/upper wall angle?====
 
* Not the actual walls
 
* Not the actual walls
 
* >0: outward
 
* >0: outward
 
* 0: vertical
 
* 0: vertical
 +
====Draw order?====
 +
These three values seem to combine to determine whether track is visible through other track. For example, given Bonus 4 with a bunch of buildings/signs over transparent track with transparent track on the other side, when the third value is 0, no buildings/signs are visible. When said value is greater than 0, some buildings/signs are visible. Changing the value or the values of the other two may change which buildings/signs are visible.
 
====Third row====
 
====Third row====
 
These properties only ever have these values over all 11018 geometry segments of the retail tracks.
 
These properties only ever have these values over all 11018 geometry segments of the retail tracks.
Line 219: Line 255:
 
{| class="wikitable" style="text-align: center;"
 
{| class="wikitable" style="text-align: center;"
 
|-
 
|-
|Signable geometry index?<br><code>int</code>||Texture<br><code>int</code>
+
|Signable geometry index<br><code>int</code>||Texture<br><code>int</code>
 
|-
 
|-
 
|colspan=2|''...''
 
|colspan=2|''...''
Line 225: Line 261:
 
||-1||-1
 
||-1||-1
 
|}
 
|}
 +
* Signable geometry index
 +
** 0: first geometry section with <code>0 <= sign type < 256</code>
 +
** 1: second, etc
 
* Texture
 
* Texture
** Bit 0: unset is normal
+
** Bits 0-7: index in BLD texture file
** Bits 1-7: index in BLD texture file
 
 
** Bit 8: apply texture
 
** Bit 8: apply texture
 +
** Bit 15: invisible
 +
** No other bits seem to have an effect
 
===Stunts===
 
===Stunts===
 
Controls geometry that moves and potrudes. Empty on some tracks.
 
Controls geometry that moves and potrudes. Empty on some tracks.
Line 262: Line 302:
 
|colspan=2|Texture file<br><code>TEX:<DRH file></code>
 
|colspan=2|Texture file<br><code>TEX:<DRH file></code>
 
|-
 
|-
|colspan=2|Building texture file<br><code>BLD:<DRH file></code>
+
|colspan=2|Building/Sign texture file<br><code>BLD:<DRH file></code>
 
|-
 
|-
 
|colspan=2|<code>BACKS:</code>
 
|colspan=2|<code>BACKS:</code>
 
|-
 
|-
|<br><code>int</code>||<br><code>int</code>
+
|Geometry index<br><code>int</code>||Texture<br><code>int</code>
 
|-
 
|-
 
|colspan=2|''...''
 
|colspan=2|''...''
Line 272: Line 312:
 
||||-1
 
||||-1
 
|}
 
|}
 +
====Backs====
 +
The outside texture of walls when there is a wall between the track and the shoulder. There must be some kind of flag as it is not always displayed.
 
===Race info===
 
===Race info===
 
Not present on some tracks.
 
Not present on some tracks.

Revision as of 01:23, 28 March 2024

TRK file structure

The tracks.

Definition

Header
Empty line
Empty line
Geometry
Signs
Empty line
Stunts
Empty line
Textures
Empty line
Race info
Empty line
  • // denotes a single line comment
  • integer values are 32-bit signed integers
  • floating point values are double precision

Header

Geometry length
int
0 0 Distance between track and floor
int

Geometry

Track geometry.

Left shoulder width
int
Left lane width
int
Right lane width
int
Right shoulder width
int
Left shoulder height
int
Right shoulder height
int
Length
int
Yaw rotation, counter-clockwise (°)
float
Pitch rotation, upwards (°)
float
Roll rotation, counter-clockwise (°)
float
AI line
int
AI line
int
AI line
int
AI line
int
Track grip
int
Left shoulder grip
int
Right shoulder grip
int

int

int

int

int

int
Left surface type
int
Center surface type
int
Right surface type
int
Left wall type
int
Right wall type
int
Roof type
int
Left upper outer wall type
int
Left lower outer wall type
int
Outer wall floor type?
int
Right lower outer wall type
int
Right upper outer wall type
int
Environment floor type
int
Building/Sign type
int
Building/Sign horizontal offset
int
Building/Sign vertical offset
int
Building/Sign yaw, counter-clockwise (°)
float
Building/Sign pitch, upwards (°)
float
Building/Sign roll, counter-clockwise (°)
float
Left upper outer wall angle?
int
Left lower outer wall angle?
int

int

int
Right lower outer wall angle?
int
Right upper outer wall angle?
int
Left upper outer wall height
int
Left lower outer wall height
int

int

int
Right lower outer wall height
int
Right upper outer wall height
int
Wall/roof height
int
Draw order?
int
Draw order?
int
Draw order
int

int

int

int

int

int

int

int

int

int

int

int

int

int

int
Empty line
...

Surface type bit flags

Least significant bit 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Surface type Wall
(cannot be
driven on)
Bounce off walls Echo Pit Yellow on
track map
Wall
(cannot be
driven on)
Transparent
Requires no texture
Bounce off walls Non-magnetic Flip vertically Non-solid Texture pair Flip horizontally Partial transparency Apply texture Texture
  • Partial transparency
    • Toggles transparency on textures that contain transparent sections, e.g. guardrail
    • Turns palette texture index 0 transparent (#000000) (not to be confused with the same color at another index)
  • Texture
    • Transparent
      • Setting bit 0 makes it darker?
    • Single
      • Bits are just texture index
    • Pair
      • Bits are texture index of left, index+1 on right
    • When apply texture not set
      • Bits indicate a solid color corresponding to the index within PALETTE.PAL

These apply for road surface, wall/roof, and outer wall/floor.

Building/Sign type

Value Name Description Requires apply bit? Texturing
0 TOWER tall box Yes Index
1 TOWER 2 tall box, different texture No Fixed (22)
2 SIGN 1 small, back upside down, on one leg Yes, but not for legs Index, legs fixed (20)
3 SIGN 2 small, back upside down, on two legs Yes, but not for legs Index, legs fixed (21)
4 BUILD complex building, drawn differently, different texture No Fixed (20, 21)
5 BUILD 1 giant tall folded boxes, different texture No Fixed (0)
6 BUILD 2 more giant tall folded box, different texture No Fixed (20)
7 BUILD 3 WIDE short box Yes Index
8 HEELBAR cube, different texture No Fixed (8)
9 BALLOON flat square, always face camera Yes Index
10 TREE flat skinny rectangle, always face camera No Fixed (1)
11 ADVERT flat small square, fixed, same back Yes Index
12 ADVERT 2 fixed flat square, back upside down Yes Index
13 QUAD BLD 4 tall skinny boxes No Fixed (23, 24, 25, 26)
14 BLD 0 tall box with pyramid top, different texture No Fixed (20, 21)
15 BIG BALL flat square, always face camera, larger than BALLOON Yes Index
16 BIG AD fixed flat square, back upside down, smaller than ADVERT 2 Yes Index
>=256 no idea

Textures are determined by BLD file.

  • Index: first 9 bits work just like road textures
  • Fixed: Same texture is always applied (index in parentheses)

Shoulder height

  • >0: up
  • 0: flat
  • <0: down

AI line

  • >0: left
  • 0: center
  • <0: right

Grip

  • 0: full grip
  • 12: ice

Wall type

  • Left and right must exist to draw roof

Outer wall floor type?

  • -2: outer walls even with shoulder, normal solid wall
  • -1: no outer walls, can fall off
  • >=0: texture indexing with 9 bits as usual, moves walls below track and applies to floor, can drive partially off shoulder and bounce off

Building/Sign offset

  • >0: left/up
  • 0: center
  • <0: right/down

Outer lower/upper wall angle?

  • Not the actual walls
  • >0: outward
  • 0: vertical

Draw order?

These three values seem to combine to determine whether track is visible through other track. For example, given Bonus 4 with a bunch of buildings/signs over transparent track with transparent track on the other side, when the third value is 0, no buildings/signs are visible. When said value is greater than 0, some buildings/signs are visible. Changing the value or the values of the other two may change which buildings/signs are visible.

Third row

These properties only ever have these values over all 11018 geometry segments of the retail tracks.

Property index Values
16 20,40,60
17 20,40,60,80
18 20,40
19 20
20 20
21 20,40,60,80
22 1
23 20
24 1,20,40
25 20
26 1

Signs

Empty on some tracks.

Signable geometry index
int
Texture
int
...
-1 -1
  • Signable geometry index
    • 0: first geometry section with 0 <= sign type < 256
    • 1: second, etc
  • Texture
    • Bits 0-7: index in BLD texture file
    • Bit 8: apply texture
    • Bit 15: invisible
    • No other bits seem to have an effect

Stunts

Controls geometry that moves and potrudes. Empty on some tracks.

Geometry index
int
Scale factor?
int
Angle?
int
?
int
Timing group
int
Height
int
Time bulging
int
Time flat
int
Smaller expands/larger contracts?
int
Bulge?
int
...
-1
  • Scale factor?
    • Increases the length and height of the "ramp"
    • 1 is a bump, 4 starts breaking textures, 6 is huge vertical wall
  • Angle?
    • Lower is flatter, higher becomes trapezoid with longer top
  •  ?
    • No clue
  • Timing group
    • With otherwise identical config, two bumps with same number move together, with 1 and 2 move oppositely

Textures

Texture file
TEX:<DRH file>
Building/Sign texture file
BLD:<DRH file>
BACKS:
Geometry index
int
Texture
int
...
-1

Backs

The outside texture of walls when there is a wall between the track and the shoulder. There must be some kind of flag as it is not always displayed.

Race info

Not present on some tracks.

Track number
int
Impossible laps
int
Hard laps
int
Tricky laps
int
Medium laps
int
Easy laps
int
Girlie laps
int
Track map size, smaller is larger
float
Track map fidelity, smaller is more accurate
int

float

Effects

Bonus 7

  • Swapping yaw and pitch: loop
  • Swapping yaw and roll: twisting line
  • Swapping yaw and pitch, roll 90.00000: vertical ring to the left
  • Negative yaw: turnright

Length

Given Pulse at its maximum 193 mph on a modified Bonus 4 where all 494 sectors are 1200 long can complete at lap in 28.36 seconds and on the same track but with 50 flat sectors on each side shortened to 100 can complete a lap in 27.41 seconds, 1000 length units is equivalent to 13.45 ft or 4.10 m. Additionally, the rotated portions of the track contribute approximately 0.20 seconds extra compared to flat.