Difference between revisions of "Object Editing"

From Custom Mario Kart
Jump to navigation Jump to search
(→‎Porting Objects: funny mistake.)
Line 69: Line 69:
  
 
==Porting Objects==
 
==Porting Objects==
For example, if you want to place a Thwomp in a track that's based off from GCN Mario Circuit, you must port the Thwomp model into the level.  You can't simply place a dossunc (object for the Twhomp) in the [[KMP]] and expect it to work.
+
For example, if you want to place a Thwomp in a track that's based off from GCN Mario Circuit, you must port the Thwomp model into the level.  You can't simply place a dossunc (object for the Thwomp) in the [[KMP]] and expect it to work.
  
 
You must put the all files needed for that object (usually a just a BRRES, but sometimes effect and brasd files are required) into your track's SZS file. Doing this requires either the [[CTools Pack#SZS Explorer|SZS Explorer]] or the [[Wiimms SZS Tools]].
 
You must put the all files needed for that object (usually a just a BRRES, but sometimes effect and brasd files are required) into your track's SZS file. Doing this requires either the [[CTools Pack#SZS Explorer|SZS Explorer]] or the [[Wiimms SZS Tools]].

Revision as of 03:47, 14 July 2013

Introduction

This page covers some important, but short and optional Custom Track topics. Move on to the KMP Editing tutorial when you're ready.

Creating a Cannon

*KMP Modifier might be required*

Cannons are triggers that make your vehicle fly any distance in any direction, to any location of the track. They are present in every Mario Kart game except for the SNES and GBA editions. In Mario Kart Wii they appear in DK Summit/Snowboard Cross, Maple Treeway, Rainbow Road, N64 DK's Jungle Parkway and GCN DK Mountain. They also appear in a variety of custom tracks; altough Cannon City is a track dedicated specially for cannons, the one with the biggest number of them is Jungle Island.

Cannons are composed of three diferent parts: The KCL trigger location, the KMP destination point and the optional object used to represent the cannon as seen ingame. The three must be linked properly for the cannon to work.

KCL trigger location

Now, you'll need to set up a KCL collision flag to refer to each destination point. This means that once this location is touched in the KCL, it will activate your cannon. For each cannon your track has, you need one KCL polygon that is the trigger. This is probably the most exausting part of creating a cannon, since you need to place your triggers in the KCL model, and a new KCL has to be generated for every change on the trigger areas. More about these KCL locations is explained in the Solidity tutorial. Once this KCL area is touched, the cannon activates and you are taken to the destination point. The KCL flag used in those polygons is 0x11 (cannon trigger). It is recommended that the cannon triggers are squares that cover the entire end of the road, but any shape can be used.

For tracks with multiple cannons: to set which cannon point each KCL polygon will lead to, they must have set KCL flag variants. Each cannon point in the KMP has a set ID, starting with 000 for the first point, 001 for the second, etc. The KCL polygon variant must be matched with this KMP ID. There's no need to worry about this if your track has only one cannon.

Object (optional)

In some courses, a Launch Star (Rainbow Road) or DK Barrel (other courses) is used to represent a cannon. These objects are not needed for the cannon to actually work, and are there just for the sights. Place them in the location of the cannon trigger. It doesn't need to be very precise, but you can experiment with the object's location. If your base track doesn't have a cannon object, you can learn how to port one in the Porting Objects section of this tutorial.

Setting up the location of the KMP destination point

This is simple; just place the point in the location where you want the cannon to drop you off at.

