Checkpoint

From MKWii TAS Wiki
Jump to navigation Jump to search

Checkpoints, or CPs, are a mechanic in Mario Kart Wii used to track progression through the lap. They handle lap counts and respawn locations.

The checkpoint system attempts to prevent unintended shortcuts from counting the lap. However, there are several oversights in the system, which makes it possible to skip a majority of the track and still get a lap count.

Overview

<TODO i am going to look at restructuring a lot of this -Michael>

Checkpoints are (convex) quadrilaterals on the XZ plane, spanning infinitely up and down, which cover the entire track. Only the vehicle's origin point (i.e. its center) is used to determine what checkpoint it's currently in. The current checkpoint value is used to determine the Race% value (as explained below), as well as the respawn point after being counted out of bounds. These values stop updating if the vehicle enters an area without an active checkpoint.

Key checkpoints

A few checkpoints on each track are marked as key checkpoints, or KCPs. Not all checkpoints are active at any given time; rather, key checkpoints control which checkpoint regions are active. If the vehicle is in a regular CP, all checkpoints between the two closest KCPs are active; if the vehicle is in a KCP, all checkpoints between the previous and next KCPs are active.

Each track also a finish line checkpoint. The finish line is the first regular and key checkpoint in order, so it is also known as CP 0 or KCP 0. If the current key checkpoint value is the last KCP of the track upon entering the finish line, the lap count increases by 1.

The intended functionality of key checkpoints is preventing unintended shortcuts. If the vehicle progresses through the track as intended, it crosses each KCP in order, eventually activating the final KCP and the finish line to receive a lap count. On the other hand, if the vehicle skips a key checkpoint, the next checkpoint regions are not activated, preventing as the finish line checkpoint remains deactivated.

LapCompletion, RaceCompletion

LapCompletion and RaceCompletion are two float values used internally to keep track of the vehicle's progress through the lap and race. LapCompletion is a value between 0 and 1, and it is updated each time the current checkpoint changes. RaceCompletion consists of an integer and decimal portion, where the integer portion represents the current lap count and the decimal portion represents lap progress. Unlike LapCompletion, RaceCompletion is updated on every frame.

The LapCompletion value increases linearly within each checkpoint, from the back to the front. The exact value of Lap% and the decimal part of Race% roughly correspond to the proportion of lap driven, but the values are arbitrary and not very accurate in many cases. <TODO this is wrong, rewrite tomorrow, make a shaded diagram of GV lapcompletion or something>

LapCompletion is used in the 95% rule and 5% rule that are used to combat ultra shortcuts and delayed lap counts. RaceCompletion is used in determining the progression through the race, and consequently the positions of players. It is rarely involved in any useful glitches or exploits.

Lap count rules

In order to increase the lap counter when entering KCP 0, the following conditions must be met:

  • Last KCP rule: If the current lap value is less than or equal to the max lap value, the current KCP value must be the last KCP of the track
Max Lap rule: Else, if the current KCP value is greater than the max lap value, the current KCP value is not checked
  • Reverse Last CP rule: If the current CP value is the last CP of the track, then the lap count increases by 1
Reverse 95% rule (or 5% rule): Else, if the current CP value is a different CP in the last KCP region and LapCompletion value decreases by over 0.95, then the lap count increases by 1

Similar rules apply for decreasing the lap counter upon leaving KCP 0:

  • Last CP rule: If the new checkpoint value is the last CP of the track, then the lap count decreases by 1
95% rule: Else, if the new checkpoint value is a different CP in the last KCP region and the LapCompletion value increases by over 0.95, then the lap count decreases by 1

Glitches & exploits

Ultra shortcut

Main article: Ultra

It is not required to drive through every KCP in order to get a lap count; the only necessary condition is driving in the last KCP, then the finish line. By going from KCP 0 to any checkpoint in the final KCP region except the last CP, and increasing the Lap% value by less than 0.95, the game does not subtract a lap, and crucially the final KCP is still active. This makes it possible to get lap counts while skipping all other KCPs.

It is also possible to quickly decrease the lap counter with a similar method. Going from any but the last CP in the final KCP region to KCP 0, while decreasing the Lap% value by less than 0.95, does not trigger the failsafe to increment the lap counter by 1.

CP1 trick

