.kpbin

.kpbin files are files used by the Koopatlas Worldmap system used in NewerSMBW and its mods.

While the Koopatlas Map Editor uses .kpmap files as project files, they need to be exported to .kpbin in order to be read by the game. This is due to the fact that .kpmap are actually JSON files, which are very large and would be hard to parse in-game.

The .kpbin files are pretty much optimized versions of .kpmap with data represented as bytes following specific structures instead of plain text.

General Info
The file stores tilemap info and doodads, while also allowing the game to load the map.

As of now, there are no tools that can manipulate .kpbin files.

Documentation
This part is dedicated to documenting the structures of the KPBIN file format.

The representation of structures is (very) heavily inspired from the way they are in the Custom Mario Kart Wiiki.

The following was written by User:RedStoneMatt. Feel free to add your name if you add new stuff!

Header
The file begins with a header of size 0x2C bytes.

Layers
This section is dedicated to structures related to layers.

Layers are building grids on which tiles, doodads or paths can be placed.

Sectors
This section is dedicated to structures related to sectors.

Sectors are sets or 16*16 tile IDs used as chunk for Layer rendering.

Doodads
This section is dedicated to structures related to doodads.

Doodads are pictures that can be placed on Layers.

Nodes
This section is dedicated to structures related to nodes.

Nodes are points that are used to bind Paths to each other. They can have special properties such as being a level, changing the current world's name or switching of worldmap.

Paths
This section is dedicated to structures related to paths.

Paths are lines that are bind one Node to another. The player can walk on them to travel through the worldmap. Every path has an Unlock Criteria that makes the path available or not depending of one or more criterias like level completion, or star coin count.

Unlock Data
This section is dedicated to structures related to unlock data.

The Unlock Data is a byte-ified version of unlock criterias that each Path has.

Tilesets
This section is dedicated to structures related to tilesets.

Tilesets are sets of 32*16 tiles represented on a 768*384 pixels texture.

GXTexObj
This structure is used for direct texture loading/rendering and hold essential properties for said texture.

World Definitions
This section is dedicated to structures related to world definitions.

World Definitions are a set of values that holds properties for a given world, like its name and colors.