Respawn Point

From Custom Mario Kart
Revision as of 03:16, 13 March 2016 by Wg93589 (talk | contribs) (→‎Step 2)
Jump to navigation Jump to search

A Respawn Point defines an area, where players restart the race after falling down. It is defined in the JGPT section of the KMP.



Introduction

If a player falls down or touch some special KCL types like a fall boundary, it must restart its race at a defined point. Also, if computer drivers can't find a way, they are respawned.

While racing, each driver enters check points defined by KMP/CKPT. Each check point supports an index into the KMP/JGPT table. This table defines list with respawn points. So the last entered check point selects the current respawn point.

12 respawn slots

12 respawn slots

An interesting aspect is: How does the Wii avoid collision conflicts, if 2 or more players are respawned at the same point at same time? The answer is very easy: There are 12 different respawn slots for each by KMP/JGPT defined respawn point.

At the beginning of the race, each player gets an unique ID. Assuming, this ID is in the range 1–12, each player is respawned at his own respawn slot. Respawn slots are defined relative to the defined respawn point using the 3D position vector and the 3D rotation vector of KMP/JGPT.

See the image at the right side: The green big point is the respawn point and the arrow its direction. The slots are placed in 3 rows and 4 columns. The slot positions are relative to the respawn point. The red and blue numbers are the distances in game units related to the black points, which are the mid points of the slots and the cyan rectangles around are the slots itself.

Respawn areas

In real, KMP/JGPT defines not respawn points, but respawn areas related to a point. A respawn area is a rectangle with about 1200*900 game units. To place the area at a slope, define an adequate 3D rotation vector. The respawn slots must be at the same height as the road or higher; up to 200 game units are good and usual.

Tips for placing respawn points

  • Place respawn points around the whole course. Don't assume that it's impossible to fall off at a certain point; this will be proven wrong and quicker than you would think. Mushrooms, Stars and Bullet Bills can throw you very high and wide. KCL bugs can do the same, as well as KCL holes.
  • Link all respawn points by the KMP/CKPT points.
  • Don't place respawn points near walls or other barriers, because of the respawn areas with 1200*900 units.
  • Make sure that the horizontal direction is set correctly. This is especially important for the CPU racers. If using Wiimms SZS Tools, give the snap feature[1] a try.
  • Never place a respawn point outside the course. If there are unused respawn points, delete them. However, if you absolutely must keep them, set them over the track.
  • It is important that mandatory checkpoints respawn the driver before the checkpoint, so that the driver must enter the check quadrilateral again.

Automatic setup of Respawn points

Since v1.46a, Wiimms SZS Tools has supported automatically setting up Respawn points.[2]. This section of the tutorial will teach you how to do this.

Preparation

To automatically set up your Respawn points you'll need:

  • Your Course's KMP file (with proper Enemy and/or Item route(s) and Checkpoints)
  • Wiimm's SZS Tools (v1.46a or higher)
  • A text editor

Step 1

Place your course.kmp file into a place where Wiimm's SZS Tools can find it.
After that run this command:

WKMPT decode course.kmp -o

Step 2

Go to where you put your course.kmp file and find a file called course.txt.
Once inside the course.txt there are a few things that need to be changed:
Find the Checkpoint Section [CKPT] make sure these two settings look like this:

@AUTO-RESPAWN = 1
@AUTO-NEXT    = 1

Next find the Respawn point Section [JGPT] and set the settings to look like this

@AUTO-DISTANCE	= 1000.0
@AUTO-ADJUST	= vy(1)
@AUTO-REMOVE	= 2

@AUTO-DEFINE can be this:

@AUTO-DEFINE	= SECT$ENPT

or this:

@AUTO-DEFINE	= SECT$ITPT

SECT$ENPT means the Respawns will follow the Enemy route(s) and SECT$ITPT means the Respawns will follow the Item route(s)

Step 3

After all the necessary changes have been made save the course.txt and run this command:

WKMPT encode course.txt -o

After Wiimm's SZS Tools has finished compiling the KMP open it to make sure that the Respawns were created, that their Y values are correct and that they are linked to the Checkpoints. If all of this happened then you have successfully defined your Respawns.

Links

Wiiki
References
  1. Wiimms SZS Tools: KMP/JGPT, @HSNAP-TO-ENPT, @SNAP-TO-ENPT and @SNAP2-TO-ENPT
  2. Wiimms SZS Tools: Initial setup of respawn points