Difference between revisions of "Solidity"

From Custom Mario Kart
Jump to navigation Jump to search
m
Line 1: Line 1:
==Introduction==
+
This page is a part of the '''Custom Track Tutorial'''. [[Custom Track Tutorial|Back to the main tutorial page]].
 +
 
 +
== Introduction ==
 
The [[KCL]] file contains all the solidity information of a track, as well as event triggers that trigger when touched by a vehicle, item, or object. For example, drivable 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 information about being able to touch stuff in-game is stored in the KCL file. This tutorial covers the how to create a collision model and how to generate a KCL file.
 
The [[KCL]] file contains all the solidity information of a track, as well as event triggers that trigger when touched by a vehicle, item, or object. For example, drivable 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 information about being able to touch stuff in-game is stored in the KCL file. This tutorial covers the how to create a collision model and how to generate a KCL file.
  
==Collision Models==
+
== Collision Models ==
====Benefits====
+
==== Benefits ====
 
[[File:CollisionImage-RegularCourseModel.jpg|200px|thumb|A house on the [[Rooster Island]] model. This is the regular version of the model, so the house is displayed in full detail.]]
 
[[File:CollisionImage-RegularCourseModel.jpg|200px|thumb|A house on the [[Rooster Island]] model. This is the regular version of the model, so the house is displayed in full detail.]]
 
[[File:CollisionImage-OptimizedCollision.jpg|200px|thumb|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. To enable driving through the flowerbed, the flower surface has been lowered.]]
 
[[File:CollisionImage-OptimizedCollision.jpg|200px|thumb|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. To enable driving through the flowerbed, the flower surface has been lowered.]]
Line 13: Line 15:
 
*If your level has any complex geometry that can't or seldom will be touched by karts, this geometry can be deleted or simplified. This will reduce the likelihood of errors that will prevent you from successfully generating a [[KCL]].
 
*If your level has any complex geometry that can't or seldom will be touched by karts, this geometry can be deleted or simplified. This will reduce the likelihood of errors that will prevent you from successfully generating a [[KCL]].
 
*You can use fewer textures when setting up your KCL, saving time.
 
*You can use fewer textures when setting up your KCL, saving time.
*Simplifying collision can help prevent lag, FPS drops and other issues caused by the game making complex calculations when objects collide and replicating the results to players.  
+
*Simplifying collision can help prevent lag, FPS drops and other issues caused by the game making complex calculations when objects collide and replicating the results to players.
  
 +
Some [[Custom Tracks]] such as [[F Boats]] and [[Hot Shelter]] have, on their pages, download links for models which were used while creating the tracks; with KCL models included. You can view those on SketchUp and compare them to the normal models to see the differences.
  
====Making a Collision Model====
+
==== Making a Collision Model ====
 
