KMP Editing

From Custom Mario Kart
Jump to: navigation, search

This page is a part of the Custom Track Tutorial. Back to the main tutorial page.


This part of the Custom Track Tutorial will tell you all the basics of editing the KMP file.

  • Editing the KMP is part of making a custom track, as it contains data for start position, enemy routes, object placement and much more. There are three recommended programs which can edit KMP files: KMP Cloud, KMP Modifier and Wiimms SZS Tools. KMP3D is a plugin for SketchUp which can aid with the KMP editing. MagicY works in conjunction with KMP Cloud to help with finding the Y (height) positions for the entries.
  • KMP Cloud and KMP Modifier provide a visual way of editing the positions, in a top-down view.
  • This tutorial is covered with images of KMP Cloud, with the KMP of Mario Circuit (castle_course) open. The KMP Cloud Tutorial page explains some of the functions of the program. The background OBJ file imported was made by extracting the KCL of the course with Wiimms SZS Tools. KMP Modifier should follow a similar layout.
  • Wiimms KMP Tool does not have a visual way of editing the KMP; it converts the KMP file into text and back, and is able to generate a visual review. It's not practical for finding positions, but is faster when you get them from 3ds Max or another 3D tool. You can find information on using the Wiimms KMP Tool here; it is recommended to already have some knowledge on the KMP file before attempting to use it. Batch files with simple scripts, used to encode, decode or create a visual review of KMPs with Wiimms KMP Tool are included in the script pack.
  • If you're an experienced hacker and want to look further into the KMP, such as hex editing, you can take a look at the KMP (File Format) page.
  • Some of the information contained in the KMP file is read as a floating point value and some is read as hexadecimal, so knowledge about hexadecimal numbers is important.

KMP Editing

KMP Cloud open, editing the start position of Mario Circuit.

KMP Cloud does not display any background image by default. If you're making a custom track, you can import its OBJ file in the drop down View menu to be used as a background, which can help you while editing. Wiimms KCL Tool can export a KCL file into OBJ for use here as well.

General Info

  • To move a point around, click on it and drag it. The only section that doesn't involve points is the checkpoint one, which will be discussed later.
  • In KMP Cloud, to create a point, you hold the Alt key and click or drag the mouse on the view. KMP Cloud can do four types of draw settings: dot, line, circle and follow-me. Experiment with each to see how they work. Press enter to create the points once they're placed.
  • In KMP Cloud, to rotate a point on its Y axis, set the "Edit Rotations" option on the drop down View menu.
  • When moving points, you'll notice that you can only move the dots in the X and Z axis, that means right/left and forward/backward. To change the height, which is the Y axis, you have to double-click the value in the box in the Properties window, or by right-click the point. To know what to input, you have a couple of choices:
    • Use Auto Correction Tools to fix the Y-values.
    • If you created the model in a 3D modeler: most modelers can tell the X, Y and Z coordinates of any point in the model. If you're using a 3D modeler that uses the Z axis as up (such as 3ds Max), you must invert the Y and Z axis, remembering to multiply the new Z value by -1, while converting the coordinates; (X, Y, Z) becomes (X, Z, -Y). This also applies to rotation and scale (although scale should not be negative).
    • If you're using Google SketchUp - you can discover the Y position of a point by measuring the vertical distance (the lenght of the blue axis) from that specific section to the origin plane. The lenght of a line that's currently being drawn is displayed in the lower right corner. You can also take a look at this page.
    • If you created the model using Paint, you can use the formula: (MaxY - MinY) / 255 * GrayscaleValue + MinY
      • To find the MaxY and MinY, you have to look in the box that appears in the Model Editor while only the polygon of the road is selected
    • Guess the value by yourself, by trial and error (not recommended).
  • The angles used for start, object, AREA, camera, respawn, cannon and MSPT positions' rotations start with 0 for the bottom (pointing south), and follow this setup:

    Notice that upwards (pointing north) can be either 180 or −180.

3 axes of the coordinate system

Start Position (KTPT)

KMP Cloud open, editing the start position of Mario Circuit.

This is the position where the players spawn at, before the race. In time trial, you start exactly where the point is; in races, all players spawn behind it. Move or create a dot and place it in the correct position; make sure the correct Y and rotation are set as well. You might face an underground camera bug if the Y position is too low. Make sure there is only one entry for tracks, with the Player ID set to -1 (0xFFFF). Battle arenas must have 12 points with unique Player IDs.

KTPT entries define:

Setting Name Comment
Position (X, Y, Z) The entry location.
Rotation (X, Y, Z) The entry rotation.
Player ID Only used in battles; if unsure enter -1.

There are related settings in the STGI section
→ See more information on the page: Start Position

Enemy Routes (ENPT)

KMP Cloud open in Mario Circuit's enemy routes

The routes which the CPU characters follow are set by lines of points. To edit them, you create or drag them and set the Y coordinate, but you don't need to set a rotation.

