KRT (File Format)

From Custom Mario Kart
(Redirected from RanktimeGP.krt)
Jump to navigation Jump to search

KRT files (Kart Rank Time) contain a list of time limits for the ranking in Grand Prix mode. There is only one file of this filetype found in Mario Kart Wii, named ranktimeGP.krt, and it is found into Common.szs. A transcription of this file is available here.

File Format

Header

The file starts with a header:

Header
Offset Type Description
0x00 String File magic. Always RKGT in ASCII.
0x04 Int32 Max hidden score, needed to get a 3 stars rank (if the player ends with 60 points). 1000 in ranktimeGP.krt. This value is hardcoded to 1000, so it's unknown if this field is unused or not.
0x08 UInt16 Number of entries.
0x0A UInt16 Header size. 0xC in ranktimeGP.krt.
0x0C End of file header, start of entries

Entry

Each entry corresponds to a track, ordered by Special Slot ID. The times correspond to the number of frames since the start of the countdown (i.e. since the moment the screen fades in, playing the "Race Starts" fanfare) until the player reaches the finish line.

Offset Type Description
0x00 UInt16 Time limit in 50cc.
0x02 UInt16 Time limit in 100cc.
0x04 UInt16 Time limit in 150cc and Mirror.
0x06 Byte[2] Padding.

Usage

When the player finishes a race, right before showing the results, the game calculates a hidden score that is used to determine the overall rank at the end of a Grand Prix, which varies depending on certain actions performed by the player during the race. A new score is calculated for each race, ranging from -50 to 250. This is calculated by the function starting at RAM address 0x805368f8 in PAL.
At the end of the Grand Prix, the game adds the values gotten in each race to determine the final rank, creating a value that ranges from -200 to 1000.

The game uses the values from ranktimeGP.krt in the following formula:

(1000 * (ranktime - framecounter) / ranktime) + (framesinfirstPlace * 0x96 / ranktime)

where:

  • ranktime = The value from ranktimeGP.krt, depending on the track and engine class.
  • framecounter = Number of frames since the start of the countdown (i.e. since the moment the screen fades in, playing the "Race Starts" fanfare) until the player reaches the finish line.
  • framesinfirstPlace = Number of frames of the player being in 1st place.

The result of this formula is then added to the hidden score, alongside other bonuses / penalties that add / substract points from the hidden score. The sooner the player finishes a race, the better their hidden score will be.

Tools

The following tools can handle KRT files: