

Prefabs are pre-built world objects such as buildings, doors and signs that are scattered around the map. They allow developers and users to make maps more easily because they can be copied, pasted and reused any number of times.
The Prefabs in Navezgane are reflected in the file Data/Worlds/Navezgane/prefabs.xml
. This file contains a list of every prefab in Navezgane including their coordinates and rotation.
For information on how Prefabs are placed outside of Navezgane see Random World Generation.
The path to all of the default prefab files is Data/Prefabs/
.
See List of Prefabs for a list of every prefab and its properties.
Technical
Each Prefab has between four and six files associated with it.
Block Names
Files ending in .blocks.nim
associate block ids with their in-game names. These ids are referenced in the TTS file. By changing a block name in this file all blocks referenced by that id in the TTS file will be changed. This feature was introduced in Alpha 17.
INS
The purpose of files ending in .ins
is to store the `PrefabInsideDataFile`. Not every prefab has an INS file. They were introduced in Alpha 17.
Thumbnail
Prefabs optionally have .jpg
thumbnail images used to preview the prefab in the in-game editor. This was introduced in Alpha 17.
Mesh
Mesh files were introduced in Alpha 16. They end in .mesh
and are not present for every prefab. They store the prefab imposters.
TTS
Files ending in .tts
contain the voxel block data for each prefab. They are binary files, and the format is explained below for the currently used versions.
All numbers are in little endian.
Version 16 | |
---|---|
Header | The header for a tts prefab file is 8 bytes long.char[4] tts\0 # file type uint32 version # compatibility |
Block Data | First we store another static header giving the size of the prefabushort size.x ushort size.y ushort size.zWe need to store exactly size.x*size.y*size.z blocks: uint32[x*y*z] rawBlockData byte[x*y*z] blockDensity byte[x*y*z][2] blockDamageDataNext we have special SimpleBitStream storing which block has a texture (>0): # SimpleBitStream as encoded binary int32 numberOfBytes byte[numberOfBytes] dataEach block that has a texture (>0) is now also stored: long[blocksWithTextureCount] texture There are two parts to each 4 byte (32 bit) block raw-data:
The block id found in the lower 15 bits of each block integer corresponds to a block id in the The first two flag bits (15 - 16) encode the rotation of a block around the vertical axis. It is unknown what the rest of the flag bits do at this time. |
Tile Entity Data | short count # repeated for every tileEntity short dataSizeForTile byte tileEntityType # each type has different data to store byte[dataSizeForTile] data |
Trigger Data | short count # repeated for every triggerData short dataSizeForTrigger Vector3i position # int[3] # each type has different data to store byte[dataSizeForTrigger] data |
XML
Every prefab has an XML file ending in .xml
that stores attributes about the model such as what Biome, Zone and Township they can spawn in.
Versions
As the game has been updated, the prefab format has changed slightly. These changes are reflected in the version number found in the header of each prefab file.
Alpha 17 (b240)
File Version | Number of Prefabs |
---|---|
13 | 356 |
15 | 94 |
Video Tutorial
Guide how to import a prefab into a new/existing game world.