ENPT entries define:

Setting Name Comment
Position (X, Y, Z) The center of the area CPUs will reach, they always follow the order of the points.
Scale The size of the area, use a low value for narrow sections of the track and a big value for big sections.
Settings The settings for that route point. See ENPT Settings.

When the players are supposed to split in two different routes, as shown in the picture, the CPU routes are split in multiple "sections" or "groups". The order the sections are followed is set in the ENPH (Sections/Groups) section, which can be edited in KMP Cloud, KMP Modifier or generated automatically in Wiimms SZS Tools. A split in up to 6 routes is possible. Splitted routes can also be splitted again. A good way to sort and manage the sections is the KMP decoder+compiler of Wiimms SZS Tools.

Sometimes, the CPUs are only allowed to follow a specific section in certain conditions. For example, in SNES Mario Circuit 3 the path splits in two at a point, but the CPUs only follow the lower one if they have a Mushroom item.
→ See more information on the page: ENPT Settings

Sections/Groups (ENPH)

KMP Cloud open in Mario Circuit's enemy route sections

Each "Last" and "Next" column controls which sections are the previous and the next ones after the CPU finish following a part of the route. The "Last" and "Next" of each section/group must match each other.

Item Routes (ITPT)

KMP Cloud open in Mario Circuit's item routes

The routes which the Bullet Bill and the Red/Blue Shells follow are set the exact same way CPU routes are. They can be split into sections/groups and must have proper Y coordinates.

ITPT entries define:

Setting Name Comment
Position (X, Y, Z) The center of the area items will reach, they always follow the order of the points.
Scale The size of the area. This allows red shells to move away in search for their targets and you to move left and right a bit on the Bullet Bill. Use a low value for narrow sections of the track and a big value for big sections.
Settings The settings for that route point. See ITPT Settings.

→ See more information on the page: ITPT Settings

Sections/Groups (ITPH)

The Item Route sections are identical to the Enemy Route's.

Checkpoint Positions (CKPT)

Editing checkpoints

The checkpoints define the route which you and the CPUs are supposed to take to the lap can count. Just like the CPU and item routes, checkpoints can also be split into sections for places where the track splits. KMP Cloud can create checkpoints by dragging a line with Alt selected. To move a checkpoint, drag the end of the line as if it were a dot. There are no Y positions in the checkpoints. Make sure the checkpoints have the correct orientation. You can view more in-depth information on checkpoints (and how they might not be read as lines, but actually, quadrilaterals) in the Check Point page.

CKPT entries define:

Setting Name Comment
Position (Left X, Left Z, Right X, Right Z) The position of the left and right edges of the checkpoint.
Respawn It tells at which respawn point the player will appear at after falling from that checkpoint's area, check Respawn Positions for more info
Key ** 00: First checkpoint, lap counter
** FF: Normal checkpoint, only used for placement and respawn
*** 01, 02, 03 etc: Key (or mandatory) checkpoint, you must pass through each of those in order, you can't skip any of those and cross another Key checkpoint unlike the normal FF ones, use to prevent ultra shortcuts
Last and Next This ones make the checkpoints get "linked". The "last" column of the first checkpoint of each section and the "next" column of the last checkpoint must be set to -1.

Respawns can be set automatically using Wiimms Tools, by setting the @AUTO-RESPAWN flag to 1; more information on the Respawn Point page. "Last" and "Next" are set automatically in most KMP editors so there's no need to worry about these.

Some hints how to place the mandatory check points, to prevent Ultra shortcuts:

  1. Place the first mandatory check point 500-1000 units behind the lap count, so that the driver must cross both. This is the best possibility to activate the mandatory check point system and to avoid tricks to ignore them.
  2. Place the checkpoint after the last mandatory check point on a place that can't be reached without hitting another checkpoint after the start. The same counts for all other mandatory check points.
  3. Place more mandatory check point around the track. Best is to place them at the extreme points of the track. It is important the the check point covers the whole lane including offroad.

→ See more information on the page: Check Point

Sections/Groups (CKPH)

Checkpoint sections are identical to Enemy and Item Route sections.

Global Objects (GOBJ)

Object editing

Global objects are predefined objects. If a certain object ID is requested from the KMP, the object's additional files (in case they are needed) will be requested; if they are not present in the SZS or are invalid, the game will crash. The object you'll most commonly use in your track is the item box, which requires itembox.brres. Most objects need file such as BRRES, BREFF, BREFT, KCL and/or BRASD, all in their appropriate folders. See the »Object Table« for details.

GOBJ entries define:

