Slow Motion Bug

From Custom Mario Kart
Revision as of 21:28, 25 February 2014 by Zilly (talk | contribs) (proofread / if you hate the example layout, change it)
Jump to navigation Jump to search

Overview

Like a PC, the Wii is a computer system with a set amount of memory (RAM), CPU power, and GPU power. When it does not have enough CPU power to calculate what is rendered on screen, the action on screen (the frames per second or FPS) can slow down dramatically. The "Slow Motion Bug" can be caused many factors including:

  • Model complexity (very likely)
  • The number of Objects rendered on screen (very likely)
  • Hi-res textures (unlikely): this was tested with 6.26 MB of textures, which led to no real difference. A 18 MB texture folder crashed the game.
  • Large quantity of textures (likely, because this generally means the model has many unique polygons)

It really isn't a bug in the traditional sense, but a symptom of poor optimization and can indicate that the track author did not test the level thoroughly before release.

Different types of slowdown will become more noticeable when playing different game modes.

Six King Labyrinth Slow Motion Bug

Fixing the Problem

There are three major things that may slow down a Custom Track. The first and most common problem is a model that is too complex. Here are some ways a model can be overly complex:

  • Model is too geometrically complex (vertices, faces, facepoints).
  • Model uses too many draw calls.
  • Textures are too large.

You can find problem areas by looking at your model in the SZS Modifier with the wireframe view option enabled. To optimize your model, delete as many unnecessary lines/faces/textures in your model as you can. Simplify curves on your model by deleting intermediate lines on the curved surface. If you are using SketchUp to create your model, DO NOT explode all components and curves. Note that some components may cause duplicated textures to appear in your model's BRRES file, increasing its memory footprint, and should be removed. Likewise, check the mtl file for "#Distorted Textures." These are twisted or skewed copies of textures used in your level, usually used on a single face of the model. Reset the alignment of these textures on your model and re-export to eliminate the distorted duplicates. You can find the locations of these textures on your model by replacing the distorted texture with a brightly colored texture, such as lime green or neon orange, then loading the model in-game or in the BRRES Editor. It is recommended to use the 3ds Max .dae exporter and BrawlBox to import your model.

Reducing the resolution of textures can also help. For example, the area of a single 1024*1024 texture is equal to the area of 16 256x256 textures. The difference in-game between a hi-res texture and a low-res texture is often small enough to not be noticeable.

Additionally, creating a simplified collision model, separate from the course model, removes the need to include extra collision data within the course model.

If these steps only partially solve your problem, than your level might have too many items.

This may be caused by:

  • Too many objects in the KMP.
  • Too many items in play on the field.
  • Unused objects that are still rendered.
  • Objects with model animations set to display in all game modes.

The easy solution would be to remove all unnecessary items from the KMP.

A dirty SZS can also contribute to slow FPS. This means is that the SZS has unnecessary files that are not being used in the level. These files are still loaded in memory even if they don't appear in-game.

To fix this, open up the SZS CTools, right click unnecessary items, and press "Delete".

Some items should only appear in single player mode, such as animated characters like piantas, flowers, and shy guy groups. In SZS Modifier's KMP Editor the final box will have a value like 0000003F. 3F means that object will appear in all game modes. Change it to 00000009 to disable those objects in split screen modes.

Reducing the Number of Faces

More faces than needed

Most custom tracks define faces from both sides. But for nearly all of the drivable faces (road, offroad, boost, water and some more) only face up triangles are needed. So the first possibility to reduce the number of faces is to remove all drivable face down triangles. In the the example on the right this may save 41 of the 82 triangles (90 triangles total).

Using face down roads has also another negative effect: If jumping down to the road the player touches sometimes the face down triangle and the vehicle will drive head down for a moment into a complete wrong direction. So it is a obligation to remove the face down triangles of drivable KCL types. Not only roads, but also walls are candidate for removing triangles.

The general rules are
  • Remove triangles (faces) that can never be seen. Do this for the visual model and also for the KCL.
  • Remove triangles from the KCL that can never reached.

You can save much more triangles if you think 3D. See the the 3 picture at the right: green is grass, blue the road, yellow are boost and brown a small hill. In the first picture you see, that 49 triangles are used. It's because the developer thinks only in 2D and lays all triangles side by side.


Much less triangles

And now let's take a look, how Nintendo did it for the newer tracks. They think 3D and define the grass level with only 2 triangles. Then they place a street 2-4 units higher and use again only a few triangles. And in a third level they place the boost parts. And the hill is also placed in the grass and may go below the grass.


A 3D view

In the third picture you see a schematic 3D view of the second one. Watch out the black shadows. In the first picture 49 face up triangles are used and in the two others pictures only 19; this saves 61% triangles in this example. Nintendo raises the above levels about 2-4 units (100 units in this demonstration).


Improving old KCL files

Between the time of the SZS Modifier's KCL Editor and Wiimm's KCL Tool, people used workarounds to generate a bigger KCL than the ones from original game files. After Chadderz send Tock a Beta version of his own KCL Editor, Tock was able to create a 3.29 MB sized KCL by importing the raw Model of GCN Sherbet Land twice. This has helped many people to create KCLs easier for their own Custom Tracks. Sadly, this means the SZS nowadays is blown up by much unused data. This can be fixed by simply decoding the KCL to a .obj file with Wiimms KCL Tool and re-encoding it to a KCL. The KCL files from Tock's old GCN Sherbet Land was reduced from 3.29 MB to 630 KB.

Improving Textures

Most of the time, 1024x1024 textures are not necessary. Just like the images below, you should try to make your images as unique as possible. You should also use the best possible texture format. Very simple gray-scaled Textures should use I4. More complex ones should use I8. If a gray-scaled image requires an Alpha Channel, it should use IA4 or IA8. For basic colored textures, you should choose CMPR. CMPR can have a better quality in Brawlbox's Importer than RGB565, which does not support an Alpha Channel and creates bigger files. RGBA32 or RGBA8 should be only used if you need True Color images with opacity, due to this fileformat creating large files. If you also don't know how to enable mipmaps in the MDL0 or don't need/want them, you should not create them in the Texture importer.


Known Tracks with Slow Down

Major problems
Minimal problems
More tracks (Category Slow Motion Bug)
Category Slow Motion Bug not found