Difference between revisions of "KMP Editing"

From Custom Mario Kart
Jump to navigation Jump to search
m (some short things)
(Minor cleanup.)
 
(65 intermediate revisions by 20 users not shown)
Line 1: Line 1:
{{Template:Under-construction|}}
+
{{KMP}}
 +
This page is a part of the '''Custom Track Tutorial'''. [[Custom Track Tutorial|Back to the main tutorial page]].
  
[[Custom Track Tutorial|Back]]
+
== Introduction ==
 +
This part of the [[Custom Track Tutorial]] will explain all the basics of editing the [[KMP]] file.
  
This will tell you all the basics of editing the [[KMP]] file in [[SZS Modifier]]. Editing the KMP is part of making a [[custom track]], as it contains data for start position, CPU routes, object placement...
+
* 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 a few programs which can edit KMP files: [[Lorenzi's KMP Editor]] (recommended), [[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 [[wkmpt DRAW|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 [[Wiimms SZS Tools/KMP|here]]; it is recommended to already have some knowledge on the KMP file before attempting to use it.<!-- '''Download link is dead''' Batch files with simple scripts, used to encode, decode or create a visual review of KMPs with Wiimms KMP Tool are included in the [http://www.mediafire.com/file/bb30qwtrrh0ilfw/CTTutorial_WiimmsSZSTools_ScriptPack.zip script pack]. -->
 +
* 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.
  
This tutorial is covered with images from the KMP of [[The Hole Cave]], a custom track. It's good to know, for this tutorial, that the track goes in a clockwise direction when looking at the map from the editor. That track was chosen for the tutorial because of it's relatively simple design. It shares many similarities with the KMP file of N64 Bowser's Castle.
+
== KMP Editing ==
 +
[[Image:kmp1-overview.png|thumb|center|460px|KMP Cloud open, editing the start position of Mario Circuit]]
  
The [[KMP Modifier]] program is mentioned several times in this page, and it's use is to increase or decrease the amounts explained later.
+
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. [[Creating a KCL with Wiimms Tools|Wiimms KCL Tool]] can export a KCL file into OBJ to use here as well.
  
Note that the Objects section of this guide makes use of object names, not object numbers. By default, the numbers are displayed. To get the names to be displayed, you have to download and extract this XML into your SZS Modifier install directory: http://www.mediafire.com/?0tzr49x0gq51gx9
+
=== 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 [[Automated height correction|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). This conversion functionality is included in [[Blender MKW Utilities]].
 +
** If you are using [[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 [[Sort points from a list|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).
  
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.
+
[[Image:kmp-anglewheel.jpg|thumb|right|200px]]
==KMP Editing==
+
* 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:<p>Notice that upwards (pointing north) can be either 180 or −180.
 +
<br clear=all/>
 +
[[File:3-axes.png|thumb|right|200px|3 axes of the coordinate system]]
 +
*The KMP allows 3 axes with 3 [[rotation]]s:
 +
<br clear=all/>
  
[[Image:kmp1-overview.png|thumb|center|460px|The KMP editor open, editing the start position of The Hole Cave.]]
+
=== Start Position (KTPT) ===
 +
[[Image:kmp1-overview.png|thumb|right|300px|KMP Cloud open, editing the start position of Mario Circuit]]
  
The KMP editor displays an image based off from the minimap of the course, not it's actual model, so you have to create that before editing the KMP.
+
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|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 Arena (Custom Track Tutorial)|Battle arena]]s must have 12 points with unique Player IDs.
  
===General Info===
+
KTPT entries define:
 +
{|class="wikitable"
 +
|+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.
 +
|}
  
* To move a point around, click on it and drag it around. The only section that doesn't involve points is the checkpoint one, which will be discussed later.
+
There are related settings in the [[KMP Editing#Stage Information (STGI)|STGI section]]<br/>
 +
&rarr; See more information on the page: [[Start Position]].
  
* When moving points, you'll notice that you can only move the dots in the X and Z axis, that means right/left and foward/backward. To change the height, which is the Y axis, you have to double-click the value in the box in the bottom part of the window. To know what to input, you have three choices:
+
=== Enemy Routes (ENPT) ===
** Guess the value by yourself, by trial and error.
+
[[Image:kmp2-cpu.png|thumb|right|300px|KMP Cloud open in Mario Circuit's enemy routes]]
** 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
 
** 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. That doesn't apply to Google Sketchup - if you're using it, you can discover the Y position of a certain road section by drawing a simple square on top of the model, exporting it as OBJ, and looking inside the OBJ file using a text editor, where the data for positions is stored.
 
  
* 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:
+
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.
  
[[Image:kmp-anglewheel.jpg|thumb|center|200px|]]
+
ENPT entries define:
 +
{|class="wikitable"
 +
|+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]].
 +
|}
  
Notice that upwards (pointing north) can be either 180 or -180.
+
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]].
  
===Start Position===
+
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.<br/>
[[Image:kmp1-overview.png|thumb|center|600px|The KMP editor open, editing the start position of The Hole Cave.]]
+
&rarr; See more information on the page: [[ENPT Settings]].
  
This is the position where the players start at at the beginning of the race. It's rather easy to edit this, since you simply move the dot to it's position and set it's Y value and rotation (explained how above).  To prevent the [[camera under the ground bug]], change its Y value to something slightly higher than other objects directly on the track.
+
==== Sections/Groups (ENPH) ====
 +
[[Image:KMP New7 ENPH.png|thumb|right|300px|KMP Cloud open in Mario Circuit's enemy route sections]]
  
===Enemy Routes===
+
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.
The routes that the CPU characters follow are set by lines of points. To edit then, you drag then to the new position and set the Y, but you don't need to set rotation for a CPU route point. The points must be kept in the same order than the original layout, since the CPU will follow the points in order.
 
  
[[Image:kmp2-cpu.png|thumb|center|600px|The editor open in The Hole Cave's CPU routes]]
+
=== Item Routes (ITPT) ===
 +
[[Image:kmp3-item.png|thumb|right|300px|KMP Cloud open in Mario Circuit's item routes]]
  
* ID Column: Use this to know the order
+
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.
* ? Column: Unknown function
 
* Settings Column: Specific point settings
 
  
When the players are supposed to split in two different routes, as shown in the picture (where they split in two directions, near the end of the track), the cpu routes are split in multiple "Sections", as also shown in the picture. To know what order the CPU will follow all the sections, you can open the KMP file in the [[KMP Modifier]] and look.
+
ITPT entries define:
 +
{|class="wikitable"
 +
|+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]].
 +
|}
  
Sometimes, the CPU 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 CPU only follow the lower one if they have a mushroom item. What controls that is unknown, althrough it might be something in the Settings column.
+
&rarr; See more information on the page: [[ITPT Settings]].
  
===Item Routes===
+
==== Sections/Groups (ITPH) ====
The Item routes set the paths that the Bullet Bill and the Red/Blue shells will take. They have the exact same format of the CPU routes section and are edited the exact same way, so every information that applies to them apply here as well. But they are usually more complex, having more points and sections than the CPU do. That's because the CPU have an AI to help then following the routes, but the shells and bullet bill don't, so they follow the routes exactly as they are set.
+
The Item Route sections are identical to the Enemy Route's.
  
[[Image:kmp3-item.png|thumb|center|600px|The Item routes]]
+
=== Check point Positions (CKPT) ===
 +
[[Image:kmp4-check.png|thumb|right|300px|Editing check points]]
  
===Checkpoint Positions===
+
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.
The basics of editing the checkpoints are the same of editing CPU and Item routes, so most of their information also apply here. To move a checkpoint, drag the end of the line as if it was a dot. There are no Y positions in the checkpoints, so you only have to drag then to their positions. To know the correct direction of a checkpoint, tick the "Show Arrow" option. There is an option to draw a line showing which parts of the track are controlled by checkpoints and which parts aren't. Part's that aren't controlled can cause positionjumping. (Positionjumping is: you're last but for a few seconds the screen says you're 4th)
 
  
[[Image:kmp4-check.png|thumb|center|600px|The Checkpoint editor]]
+
CKPT entries define:
 +
{|class="wikitable"
 +
|+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 [[KMP Editing#Respawn Positions|Respawn Positions]] for more information.
 +
|-
 +
| Key || ** 00: First check point, lap counter<br/>** FF: Normal check point, only used for placement and respawn<br/>*** 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 Shortcut]]s.
 +
|-
 +
| 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 Column: It tells which respawn the player will appear at after falling from that checkpoint's area, check Respawn Positions for more info
+
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.
* ? Column: This is actually known:
 
** 00: First checkpoint, it makes the lap count work
 
** FF: Normal checkpoint, only used for placement and respawn
 
** 01, 02, 03 etc: Key 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 Columns: This ones make the checkpoints get "linked". When you add more sections, you have to write -1 in the "last" column of the first checkpoint and -1 in the "next" column of the last checkpoint in EVERY section you add. This is necessary and required if, for example, your track has a shortcut. If one of the checkpoints in a section is not linked to the next and the past, your track will not work; and if you select back your section and -1s appear as -127s, just write up -127 instead of -1.
 
  
===Object Positions===
+
Some hints about how to place the mandatory check points, to prevent Ultra Shortcuts:
 +
# 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.
 +
# 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.
 +
# 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.
  
This are the places the objects are, fust like goomba's or item boxe's.
+
&rarr; See more information on the page: [[Check Point]].
  
* ID: object number (0, 1, 2, ... )
+
==== Sections/Groups (CKPH) ====
* Type: which [[object]]
+
Check point sections are identical to Enemy and Item Route sections.
* Unknown: ???
 
* x, y, z: position
 
* x, y, z angle: orientation
 
* x, y, z scale: object size (1 = normal)
 
* Settings 1 to 5: depending on the object (For exact settings see the [[objects]] page)
 
  
[[File:KMP_Objects.png]]
+
=== Global Objects (GOBJ) ===
 +
[[File:KMP_Objects.png|thumb|right|300px|Object editing]]
  
===Routes===
+
[[Object|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#Object_Table|Object Table]]« page for details.
Routes are the points for Cameras and moving Objects.
 
  
===AREA===
+
GOBJ entries define:
see [[Cameras]]
+
{|class="wikitable"
 +
|+GOBJ
 +
!Setting Name !! Comment
 +
|-
 +
| ID Number || The unique ID (number) of the object; this defines which object will be requested. See »[[Object#Object_Table|Object Table]]« for an overview or try »[http://szs.wiimm.de/cgi/mkw/object 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 [[object]]s page.
 +
|-
 +
| Presence flag || [[Presence flag]].
 +
|}
  
===Cameras (CAME)===
+
&rarr; If you want to search objects, try the [http://szs.wiimm.de/cgi/mkw/object KMP Object Query].
see [[Cameras]]
 
  
===Respawn Positions===
+
=== Routes (POTI) ===
 +
[[File:KMP_New6_POTI.png|thumb|right|300px|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.
  
This are the places where you setted back when you fall of the course.
+
POTI entries define:
Use the Respawn setting in the checkpoints settings to enter the ID of the respawn point you want.
+
{|class="wikitable"
 +
|+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.
 +
|}
  
===Cannon Positions===
+
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.
This are the place where the cannon shoots you to. Use diffrent IDs for more Cannons.
 
  
===MSPT===
+
&rarr; See more information on the pages: [[Object]], [[KMP Editing/Cameras|Camera]] and [[KMP (File Format)#POTI|Routes]].
After battles and competitions have ended the players are placed on this point.
 
  
===Advanced===
+
=== Areas (AREA) ===
 +
[[Image:KMP AREA Render.png|thumb|right|300px|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:
 +
{|class="wikitable"
 +
|+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.
 +
|}
 +
 
 +
&rarr; See more information on the pages: [[AREA type]] and [[KMP Editing/Cameras|Camera]].
 +
 
 +
=== Cameras (CAME) ===
 +
&rarr; See [[KMP Editing/Cameras|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:
 +
{|class="wikitable"
 +
|+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.<br/>
 +
&rarr; See more information on the page: [[Respawn Point]].
 +
 
 +
=== Cannon Positions (CNPT) ===
 +
These are the places where the cannons shoot you to.
 +
&rarr; 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:
 +
{|class="wikitable"
 +
|+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.
 +
|}
 +
 
 +
&rarr; See [[Battle Arena (Custom Track Tutorial)|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#STGI|KMP page]]. Only the following settings are relevant:
 +
 
 +
{|class="wikitable"
 +
|+STGI
 +
!Settingname !! Comment
 +
|-
 +
| Side || 0: Pole position is left.<br/>1: Pole position is right.
 +
|-
 +
| Distance || 0: Normal distance.<br/>1: Drivers are closer together.
 +
|}
 +
 
 +
The STGI section is used with altered behavior in [[Custom Track Distribution]]s to allow settings for [[Lap & Speed Modifier|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:
 +
* [[Wiimms SZS Tools/How To#Transform KMP Values|Transform KMP Values]].
 +
* [[Track Transformation]].
 +
 
 +
=== Visual Review ===
 +
It is possible to make a [[wkmpt DRAW|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.
 +
* Go back to the [[Custom Track Tutorial#Tutorials|main tutorial page]] and search for more information.
 +
* See [[Cannon]], to know how to add cannons to your track.
 +
* See [[KMP Editing/Cameras|Cameras]], to know how to edit intro and replay cameras.
 +
* See [[Post-effects]], to know how to change post-effects.
 +
* [[Testing a Track|Test your track]].
 +
* [[Custom Track Tutorial#Crashes and Bugs|Review your track]].
  
 
== Links ==
 
== Links ==
 
{{Custom Track Tutorial}}
 
{{Custom Track Tutorial}}
[[category:Tutorials]][[category:Custom Track Tutorial]]
+
[[category:Tutorials]]
 +
[[category:Custom Track Tutorial]]

Latest revision as of 14:25, 12 May 2023

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 a few programs which can edit KMP files: Lorenzi's KMP Editor (recommended), 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). This conversion functionality is included in Blender MKW Utilities.
    • If you are using 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