(Comically?) determining the angle of the Rainbow Road cannon with a protractor on the screen (well, it's faster than downloading a program just for that)

Sometimes, it is also needed to set up rotation values for each KMP cannon point. If the cannon is following the track's map either north or south (in the X axis) there is no need for any cannon point rotation. If there is any angle other than 0º or 180º made between the cannon trigger and the destination point, this angle must be set in the Y angle value. You can use a protractor to measure the angle, try to make an educated guess or calculate the angle based on the position of the cannon triggers and destination points.

More exact is to calculate the y-rotation. If POS is the cannon position and DEST the cannon destination, do the following calculations. You can get POS and DEST with any KMP tool (perhaps moving temporary a point to the cannon trigger position).

// first: get the distance for the X and Z axis:
dx = DEST.x - POS.x
dz = DEST.z - POS.z

// If function atan2() is available:
y_rotation = atan2(dx,dz)

// Alternatively you can use the base atan() function,
// but you must determine the sign by yourself:
if ( dz == 0 )
   y_rotation =  90 (or 'π/2' if calculating in rad)
else
   y_rotation = atan(dx/dz)

// If the result is in radiant, 
// multiply it by (180.0/π) to get degree.
y_rotation_degree = y_rotation_rad * 180.0 / π

Setting up X and Z angles is usually not needed, since cannons are usually straight lines leading you upwards and a certain distance from the trigger. X or Z rotation might be needed in case you're making a cannon that shoots the player downwards.

Now your cannon should be fully functional!

Extra Info

  • The first cannon (whether there is one or more) must use 000 as a KMP point ID and KCL flag variant.
  • If you are using multiple cannons, each cannon ID must use a number starting at 000 and progressing as 001, 002, 003 etc on each additional cannon.
  • The settings in the "?" section of the KMP cannon point set the type of the cannon.
    • FFFF - fast, straight line (most normal cannons)
    • 0001 - curved (N64DKJP)
    • 0002 - similar to above (used in the custom track Desert Cross)
    • 0003 - slow (unused, goes about 1/10 or 1/15 of the normal speed)
  • The sound of the cannon is sometimes slot-specific (N64DKJP), sometimes generated by the cannon object (Maple Treeway) and sometimes both (Rainbow Road). It might also be generated by a normal KCL-based sound trigger.

Editing Objects

To change the texturing of an Object, open the BRRES file and import a new texture. The model itself can also be changed, however this may be glitchy in some objects (specially animated ones). Create a new model with your modeling program, and import the new model, preferably with SZS Explorer to keep the original texture animations. Custom Objects must use the name of a normal Mario Kart Wii object. Make sure that the name of the MDL0 file (the file that contains the model of the object, inside the BRRES) keeps the same name of the original object.

Porting Objects

For example, if you want to place a Thwomp in a track that's based off from GCN Mario Circuit, you must port the Thwomp model into the level. You can't simply place a dossunc (object for the Thwomp) in the KMP and expect it to work.

You must put the all files needed for that object (usually a just a BRRES, but sometimes effect and brasd files are required) into your track's SZS file. Doing this requires either the SZS Explorer or the Wiimms SZS Tools.

SZS Explorer

How to port an object, using the Goomba object as an example.

  • Open both course files (the course with the object you want to move, and the destination course) with two SZS Explorer windows.
  • Export the files for the Goomba from a course that contains Goombas. The required files are kuribo.brres and the kuribo folder (along with the two files contained in the folder) in the brasd folder. Right click the files and choose Export.
  • Import the files into the new SZS file. Right click the root folder and import kuribo.brres into it, and right click into the brasd folder and import the kuribo folder into it. The imported files must be in the same places as in the original course. If there isn't a brasd folder in your new course file, right click the root and create one.

To use the Goomba in your course, you will need to add a Goomba to your KMP and assign it a route.

  • To make and assign a route, create your route that you want your object to take with any KMP Editor. Make sure it has the correct Y-value. You can use Automated height correction tools to help correct this value. Once done, go to the object and to assign the route, go to the route column and type in your Route number. (i.e: My route is 12. I type in the route section of my object "0012".) (If you have a one-digit route like 9 or 1, type 000X. X stands for the route number.) Make sure that the object is placed at the same X, Y, and Z coordinates as the route. In the "Setting 2" column, set the speed for the object or it will not move. 0020 seems to be a decent value for the Kuribo object. Different objects use different files - some objects use stuff in the effect folder, some use multiple BRRES files, some use KCL files, and some don't have BRRES files, such as fireworks.

Porting skydome models, map models, course models, KCLs and KMPs is the same proccess: you export it from the original course, and you replace it in the new course. The best KCLs to use are Koopa Cape's and Maple Treeway's and the best map_model.brres to use is Mushroom Gorge's. The KMP to use varies depending on the track you want to make, some people say that the N64 Bowser Castle one it the best.

Wiimms SZS Tools

Assume, we have 2 SZS files called SOURCE.szs and DEST.szs in the current directory. We plan to copy some objects from source to dest:

  1. Extract the files of both SZS files:
    wszst extract SOURCE.szs DEST.szs
    Now we have to new directories: SOURCE.d and DEST.d
  2. Copy the objects from SOURCE.d to DEST.d with a file browser of your choice. Be sure to use the same sub directories.
  3. Create a new destination file:
    If you want to overwrite the old DEST.szs use:
    wszst create DEST.d --overwrite
    If you want to crate a new SZS file use:
    wszst create DEST.d --dest NEW.szs
  4. If is possible to compare the SZS files on sub file level:
    wszst diff DEST.szs NEW.szs
References

Changing Post Effects

Post effects are meant to simulate the natural environment of the world. There are post effects to make courses look snowy, desert-like, very hot, etc. For example, if you decide to change a daytime course like Luigi Circuit so that it appears to be night time but don't edit the post effects, the course will still look bright and your characters will still seem to be in the sun, even if the level has been given a night-time sky. You must change post effects for lightning to be correct.

Swapping Post Effects

To change post effects, you simply export them from one course's file and import them into another, using SZS Explorer or Wiimms SZS Tools, the same as you would do with object files. Post effects, unsurprisingly, are found in the posteffects folder.

  • BBLM files - Glow, bloom
  • BDOF files - Focus, Sharpness and blur
  • BFG files - Fog
  • BLIGHT files - Lighting
  • BLMAP files - Post effect controller
  • ***1 files - Used for multiple post effects in the same course. Mushroom Gorge, for example, has post effect data for inside and outside the cave.

Editing Post Effect Files

A view of SZS Explorer's Hex Editor window with the Edit Menu displayed.

Currently the only method to edit post effect files is by Hex Editing. It is possible to find attributes by experimentally changing various hex values and then testing them in-game. The following attributes are currently known:

Fog

First you will need a posteffect.bfg file in your level; if there isn't one in the posteffect folder, import it from another level. You will want to find fog that already has the desired intensity because color is the only attribute currently known. Using SZS Explorer, open the file. Select Goto from the Edit Menu. Search for offset 0x0C. Then select Overwrite Mode to enable editing. The color is 4 bytes long and is in RR GG BB AA format; alpha is ignored. Intense red fog, for example, would have the value FF 00 00 00. The fog intensity is stored at 0x08 (also 4 bytes long), however its specific settings are unknown.

Lighting

Posteffect.blight in CTools Hex Editor

Open your posteffect.blight file in the posteffect folder with the Hex Editor Hex Editor and search for the magic LOBJ. The first LOBJ object is the normal road, so go to the next. The second object is the shadow. Go to the next LOBJ. Then activate this Object in your KMP, make a note of the ID, and change the RGBA light color. In this example, we want green lighting, so change it to the value 00 FF 00 FF. The alpha value is most likely ignored on lighting as well.

You activate the lighting effect by assigning the corresponding ID to a KCL flag. Three values after the activator you see the ID which is used.