Difference between revisions of "Slow Motion Bug"

From Custom Mario Kart
Jump to navigation Jump to search
m (proofread / if you hate the example layout, change it)
m
Line 1: Line 1:
 
==Overview==
 
==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:
+
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 or GPU power to calculate what is rendered on screen, the action on screen (the frames per second or ''FPS'') can slow down dramatically. While this technically isn't a bug in the traditional sense, it is a symptom of poor optimization and can indicate that the track author did not test the level thoroughly before release.
*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.
+
The "Slow Motion Bug" can be caused many factors including:
 
+
* Model complexity (very likely)
Different types of slowdown will become more noticeable when playing different game modes.
+
* 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)
  
 
{{youtube-box|bug|x7auiQJ6QtI|Six King Labyrinth Slow Motion Bug}}
 
{{youtube-box|bug|x7auiQJ6QtI|Six King Labyrinth Slow Motion Bug}}
  
==Fixing the Problem==
+
<!-- WIP: Feel free to start mirroring the corresponding information into these two categories.
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:
+
==Types of Slowdown==
 +
There are several different types of slowdown that can be experienced ingame. Different types of slowdown will become more noticeable when playing different game modes.
  
* Model is too geometrically complex (vertices, faces, facepoints).
+
===CPU Intensive===
* Model uses too many draw calls.
+
Symptoms:
* Textures are too large.
+
* Track experiences more symptoms in online modes than splitscreen modes.
 +
* No frames are dropped, but frame rate decreases.
  
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.
+
Causes:
 +
* An infinite loop is occurring within KMP logic.
 +
* Models are using too many draw calls or materials.
 +
* Textures are too large for their image format.
  
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.
+
===GPU Intensive===
 +
Symptoms:
 +
* Track experiences more symptoms in splitscreen modes than online modes.
 +
* Frames are dropped, and frame rate may decrease.
  
Additionally, creating a [[Solidity#Collision_Models|simplified collision model]], separate from the course model, removes the need to include extra collision data within the course model.
+
Causes:
 +
* Culling is improperly used.
 +
* Models are too geometrically complex (vertices, faces, facepoints).
 +
-->
  
If these steps only partially solve your problem, than your level might have too many items.
+
==Troubleshooting==
 +
===Complex Models===
 +
There are three major ways that a model may cause slowdown:
 +
* Model is too geometrically complex (vertices, faces, facepoints).
 +
* Model uses too many draw calls (materials).
 +
* Textures are too large.
  
This may be caused by:
+
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 may help, although the impact of a hi-res texture VS a low-res texture is often small enough to not be responsible. Additionally, creating a [[Solidity#Collision_Models|simplified collision model]], separate from the course model, removes the need to include any extra complexity from the collision model within the course model.
  
 +
===Excessive Objects===
 +
If these steps only partially solve your problem, than your level might have too many objects. This may be caused by:
 
* Too many objects in the KMP.
 
* Too many objects in the KMP.
* Too many items in play on the field.
 
 
* Unused objects that are still rendered.
 
* Unused objects that are still rendered.
 
* Objects with model animations set to display in all game modes.
 
* Objects with model animations set to display in all game modes.
  
The easy solution would be to remove all unnecessary items from the KMP.
+
The easy solution would be to remove all unnecessary items from the KMP. 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.
 
 
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===
+
===Reducing Faces===
 
[[file:reduce-faces-1.png|right|More faces than needed]]
 
[[file:reduce-faces-1.png|right|More faces than needed]]
  
Line 65: Line 74:
 
<br clear="all" />
 
<br clear="all" />
  
===Improving old KCL files===
+
===Improving 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.
 
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.
  
Line 81: Line 90:
 
<br clear="all">
 
<br clear="all">
  
==Known Tracks with Slow Down==
+
==Known Tracks with Slow Motion Bug==
 
; Major problems:
 
; Major problems:
 
* [[Bowser's Lava Road]] ~42.000 facepoints.
 
* [[Bowser's Lava Road]] ~42.000 facepoints.

Revision as of 18:09, 26 February 2014

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 or GPU power to calculate what is rendered on screen, the action on screen (the frames per second or FPS) can slow down dramatically. While this technically isn't a bug in the traditional sense, it is a symptom of poor optimization and can indicate that the track author did not test the level thoroughly before release.

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)
Six King Labyrinth Slow Motion Bug


Troubleshooting

Complex Models

There are three major ways that a model may cause slowdown:

  • Model is too geometrically complex (vertices, faces, facepoints).
  • Model uses too many draw calls (materials).
  • 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 may help, although the impact of a hi-res texture VS a low-res texture is often small enough to not be responsible. Additionally, creating a simplified collision model, separate from the course model, removes the need to include any extra complexity from the collision model within the course model.

Excessive Objects

If these steps only partially solve your problem, than your level might have too many objects. This may be caused by:

  • Too many objects in the KMP.
  • 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. 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 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 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 Motion Bug

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