.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
.kpbin files are made by exporting .kpmap files using Koopatlas.

A .kpbin file stores all information of a Koopatlas such as its tilemap info and doodads. These files are used directly in the game to load worldmaps.

As of now, there are no tools that can manipulate .kpbin files besides hex editors, though it'd be very painful to edit.

.kpbin files CAN'T be converted back to .kpmap files because of the way tile information is stored: .kpmap files store tile information as objects in the tileset, and every object has a set size of tiles and positions for tiles inside of it. When exported to .kpbin, the object information is lost and all that is kept is which tile is at what position in the worldmap. Reversing this process might be doable but would be significantly hard.

Besides that, all other information can be retrieved from .kpbin files by following the Documentation.

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.