To create a collision model in [[SketchUp|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 [[KCL flag|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 of your collision model. You will not be loading this file in-game, it will simply be used for KCL generation).
 
To create a collision model in [[SketchUp|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 [[KCL flag|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 of your collision model. You will not be loading this file in-game, it will simply be used for KCL generation).
  
Line 27: Line 30:
 
[[File:Lower edges for collision model in sketchup.jpg|200px|thumb|Easy methods to lower edges.]]
 
[[File:Lower edges for collision model in sketchup.jpg|200px|thumb|Easy methods to lower edges.]]
  
If your level has any walls that are directly underneath or bordering other drivable surfaces, you might need to move the top edges of those surfaces downward at least 100 meters. This will prevent vehicles from striking an invisible boundary when driving on the surfaces above those walls. Click the image to the right for some tips. If using [[Wiimms SZS Tools]] for KCL creation, then you can use the [[KCL Tutorial (Wiimms Tools)#Lower walls|''lower walls'' script]] instead.
+
If your level has any walls that are directly underneath or bordering other drivable surfaces, you might need to move the top edges of those surfaces downward at least 100 meters. This will prevent vehicles from striking an invisible boundary when driving on the surfaces above those walls. Click the image to the right for some tips. If using [[Wiimms SZS Tools]] for KCL creation, then you can use the [[KCL Tutorial (Wiimms Tools)#Lower walls|''lower walls'' script]] instead. You only need to do this if, after testing, you notice this problem happen; otherwise, there's no need to worry about this.
  
 
To create surfaces that can be moved through, such as clouds, water or small plants, simply delete the corresponding surfaces from your model.
 
To create surfaces that can be moved through, such as clouds, water or small plants, simply delete the corresponding surfaces from your model.
Line 33: Line 36:
 
Once you are done editing your collision model, export the OBJ as normal. Don't forget to explode all groups and components before exporting.
 
Once you are done editing your collision model, export the OBJ as normal. Don't forget to explode all groups and components before exporting.
  
==Generating a KCL==
+
== Generating a KCL ==
There are currently 3 programs which can generate KCL files from your optimized OBJ model. [[Wiimms SZS Tools#wkclt (Wiimms KCL Tool)|'''wkclt''' of Wiimms SZS Tools]] is the recommended method. [[CTools_Pack#KCL_editor|CTools KCL Editor]] cannot be used on its own as it does not generate useable KCLs. [[SZS Modifier]] can be used by itself or in conjunction with CTools, as you can also read further below.
 
 
 
{| class="textbox grid"
 
|-
 
! Program !! Advantages !! Disadvantages
 
|-
 
| [[Wiimms SZS Tools#wkclt (Wiimms KCL Tool)|'''wkclt''' of<br/> Wiimms SZS Tools]]
 
|
 
* Creates good KCL files directly from the OBJ.
 
* Creates KCL files of any size.
 
* Allow [[Track Transformation|transformations]] (scale, [[Rotation|rotate]], shift) while creating the KCL.
 
* Can use scripts for batch and faster creation of new KCLs.
 
* Automatic [[KCL Tutorial (Wiimms Tools)#Lower walls|lowering of walls]].
 
|
 
* Command line tool might be unfamiliar to some users.
 
|-
 
| [[CTools_Pack#KCL_editor|CTools KCL Editor]]
 
|
 
* Creates KCL files of any size.
 
| style="background-color: #ffe0e0" |
 
* Created KCL is unusable!
 
|-
 
| [[SZS Modifier]]
 
| &mdash;
 
|
 
* Can't create new KCLs, only overwrite existing ones.
 
* Can't create KCLs bigger than the existing ones.
 
|}
 
 
 
==== Wiimms SZS Tools ====
 
 
Currently, the best method to create KCL is to use the '''wkclt''' tool of [[Wiimms SZS Tools]]. It creates an optimized KCL file directly from the exported OBJ file, without needing a previous one. It's also possible to export the KCL back into OBJ or to write small scripts to modify positions or the KCL flags in an algorithmic way. Follow the tutorial on the [[KCL Tutorial (Wiimms Tools)]] page.
 
Currently, the best method to create KCL is to use the '''wkclt''' tool of [[Wiimms SZS Tools]]. It creates an optimized KCL file directly from the exported OBJ file, without needing a previous one. It's also possible to export the KCL back into OBJ or to write small scripts to modify positions or the KCL flags in an algorithmic way. Follow the tutorial on the [[KCL Tutorial (Wiimms Tools)]] page.
  
==== CTools and/or SZS Modifier ====
+
==== CTools and SZS Modifier ====
This method of creating KCL files can be used if you don't want to use [[Wiimms SZS Tools]], but is less efficient, takes significantly longer and might generate a KCL with problems or might not even create the KCL at all. Follow the tutorial on the [[KCL Tutorial (CTools and SZS Modifier)]] page.
+
This method of creating KCL files can be used if you don't want to use [[Wiimms SZS Tools]], but is not recommended as it is less efficient, takes significantly longer and might generate a KCL with problems or might not even create the KCL at all. Follow the tutorial on the [[KCL Tutorial (CTools and SZS Modifier)]] page.
  
==What's Next?==
+
== Next ==
Once you've followed one of the above tutorials and generated your KCL file, your level is almost ready to be driven on. The next step is to create a [[KMP]] to find out where to position the player start, item boxes, enemy routes and other objects.
+
Once you've followed one of the above tutorials and generated your KCL file, your level is almost ready to be driven on. The next step is to create a [[KMP Editing|KMP]] to find out where to position the player start, item boxes, enemy routes and other objects.
  
 
{{Custom Track Tutorial}}
 
{{Custom Track Tutorial}}
 
[[Category:Tutorials]][[Category:Custom Track Tutorial]]
 
[[Category:Tutorials]][[Category:Custom Track Tutorial]]

Revision as of 04:50, 8 November 2016

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

Introduction

The KCL file contains all the solidity information of a track, as well as event triggers that trigger when touched by a vehicle, item, or object. For example, drivable 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 information about being able to touch stuff in-game is stored in the KCL file. This tutorial covers the how to create a collision model and how to generate a KCL file.

Collision Models

Benefits

File:CollisionImage-RegularCourseModel.jpg
A house on the Rooster Island model. This is the regular version of the model, so the house is displayed in full detail.
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. To enable driving through the flowerbed, the flower surface has been lowered.

A separate collision model provides several potential benefits:

  • It can help prevent super shortcuts and other glitches by putting in invisible walls and fall boundaries, or removing troublesome surfaces.
  • You can fix problems like hitting edges that are below roads.
  • If your level has any complex geometry that can't or seldom will be touched by karts, this geometry can be deleted or simplified. This will reduce the likelihood of errors that will prevent you from successfully generating a KCL.
  • You can use fewer textures when setting up your KCL, saving time.
  • Simplifying collision can help prevent lag, FPS drops and other issues caused by the game making complex calculations when objects collide and replicating the results to players.

Some Custom Tracks such as F Boats and Hot Shelter have, on their pages, download links for models which were used while creating the tracks; with KCL models included. You can view those on SketchUp and compare them to the normal models to see the differences.

Making a Collision Model

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 of your collision model. You will not be loading this file in-game, it will simply be used for KCL generation).

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 material's name. Simply type in a new one (tip: It's a good idea to change texture names before making the collision file). It can be helpful to change the colors of textures on your collision model so you can easily identify each type of collision surface. This can be done easily by double-clicking any texture in the Materials Browser window, then adjusting the color options for that texture. To reset a texture's color, simply click reset color.

You can delete a lot of background geometry in your collision file. You can set up simple polygons nearby with a texture you want to use for out-of-bounds or solid fall, so that players will respawn before hitting the deleted surfaces. Similarly, the upper parts of features that can be collided with, such as lamp posts, trees, and buildings, can be replaced with simpler surfaces and assigned a "wall" texture. 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.

If you are using a different 3D editor, the principles are the same. If you are using 3ds Max you can rename polygons, so it's recommended to give them descriptive names as well.

Easy methods to lower edges.

If your level has any walls that are directly underneath or bordering other drivable surfaces, you might need to move the top edges of those surfaces downward at least 100 meters. This will prevent vehicles from striking an invisible boundary when driving on the surfaces above those walls. Click the image to the right for some tips. If using Wiimms SZS Tools for KCL creation, then you can use the lower walls script instead. You only need to do this if, after testing, you notice this problem happen; otherwise, there's no need to worry about this.

To create surfaces that can be moved through, such as clouds, water or small plants, simply delete the corresponding surfaces from your model.

Once you are done editing your collision model, export the OBJ as normal. Don't forget to explode all groups and components before exporting.

Generating a KCL

Currently, the best method to create KCL is to use the wkclt tool of Wiimms SZS Tools. It creates an optimized KCL file directly from the exported OBJ file, without needing a previous one. It's also possible to export the KCL back into OBJ or to write small scripts to modify positions or the KCL flags in an algorithmic way. Follow the tutorial on the KCL Tutorial (Wiimms Tools) page.

CTools and SZS Modifier

This method of creating KCL files can be used if you don't want to use Wiimms SZS Tools, but is not recommended as it is less efficient, takes significantly longer and might generate a KCL with problems or might not even create the KCL at all. Follow the tutorial on the KCL Tutorial (CTools and SZS Modifier) page.

Next

Once you've followed one of the above tutorials and generated your KCL file, your level is almost ready to be driven on. The next step is to create a KMP to find out where to position the player start, item boxes, enemy routes and other objects.