KMP Editing

From Custom Mario Kart
Revision as of 15:20, 28 January 2019 by Atlas (talk | contribs)
Jump to navigation Jump to search

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

Introduction

This part of the Custom Track Tutorial will explain 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) opened. 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 vice versa, 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 about using Wiimms KMP Tool here; it is recommended to already have some knowledge on the KMP file before attempting to use it.
  • If you are an experienced modder and want to look further into the KMP, for example hex editing it, 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 to 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 check point 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 perform four types of draw settings: dot, line, circle and follow-me. Experiment with each one 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 will notice that you can only move the dots on the X and Z axes, 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 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 with a 3D Tool: most modelers can tell the X, Y and Z coordinates of any point in the model. If you're using a 3D Tool that uses the Z axis as up (such as 3ds Max), you must invert the Y and Z axes, 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 are using Google SketchUp - you can discover the Y position of a point by measuring the vertical distance (the length of the blue axis) from that specific section to the origin plane. The length 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 values, 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).
Kmp-anglewheel.jpg
  • 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. On Time Trials, you start exactly where the point is; on VS 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 values 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:

KTPT
Setting Name Comment
Position (X, Y, Z) The start point's location.
Rotation (X, Y, Z) The start point's 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:

ENPT
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. Split routes can also be split again. A good way to sort and manage the sections is by using the KMP decoder+compiler from 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:

ITPT
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.

Check point Positions (CKPT)

Editing check points

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

CKPT entries define:

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

Respawn points can be set automatically by 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 about 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 check point after the last mandatory check point on a place that can't be reached without hitting another check point after the start. The same counts for all other mandatory check points.
  3. Place more mandatory check points around the track. The best way is to place them at the extreme points of the track. It is important that the check points cover the whole lane including off-road.

→ See more information on the page: Check Point.

Sections/Groups (CKPH)

Check point sections are identical to Enemy and Item Route sections.

Global Objects (GOBJ)

Object editing

Global objects are predefined course 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 probably crash. The object you will most commonly use in your track is the item box, which requires itembox.brres. Most objects need files such as BRRES, BREFF, BREFT, KCL and/or BRASD, all in their appropriate folders. See the »Object Table« page for details.

GOBJ entries define:

GOBJ
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 size's 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 AREAs to guide a moving road. Each route group/section can have any number of points.

POTI entries define:

POTI
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 usually defines a speed or time value 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 cyclic 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)

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 can be a cube with a side of 10000 units and an origin on the bottom center, or a cylinder. 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:

AREA
Setting Name Comment
Area Shape It can be either a box or a cylinder.
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).
Priority A higher number means a higher priority to choose which area activates if multiple areas are intersected.
Position (X, Y, Z) The area's position (X, Y, Z).
Rotation (X, Y, Z) The area's rotation.
Scale (X, Y, Z) The area's scale, a multiplier to the original 10000 unit size.
Settings Used for specific AREA types.
Route Used for AREA type 3. The first byte of this setting refers to a route index.
CPU Route Used by AREA type 4.

→ 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 check point settings, and enter the ID of the respawn point you want (first column).

JGPT entries define:

JGPT
Setting Name Comment
Position (X, Y, Z) The respawn point's location.
Rotation (X, Y, Z) The respawn point's rotation.
ID Unique ID, usually matches index.
Range Range.

Do not place respawn points on narrow sections of the track (2500 units 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 respawn points just after a mandatory check point. This way you might skip the check point resulting laps to not count.
→ See more information on the page: Respawn Point.

Cannon Positions (CNPT)

These are the places where the cannons shoot 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. It is only used when making custom battle arenas and competitions.

MSPT entries define:

MSPT
Setting Name Comment
Position (X, Y, Z) The ending point's location.
Rotation (X, Y, Z) The ending point's rotation.
ID Unique ID.

→ See Battle Arena for more information.

Stage Information (STGI)

This 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 relevant:

STGI
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 in Custom Track Distributions to allow settings for a different number of laps or a speed modifier.

Scaling and Rotating

When a course model is 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.

Next

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 high quality track.

Links