Solidity

From Custom Mario Kart
Revision as of 17:20, 9 October 2011 by Jefe (talk | contribs) (clarifications)
Jump to navigation Jump to search

General Info

The KCL file contains all the solidity info, as well as event triggers that trigger when touched by a vehicle, item, or object. For example, driveable roads are stored within KCL files, as well as fall boundaries that cause you to respawn (which should be triggered by falling off the track or into a hazard). Cannon triggers are also found here. More simply put, the BRRES model is just for sights while all the info about being able to touch stuff in-game is stored in the KCL file.

Making a Collision Model

File:CollisionImage-RegularCourseModel.jpg
A house on Rooster Island. This is the course_model version of the model, so the house is displayed in full detail. The flower beds are raised, which would normally collide with the player.
The house has been simplified in the collision model. The chimney, trim and upper windows have been deleted. The lower windows and door now have the same 'wall' texture as the sides of the house. A blue 'fall' texture has been applied to the to top; players will be respawned if they somehow get up there. The flowerbed has been lowered to the same level as the surrounding surfaces to allow driving through the flowerbed.

A separate collision model provides several potential benefits.

  • It can help prevent super short cuts and other glitches by putting in invisible walls and fall boundaries.
  • If your level has any complex geometry that can't or seldom will be touched by karts, this geometry can be deleted or simplified providing a potential in-game frame rate increase.
  • You can use fewer textures when setting up your KCL, saving time.
  • It can reduce or prevent potential errors when creating your KCL.

To create a collision model in Google SketchUp, first make a copy of your SketchUp file, making sure not to overwrite the old one. Change the textures within the new SketchUp file so that each texture represents a different solidity type and variant. (You can right click any surface and 'select all with same material' then use the paint bucket to replace the texture.) Don't worry about the looks here as you will not be loading this file in-game, it will simply be used for KCL generation. If your level has multiple drivable layers, make sure to make a group of all the walls and move their tops down just a tiny bit, to prevent against wall glitches in-game (which cause your vehicle to strike an invisible boundary on a road which has a wall below it.) You can delete a lot of background geometry in your collision file, just set up simple polygons nearby with a texture you want to use for out-of-bounds or solid fall. Explode all groups and components before exporting. In the Materials browser, textures that are considered to be in use will appear in the "In Model" section. Delete any textures that you have otherwise removed.

Remember that if you make a change to any solid part in your main model, you will need to make a corresponding change in your collision model too. Select all the faces and edges that you've changed in the course model file, copy, open the collision model, then select 'Paste in Place' from the edit menu. Don't forget to delete the old surfaces you are replacing.

If you are using 3DS Max you can rename polygons with ease, so it's recommended to name them to the value you want to give it, than you don't have to write it down/remember it. When using SketchUp, you should give textures descriptive names, similar to the solidity value you want to give them. This step isn't completely necessary, but can help you avoid confusion. (To rename textures in SketchUp, open the Materials browser and select the texture you want to change. Above the list of textures it will show the file name. Simply type in a new one.)

Once you are done editing your collision model, export the OBJ as normal. Open the BRRES editor and import the file with the course_model option selected. Save the file with a name like course_model_solidity.brres. Import the BRRES into your SZS with SZS Explorer and save (you do not have to overwrite the normal course_model.) Open the SZS file in the SZS Modifier and follow the rest of this tutorial. Delete the collision model from your SZS after you're done generating the KCL.

Generating a KCL

CT Tools

File:Soliditykh.png
Replacing the old course.kcl

Currently, KCL files created with the CTools KCL Editor are unusable as the road will be very bouncy if you use them, or the tool will otherwise fail in the creation process. MrBean35000vr believes the bounciness issue is caused by the grid generated being too small. You can use the CTools KCL Editor to create expanded KCL files, but you can't create a new KCL from scratch here; you will need to use the SZS Modifier's KCL Editor to patch an existing file with proper solidity. To access this editor, right click on your course.kcl in SZS Explorer, and choose "Open with" > "KCL Editor." You will need to import an OBJ file of your level to use this editor.

SZS Modifier

File:Solidity2kh.png
Generating a new course.kcl in SZS Modifier's KCL Editor

First you will need to import a large KCL file into your SZS. You can export the course.kcl from Maple Treeway (treehouse_course), take one that you generated with CTools, or use one from another custom track. Large KCL files are less likely to encounter a 'too complex' error. If you are using CTools to generate the initial KCL, add some extra geometry to your model (or use your normal course model if you have an optimized collision model) since SZS Modifier will typically generate a larger KCL than CTools but can not expand the KCL on its own. Replace the KCL in your SZS with this larger KCL.

Next, open your course_model.brres with SZS Modifier. If you have imported a separate collision model, open that BRRES file instead. Make sure that you're not opening the course.kcl in SZS Modifier, just the actual BRRES.

Select "Create KCL" under the Tools menu, and choose the solidity types you want for each texture. A list of solidity types and what they all do can be found in the KCL flags article.