Skip to content

Genesis3D .MAP file format specs

rtxa edited this page Sep 21, 2024 · 4 revisions

Introduction

This page tries to show what structure follows a G3D .map format.

A Genesis3D .map file is an intermediate step in level creation, generated by the level editor (GEdit). It contains all the necessary information to build a .BSP file, which is required for playing in the G3D engine. To convert a .map file into .BSP, GBSPLib is used.

The level editor also utilizes an additional format, .3dt, which includes extra information useful for the editor, such as compilation options and visibility groups. It's important to note that Genesis3D .map files are written in a non-readable (binary) format, so data types must always be represented consistently. Furthermore, Genesis3D tools are designed exclusively for Windows, and the order of data is critical; any deviation can lead to failures or bugs in the level.

File structure

A Genesis3D .map has the following global structure:

File Structure
File Header
Entities (Worldspawn, point-sized and world-models)
Entity Type Definitions

Entities can be point-sized (lights, enemies, props) or world-models (animated world geometry). The exception to this is the worldspawn entity, which is brush-based and is the main entity.

The worldspawn entity always needs to be present. It contains useful information like which texture library the map uses, the name of every sky textures it uses, etc.

After all entities have been stored, then we proceed to store the entity type definitions as well.out to the level, it stores the type definitions as well.

Data types

These are the data types you will found in a .map

Type Description
int 4-byte integer, little-endian
float 4-byte IEEE float, little-endian
string[n] String of n ASCII bytes, not necessarily null-terminated
String Length is written first, then the string of n ASCII bytes

Animated world geometry

A model is a group of one or more brushes to which programmers can attach data, and level designers can animate or point to from entities. There are two primary reasons to create a model: to create a moveable piece of geometry that you can animate; or to create a piece of geometry that programmers can identify at program run-time in order to provide special effects when an operation involves that piece of geometry.

Sample file structure

This would be the file structure for a simple map containing a room (6 brushes) and a light)

File Structure
File Header
Entity: Worldpawn (6 brushes)
Entity: Light
Entity Type Definitions

1. File Header

Data Type Description
Version int Value by default is 1
File Tag or Magic Number int Value by default is: 0x4642434E or "NCFB"
Number of Entities int The number of entities is the sum of:
- World entity
- Models
- Point-sized entities
- Entity type definitions

2. Entity

Data Type Description
Number of brushes int Number of brushes of the entity. Point-sized entities don't have any.
Entity flags int 0 or 1. Only used to identify if an entity has motion data or not.
Number of fields int
Key String
Value String

2. Worldspawn (Entity)

The worldspawn entity contains the world geometry (static and animated) and the map atributtes.

Brushes (static geometry)

Data Type Description
Number of Brushes int

Brush

Data Type Description
Flags int Brush type flags: Solid, Empty, Window, Detail, etc.
Brush content flags: metal, lava, water, etc.
Number of Faces int

Face

Data Type Description
Flags int Surface Flags: Mirror, Flat, Gouraud, etc.
MipMapBias float
Alpha float Alpha for brush
LightIntensity float Integer-only but GBSP requires a float
ReflectiveScale float
TexName string[32] Texture name not null terminated
uVecX, uVecY, uVecZ float
DrawScaleX, OffsetX float
vVecX, vVecY, vVecZ float
DrawScaleY, OffsetY float
normalX, normalY, normalZ float
Distance float

World Models (animated geometry)

Not defined yet

Map attributes

Data Type Description
Flags int No motion data for this entity
Num of Keys int The number of field is equal to sky faces + TextureLibrary + SkyAxis + SkyRotation + SkyScaling
Key String
Value String
Key Value Description
"TextureLib" "C:\Genesis3D\v120\Levels\gedit.txl"
"SkyAxis" "1.000000 0.000000 0.000000" Choose axis of rotation (X, Y or Z)
"SkyRotation" "10.000000" Degrees per second
"SkyDrawScale" "1.000000" Texture scale
"SkyRight" "sky_rt"
"SkyLeft" "sky_lf"
"SkyTop" "sky_up"
"SkyBottom" "sky_bt"
"SkyFront" "sky_ft"
"SkyBack" "sky_bk"

5. Type definition of entities

Data is required by the engine but I don't think is being used. Requires further exploring.

Data Type Value Description
%typedef%