Setting Name Comment
ID Number The unique ID (number) of the object; this defines which object will be requested. See »Object Table« for an overview or try »KMP Object Query« to search for objects. These are seen as groups in KMP Cloud.
Position (X, Y, Z) The object's position (X, Y, Z).
Rotation (X, Y, Z) The object's rotation. The object rotates around the given axes.
Scale (X, Y, Z) The object's scale, compared to the BRRES model (X, Y, Z). Some objects (e.g. item boxes) can't be scaled. Some objects will load incorrectly if scaled (such as loading a scaled model but keeping the original sized collision).
Route A route index (-1 or 0xff for no route).
Settings (1 to 8) These are all object specific. For exact settings, see the objects page.
Presence flag Presence flag.

→ If you want to search objects, try the KMP Object Query.

Routes (POTI)

Route editing

Routes are route sections, similar to Enemy or Item routes, used by either cameras, objects or by AREA to guide a moving road. Each route group/section can have any number of points.

POTI entries define:

Setting Name Comment
Position (X, Y, Z) The point's position (X, Y, Z).
Settings Two groups with two bytes of settings each. The first group defines usually a speed or time to be set on the follower for that route point. The second one depends on what's following the route.

The route's header can be edited in KMP Cloud and has settings for whether the route is followed smoothly or not and whether it's a cycle or not; these settings should be set similarly to how they are in Nintendo's tracks.

→ See more information on the pages: Object, Camera and Routes

Areas (AREA)


Areas are a 3D volume of space, with a default size of 10000x10000x10000 units. The origin is at the bottom center of the point; so, from the center, it extends to 5000 units on each positive and negative X and Z axes and 10000 units upwards on the Y axis; this is only when the scale is set to (1, 1, 1). The object can be scaled to any size and also rotated.

On the image, you can see the first AREA that is defined in the KMP of Mario Circuit, as rendered in 3ds Max. The AREA has a XYZ vertex position and a scale on the X and Z axes and is used to trigger a camera during replay. Without its scale (scaled as 1 on each axis), it's a cube with a side of 10000 units and an origin on the bottom center. The course model used for reference is a model of the KCL extracted with Wiimms SZS Tools.

Areas can serve various purposes. The most common AREA type is type 0, which refers to a camera during live, time trial or ghost replay.

AREA entries define:

Setting Name Comment
Area Mode Unknown.
Area Type More information on the AREA type page.
Area ID This ID refers to the index of a CAME (Camera) entry. If the area does not refer to a camera, this is set to -1 (0xFF).
 ? Unknown.
Position (X, Y, Z) The object's position (X, Y, Z).
Rotation (X, Y, Z) The object's rotation. The object rotates around the given axes.
Scale (X, Y, Z) The object's scale, a multiplier to the original 10000 unit cubed size.
 ? Unknown.
Route Used for AREA type 03. The first byte of this setting refers to a route index.
CPU Route Unknown.

→ See more information on the pages: AREA type and Camera.

Cameras (CAME)

→ see Cameras

Respawn Positions (JGPT)

These are the places where you are set back by Lakitu after you fall off the course. To link check points to respawn positions, use the Respawn setting in the checkpoints settings, and enter the ID of the respawn point you want (first column).

JGPT entries define:

Setting Name Comment
Position (X, Y, Z) The entry location.
Rotation (X, Y, Z) The entry rotation.
ID Unique ID, usually matches index.
Range Range.

Do not place respawn points on narrow sections of track (2500m or less), especially if there are walls or fall downs near it. This is because the game moves players to either side of the respawn point (to prevent players from colliding when more than one player is respawned at the same time), and they can become stuck in an endless respawning loop.

Do not place respawns just after a mandatory checkpoint. This way you might skip the checkpoint resulting laps not to count.
→ See more information on the page: Respawn Point.

Cannon Positions (CNPT)

These are the places where the cannon shoots you to. → see Cannon.

Ending Positions (MSPT)

After battles and competitions have ended, the players are placed on these points. This section is empty in the KMPs of normal racing tracks. Used only when making custom battle arenas and competitions.

MSPT entries define:

Setting Name Comment
Position (X, Y, Z) The entry location.
Rotation (X, Y, Z) The entry rotation.
ID Unique ID.

→ see Battle Arena for more info.

Stage Information (STGI)

The STGI section describes stage information; information about the course. "Side" and "Distance" set information about the starting position. You can view more information in the KMP page. Only the following settings are known/relevant:

Settingname Comment
Side 0: Pole position is left.
1: Pole position is right.
Distance 0: Normal distance.
1: Drivers are closer together

The STGI section is used with altered behavior, with coding, in Custom Track Distributions to allow setting of a different number of laps or a speed modifier.

Scaling and Rotating

When a course model was scaled, the position, size and perhaps rotation values in the KMP must be scaled too. These may be 1000 or more single values. Wiimms SZS Tools are able to shift, scale and rotate some or all KMP values, and also a whole track:

Visual Review

It is possible to make a Visual Review in 3D.


This is the last page of the main part of the Custom Track Tutorial. However, even if you followed the tutorials thoroughly and ran into no problems, it's unlikely that your track's already finished. There are other tutorial pages which cover additional and optional topics, which are not mandatory for your track to be playable but are useful when creating a quality track.