KCL files

From CW-Games Wiki
Jump to: navigation, search

Contents

Introduction

KCL files are the ones that control solidity in a course.
If the KCL file is wrong, you can fall trough the ground or drive through the walls.
















Header

Knipsel.PNG
The first block is the begin of the values. In the most kcl files is it 3C.
The third block is the start of the ground ID Section.
It is little endian so: D8 5F 00 00 = 00 00 5F D8.
Now: 00005FD8+F=00005FE8
Knipsel3.png
And there are the begin of the ground ID section.

Offset Type Description
0x00 u32 Offset to section 1
0x04 u32 Offset to section 2
0x08 u32 Offset to section 3
0x0c u32 Offset to section 4
0x10 single Unknown
0x14 single3 Spatial grid first coordinate
0x20 u32 X mask
0x24 u32 Y mask
0x28 u32 Z mask
0x2c u32 Coordinate shift
0x30 u32 Y shift
0x34 u32 Z shift
0x38 single Unknown

The Vertex section

A positon is the same as in a nkm file, but it is only the x,y,z coordinates. It is also little endian. The most times the first position is starting on: "00 00 00 3C"

Bytes What Comments
4 X X position.
4 Y Y position.
4 Z Z position.

The Normal section

Quote from wikipedia: http://en.wikipedia.org/wiki/Surface_normal

A surface normal, or simply normal, to a flat surface is a vector that is perpendicular to that surface.
A normal to a non-flat surface at a point P on the surface is a vector perpendicular to the tangent plane to that surface at P.
The word "normal" is also used as an adjective: a line normal to a plane, the normal component of a force, the normal vector, etc.
The concept of normality generalizes to orthogonality.
 
In the two-dimensional case, a normal line perpendicularly intersects the tangent line to a curve at a given point.
 
The normal is often used in computer graphics to determine a surface's orientation toward a light source for flat shading, or the
orientation of each of the corners (vertices) to mimic a curved surface with Phong shading.
Normal
Bytes What Comments
2 X X position.
2 Y Y position.
2 Z Z position.









The Planar section

Each ground ID is using 10 bytes as you can seen(the yellow marked bytes):
Knipsel4.png

Bytes What Comments
4 Length ?
2 Vertex Index Index in the Vertex section.
2 Normal Index Index in the Normal section.
2 Normal A Index Index in the Normal section.
2 Normal B Index Index in the Normal section.
2 Normal C Index Index in the Normal section.
2 Collision Type For Groundtypes look at the KCL ID List.

The Octree section

Quote from wikipedia: http://en.wikipedia.org/wiki/Octree

An octree is a tree data structure in which each internal node has exactly eight children.
Octrees are most often used to partition a three dimensional space by recursively subdividing it into eight octants.
Octrees are the three-dimensional analog of quadtrees.
The name is formed from oct + tree, and normally written "octree", not "octtree".
Octree

The octree divide the 3d space in cubes and then it assign the triangles to the cubes.

The working is simple. Mario Kart looks in which cube you are, then which planes collide and then it works.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
Courses
Documentation
Files
Full Hacks
Model Hacks
Texture Hacks
Misc Hacks
Applications
Theory
Tutorials
Video