Difference between revisions of "Check Point"

From Custom Mario Kart
Jump to navigation Jump to search
m (using "quadrilateral")
Line 2: Line 2:
 
<br/>
 
<br/>
  
This article explains how to define good check points ([[KMP#CKPT|KMP/CKPT]]) for a [[Mario Kart Wii]] track following the new '''quadrangle model'''.
+
This article explains how to define good check points ([[KMP#CKPT|KMP/CKPT]]) for a [[Mario Kart Wii]] track following the new '''quadrilateral model'''.
  
  
Line 12: Line 12:
 
If starting with the analysis of the [[KMP]] in 2009, the section [[KMP#CKPT|CKPT]] with 4 real values and 4 additional bytes for each point was also found. Very fast it was clear, that these 4 values are the x- and z-coordinates of a left and a right check point. And so the '''line model''' for check point was born. The line model says, that the line must be set, so that the driver must cross the lines. This line model works very well for the most circumstances.
 
If starting with the analysis of the [[KMP]] in 2009, the section [[KMP#CKPT|CKPT]] with 4 real values and 4 additional bytes for each point was also found. Very fast it was clear, that these 4 values are the x- and z-coordinates of a left and a right check point. And so the '''line model''' for check point was born. The line model says, that the line must be set, so that the driver must cross the lines. This line model works very well for the most circumstances.
  
In 2012, the racing group around [[Wiimm]] found situations, that can't be explained with the line model. It was [[AndyK]]s idea, that quadrangles are important. With beginning of 2013, [[Wiimm]] created different test tracks to test the behaviour offline and online. The tests confirmed the '''quadrangle model'''. And this model helped [[Wiimm]] to fix the [[Position Jump Bug]] of different tracks. The quadrangle model says, that a driver must always stay in a checkpoint quadrangle. So the quadrangles must cover all (normally) reachable parts of the track.
+
In 2012, the racing group around [[Wiimm]] found situations, that can't be explained with the line model. It was [[AndyK]]s idea, that quadrilaterals are important. With beginning of 2013, [[Wiimm]] created different test tracks to test the behaviour offline and online. The tests confirmed the '''quadrilateral model'''. And this model helped [[Wiimm]] to fix the [[Position Jump Bug]] of different tracks. The quadrilateral model says, that a driver must always stay in a checkpoint quadrilateral. So the quadrilaterals must cover all (normally) reachable parts of the track.
  
This article will now explain the background of the quadrangle model and how to set up a good check point section.
+
This article will now explain the background of the quadrilateral model and how to set up a good check point section.
  
 
== What is a check point? ==
 
== What is a check point? ==
[[File:ckpt-intro.png|right|thumb|250px|Check points basics<br/>red: road<br/>gray: offroad<br/>black: fall down<br/>blue: check points<br/>cyan: frame of quadrangle<br/>green: see text]]
+
[[File:ckpt-intro.png|right|thumb|250px|Check points basics<br/>red: road<br/>gray: offroad<br/>black: fall down<br/>blue: check points<br/>cyan: frame of quadrilateral<br/>green: see text]]
  
A check point is defined in the [[KMP#CKPT|CKPT]] section of the [[KMP]] file. Technically a check point (CKPT) is defined as a horizontal line between 2 two-dimensional points and with some attributes (4 bytes; see below). However, each of these lines forms a check point quadrangle together with its following line. On junctions (last point of a group with more than 1 following group) a check point defines multiple quadrangles, one with each following check point.
+
A check point is defined in the [[KMP#CKPT|CKPT]] section of the [[KMP]] file. Technically a check point (CKPT) is defined as a horizontal line between 2 two-dimensional points and with some attributes (4 bytes; see below). However, each of these lines forms a check point quadrilateral together with its following line. On junctions (last point of a group with more than 1 following group) a check point defines multiple quadrilaterals, one with each following check point.
  
This quadrangle model is important to understand the whole concept of check points. For example, take a look at the image on the right. The driving direction is from top to bottom.  
+
This quadrilateral model is important to understand the whole concept of check points. For example, take a look at the image on the right. The driving direction is from top to bottom.  
  
CP1 and CP2 together build the first check quadrangle. To trigger CP1, the player can enter the quadrangle from 3 sides (green arrows). This is also true for mandatory check points and for the lap counter. It is important that all drivable areas are covered by such quadrangles. In the image on the right the quadrangles include the complete offroad and also parts of fall down areas. The check quadrangle in which the player falls down decides which respawn point is used.
+
CP1 and CP2 together build the first check quadrilateral. To trigger CP1, the player can enter the quadrilateral from 3 sides (green arrows). This is also true for mandatory check points and for the lap counter. It is important that all drivable areas are covered by such quadrilaterals. In the image on the right the quadrilaterals include the complete offroad and also parts of fall down areas. The check quadrilateral in which the player falls down decides which respawn point is used.
  
After CP2 there is a route spilt. This is managed by 3 groups: The first one with CP1 and CP2 use to next links to 2 other groups (CP3a+CP4a / CP3b+CP4b). It is clear that the first quadrangles behind the junction must overlap. It is possible to use some more overlapped quadrangles, but you should make sure to avoid overlapping as far as possible.
+
After CP2 there is a route spilt. This is managed by 3 groups: The first one with CP1 and CP2 use to next links to 2 other groups (CP3a+CP4a / CP3b+CP4b). It is clear that the first quadrilaterals behind the junction must overlap. It is possible to use some more overlapped quadrilaterals, but you should make sure to avoid overlapping as far as possible.
  
 
=== Attributes ===
 
=== Attributes ===
  
 
Each check point defines 4 bytes for 4 attributes:
 
Each check point defines 4 bytes for 4 attributes:
; respawn index : Index into [[KMP#JGPT|KMP/JGPT]] for restarting the player if falling down in the related quadrangle. Incidences to not defined respawn points let the game freeze if activated.
+
; respawn index : Index into [[KMP#JGPT|KMP/JGPT]] for restarting the player if falling down in the related quadrilateral. Incidences to not defined respawn points let the game freeze if activated.
 
; check point type : The type of check point. 0xff defines a normal check point, 0x00 a lap counter and all other values define a mandatory check point (see below).
 
; check point type : The type of check point. 0xff defines a normal check point, 0x00 a lap counter and all other values define a mandatory check point (see below).
 
; previous check point : This impact is not discovered yet. It is usually the index of the previous check point, or 0xff for the first point of a group.
 
; previous check point : This impact is not discovered yet. It is usually the index of the previous check point, or 0xff for the first point of a group.
; next check point : The index of the second check point to build the quadrangle. It is usually the index of the next check point, or 0xff at junctions (last point of group).
+
; next check point : The index of the second check point to build the quadrilateral. It is usually the index of the next check point, or 0xff at junctions (last point of group).
  
 
<br clear="all"/>
 
<br clear="all"/>
=== Mandatory check point/quadrangle ===
+
=== Mandatory check point/quadrilateral ===
  
The second attribute (a byte values) defines the type of the check point (quadrangle). A value of 0xff (-1 as signed number) means, that it is a normal quadrangle without special meaning. Such quadrangles can be omitted by the drivers without side effects.
+
The second attribute (a byte values) defines the type of the check point (quadrilateral). A value of 0xff (-1 as signed number) means, that it is a normal quadrilateral without special meaning. Such quadrilaterals can be omitted by the drivers without side effects.
  
All other types of quadrangles (values 0x00&ndash;0xfe) are '''mandatory''' or '''key quadrangles'''. Type 0x00 is not only a mandatory check point, it is also the [[#Lap_counter|lap counter]] (see [[#Lap_counter|next section]]). A driver must trigger these check points in ascend order without missing one. If the driver reaches a mandatory quadrangle and has missed a prior one, Lakitu appears. A track may define multiple check points with the same type to allow alternative ways.
+
All other types of quadrilaterals (values 0x00&ndash;0xfe) are '''mandatory''' or '''key quadrilaterals'''. Type 0x00 is not only a mandatory check point, it is also the [[#Lap_counter|lap counter]] (see [[#Lap_counter|next section]]). A driver must trigger these check points in ascend order without missing one. If the driver reaches a mandatory quadrilateral and has missed a prior one, Lakitu appears. A track may define multiple check points with the same type to allow alternative ways.
  
 
One detail is important: The system detects the missing of a mandatory check point only, if a higher mandatory check point is reached. If for example mandatory check points 0, 1, 2 and 3 are defined and the drivers triggers 1 and 2, there is no need to trigger 3 before reaching the lap counter. So it's a good idea to place the last mandatory check point in the near before the lap counter.
 
One detail is important: The system detects the missing of a mandatory check point only, if a higher mandatory check point is reached. If for example mandatory check points 0, 1, 2 and 3 are defined and the drivers triggers 1 and 2, there is no need to trigger 3 before reaching the lap counter. So it's a good idea to place the last mandatory check point in the near before the lap counter.
  
There is another effect of mandatory check point: If a driver leaves the quadrangles, the system assumes its position in the last triggered mandatory quadrangle. This is also important, if falling down, because the respawn point defined by the last triggered mandatory quadrangle is then used. So it's a good idea to create (fall down) walls, so that drives can't leave the quadrangles.
+
There is another effect of mandatory check point: If a driver leaves the quadrilaterals, the system assumes its position in the last triggered mandatory quadrilateral. This is also important, if falling down, because the respawn point defined by the last triggered mandatory quadrilateral is then used. So it's a good idea to create (fall down) walls, so that drives can't leave the quadrilaterals.
  
 
=== Lap counter ===
 
=== Lap counter ===
Line 62: Line 62:
  
  
This section will show you some of the most common errors. Most of them are made because check points were thought to be lines instead of quadrangles.
+
This section will show you some of the most common errors. Most of them are made because check points were thought to be lines instead of quadrilaterals.
  
 
[[File:ckpt-bugfix-grr.png|right|thumb|400px|Fixed bug of [[GCN Rainbow Road (CaronHT)|GCN Rainbow Road]]. This is a wkmpt export displayed in 3DSmax.]]  
 
[[File:ckpt-bugfix-grr.png|right|thumb|400px|Fixed bug of [[GCN Rainbow Road (CaronHT)|GCN Rainbow Road]]. This is a wkmpt export displayed in 3DSmax.]]  
Line 69: Line 69:
 
In the picture on the right you see a typical error found in many (sharp) curves.
 
In the picture on the right you see a typical error found in many (sharp) curves.
  
On the left side the track author defined some check point lines, not knowing they together work in quadrangles. This leads to the magenta parts of the (red) roads, which are not covered by a check point quadrangle. As soon as a driver stays in this part, the Wii can't estimate its position, resulting in a [[Position Jump Bug]].
+
On the left side the track author defined some check point lines, not knowing they together work in quadrilaterals. This leads to the magenta parts of the (red) roads, which are not covered by a check point quadrilateral. As soon as a driver stays in this part, the Wii can't estimate its position, resulting in a [[Position Jump Bug]].
  
On the right side this was fixed by defining more check point lines so that the resulting quadrangles cover up all parts of the road. It's no problem to create overlapping quadrangles as long as they are at least 3 steps away from each other. The best solution is to place mandatory check points (dark blue with diamonds) somewhere between the overlapping quadrangles.
+
On the right side this was fixed by defining more check point lines so that the resulting quadrilaterals cover up all parts of the road. It's no problem to create overlapping quadrilaterals as long as they are at least 3 steps away from each other. The best solution is to place mandatory check points (dark blue with diamonds) somewhere between the overlapping quadrilaterals.
 
<br clear="all"/>
 
<br clear="all"/>
  
Line 81: Line 81:
 
In the left yellow circle, the 6 right points are placed exact  at the same position with the result, that the distance between the points is zero. And a zero distance means, that a ''normal'' can't be calculated. But normals are always used to check, if a point resists in a 2D or 3D area.
 
In the left yellow circle, the 6 right points are placed exact  at the same position with the result, that the distance between the points is zero. And a zero distance means, that a ''normal'' can't be calculated. But normals are always used to check, if a point resists in a 2D or 3D area.
  
In the right yellow circle, 2 check point lines are crossed. That makes a quadrangle calculation impossible.
+
In the right yellow circle, 2 check point lines are crossed. That makes a quadrilateral calculation impossible.
  
Both bugs will resulting in a [[Position Jump Bug]]. The right half of the picture shows a fixed set up of the check points. All quadrangles are clearly defined and intermediate quadrangles have no overlays.
+
Both bugs will resulting in a [[Position Jump Bug]]. The right half of the picture shows a fixed set up of the check points. All quadrilaterals are clearly defined and intermediate quadrilaterals have no overlays.
  
 
== Links ==
 
== Links ==

Revision as of 08:42, 23 October 2013

Under Construction
At the moment, this article is managed by Wiimm. Feel free to edit bad english, but please don't touch the structure and content until Wiimm has finished the article


This article explains how to define good check points (KMP/CKPT) for a Mario Kart Wii track following the new quadrilateral model.



Introduction

If starting with the analysis of the KMP in 2009, the section CKPT with 4 real values and 4 additional bytes for each point was also found. Very fast it was clear, that these 4 values are the x- and z-coordinates of a left and a right check point. And so the line model for check point was born. The line model says, that the line must be set, so that the driver must cross the lines. This line model works very well for the most circumstances.

In 2012, the racing group around Wiimm found situations, that can't be explained with the line model. It was AndyKs idea, that quadrilaterals are important. With beginning of 2013, Wiimm created different test tracks to test the behaviour offline and online. The tests confirmed the quadrilateral model. And this model helped Wiimm to fix the Position Jump Bug of different tracks. The quadrilateral model says, that a driver must always stay in a checkpoint quadrilateral. So the quadrilaterals must cover all (normally) reachable parts of the track.

This article will now explain the background of the quadrilateral model and how to set up a good check point section.

What is a check point?

Check points basics
red: road
gray: offroad
black: fall down
blue: check points
cyan: frame of quadrilateral
green: see text

A check point is defined in the CKPT section of the KMP file. Technically a check point (CKPT) is defined as a horizontal line between 2 two-dimensional points and with some attributes (4 bytes; see below). However, each of these lines forms a check point quadrilateral together with its following line. On junctions (last point of a group with more than 1 following group) a check point defines multiple quadrilaterals, one with each following check point.

This quadrilateral model is important to understand the whole concept of check points. For example, take a look at the image on the right. The driving direction is from top to bottom.

CP1 and CP2 together build the first check quadrilateral. To trigger CP1, the player can enter the quadrilateral from 3 sides (green arrows). This is also true for mandatory check points and for the lap counter. It is important that all drivable areas are covered by such quadrilaterals. In the image on the right the quadrilaterals include the complete offroad and also parts of fall down areas. The check quadrilateral in which the player falls down decides which respawn point is used.

After CP2 there is a route spilt. This is managed by 3 groups: The first one with CP1 and CP2 use to next links to 2 other groups (CP3a+CP4a / CP3b+CP4b). It is clear that the first quadrilaterals behind the junction must overlap. It is possible to use some more overlapped quadrilaterals, but you should make sure to avoid overlapping as far as possible.

Attributes

Each check point defines 4 bytes for 4 attributes:

respawn index
Index into KMP/JGPT for restarting the player if falling down in the related quadrilateral. Incidences to not defined respawn points let the game freeze if activated.
check point type
The type of check point. 0xff defines a normal check point, 0x00 a lap counter and all other values define a mandatory check point (see below).
previous check point
This impact is not discovered yet. It is usually the index of the previous check point, or 0xff for the first point of a group.
next check point
The index of the second check point to build the quadrilateral. It is usually the index of the next check point, or 0xff at junctions (last point of group).


Mandatory check point/quadrilateral

The second attribute (a byte values) defines the type of the check point (quadrilateral). A value of 0xff (-1 as signed number) means, that it is a normal quadrilateral without special meaning. Such quadrilaterals can be omitted by the drivers without side effects.

All other types of quadrilaterals (values 0x00–0xfe) are mandatory or key quadrilaterals. Type 0x00 is not only a mandatory check point, it is also the lap counter (see next section). A driver must trigger these check points in ascend order without missing one. If the driver reaches a mandatory quadrilateral and has missed a prior one, Lakitu appears. A track may define multiple check points with the same type to allow alternative ways.

One detail is important: The system detects the missing of a mandatory check point only, if a higher mandatory check point is reached. If for example mandatory check points 0, 1, 2 and 3 are defined and the drivers triggers 1 and 2, there is no need to trigger 3 before reaching the lap counter. So it's a good idea to place the last mandatory check point in the near before the lap counter.

There is another effect of mandatory check point: If a driver leaves the quadrilaterals, the system assumes its position in the last triggered mandatory quadrilateral. This is also important, if falling down, because the respawn point defined by the last triggered mandatory quadrilateral is then used. So it's a good idea to create (fall down) walls, so that drives can't leave the quadrilaterals.

Lap counter

The lap counter is the special mandatory check point with type 0x00.

........


Groups (Sections)

Overlapped areas

Respawning

Usual Errors

This section will show you some of the most common errors. Most of them are made because check points were thought to be lines instead of quadrilaterals.

Fixed bug of GCN Rainbow Road. This is a wkmpt export displayed in 3DSmax.

Curves

In the picture on the right you see a typical error found in many (sharp) curves.

On the left side the track author defined some check point lines, not knowing they together work in quadrilaterals. This leads to the magenta parts of the (red) roads, which are not covered by a check point quadrilateral. As soon as a driver stays in this part, the Wii can't estimate its position, resulting in a Position Jump Bug.

On the right side this was fixed by defining more check point lines so that the resulting quadrilaterals cover up all parts of the road. It's no problem to create overlapping quadrilaterals as long as they are at least 3 steps away from each other. The best solution is to place mandatory check points (dark blue with diamonds) somewhere between the overlapping quadrilaterals.

Fixed bug of GBA Rainbow Road. The right yellow circle is constructed for demonstration only.

Wrong distance

In the next example you see 2 more usual errors.

In the left yellow circle, the 6 right points are placed exact at the same position with the result, that the distance between the points is zero. And a zero distance means, that a normal can't be calculated. But normals are always used to check, if a point resists in a 2D or 3D area.

In the right yellow circle, 2 check point lines are crossed. That makes a quadrilateral calculation impossible.

Both bugs will resulting in a Position Jump Bug. The right half of the picture shows a fixed set up of the check points. All quadrilaterals are clearly defined and intermediate quadrilaterals have no overlays.

Links

Wiiki