Because LapCompletion only updates upon entering a new checkpoint, it can effectively be "boosted" by driving into the next checkpoint ahead and back into the current one. This updates your LapCompletion to a value towards the front of the checkpoint, rather than the back. It is most commonly applied by driving forwards to CP1 and back into CP0 to make the 95% rule easier to satisfy, hence the name. However, it can also be used to satisfy the 5% rule when performing delayed lap counts, such as on the Rainbow Road unrestricted flap.

Delayed lap count

Main article: Delayed lap count

It is intended to always enter KCP 0 from the back when getting a lap count, but it is also possible to enter it from the sides or the front, as long as all the regular conditions for triggering a lap count are satisfied.

Delayed lap counts are often used in flap TASes to start the lap further ahead than normal (as seen on DS Yoshi Falls NU Flap), or while already moving backwards in preparation of an ultra shortcut. Breaking the checkpoint system to perform a delayed lap count usually takes a long time, so they are rarely useful in 3lap runs, but can be used to start the lap with a higher Lap% value, as seen on Coconut Mall UR 3lap.

Ghost checkpoints

Main article: Ghost checkpoints

The vehicle is considered to be inside a checkpoint if it is between the quadrilateral's side boundaries, in front of the "back" line, and behind the "front" line. However, due to a divide by zero error during calculations, some checkpoint configurations cast regions where one is simultaneously considered in front of the first checkpoint, behind the second checkpoint, and within side boundaries of both. In this case, a failsafe is triggered which places the driver on the boundary between the two checkpoints. These regions can be cast far beyond the boundaries of the checkpoint quadrilaterals themselves, and in many cases they extend infinitely outwards.

There are multiple checkpoint configuration patterns that can cause ghost checkpoints. However, they generally occur when the boundary between two checkpoint quadrilaterals is slanted, and the side boundaries of those checkpoints are otherwise parallel.

<put an image here or something>

Split path ghost checkpoints

<blah>


Ghost checkpoints can be viewed for any track or KMP file through the Ghost Checkpoint Viewer, written by EPIK95.

Lap underflow

Video: "Finishing a Race in Mario Kart Wii By Driving Backwards for 2 Weeks" by Malleo

The lap counter is a signed 2-byte value, restricted from values between -32768 and 32767. Normally, the race ends once the lap counter reaches 4. However, there is no lower bound, making it possible to drive laps backwards until the lap counter underflows from -32768 to 32767.

After underflowing the lap counter and driving from the last CP to KCP 0, the "max lap" value (responsible for the lap count in the HUD and Lakitu's sign) is set to be equal to the lower byte of the lap counter, or lap counter modulo 256. If the upper byte of the lap counter is still positive after crossing the line (e.g. the lap counter is between 1 and 32767), driving from the last CP to KCP 0 again in any way, such as driving back and forth on the finish line, instantly ends the race and sets any undefined lap times to 99:59.999. The game's logic is as follows: the first time, the current lap value is greater than the max lap value (which starts at 1), so the max lap value is updated to match the lower byte of the lap counter; the second time, because KCP 0 is entered with a high enough max lap value, the race ends.

It is theoretically possible to achieve very low lap times by underflowing the lap counter, driving laps backwards until the lap counter's lower byte is 1, then crossing into KCP 0. In this state, driving 2 more laps finishes the race, but lap 3 can be completed by driving back and forth over the finish line since the lap counter is already very high, and no lap times are undefined. However, lap times driven in this manner are always displayed as 99:59.999, no matter how many frames it took. This is due to another failsafe in the game: once the in-game timer hits 8 hours and 20 minutes, it freezes permanently, and all laps completed from that point on are stored as -60 seconds.

The timer failsafe is far too strict to underflow the lap counter in the time limit on any Nintendo track, and because lap times after the failsafe are not calculated properly, they are not valid flap runs. Regardless, underflowing the lap counter is banned in every category according to the TAS ruleset, including Unrestricted.


Anomalies

These are unintended behaviors that show up as a result of checkpoint misuse. As the game makes assumptions about the shape and configuration of checkpoints, breaking these rules can lead to unexpected consequences. As Nintendo tracks were made with these assumptions in mind, these effects generally only come into play on custom tracks, but they are documented for completeness regardless.

Concave checkpoints

TODO

Incomplete split paths

TODO

Fake key checkpoints

TODO

Split path key checkpoint loading

TODO