File Formats


.APD
Anachronox Particle Data
Particles provide the beautiful lights and animation you see on spells and other things in Anachronox.
Located in /particles

APD File Conventions
Spaces aren't important, so you can format your files to look nice. Comment lines must have # as the first non-white space character in the line. End-of-line may be indicated by LF or CRLF.

NOTE: There is actually two different particle systems in Anachronox. The old particle system used a .map KEY of "message" and a 64-bit string VALUE to define the particle. This string is called a particle descriptor and breaks down as follows:

"message" "0000000000000000000000000000000000000000000000000000000000000000" <- 64-bit string

red (##) starting red color of particle 0-99
green (##) starting green color of particle 0-99
blue (##) starting blue color of particle 0-99
alpha (##) alpha percent of particle 0-99
fade (##) speed of particle fade 0-99
speed (##) movement speed of particle 0-99
max count (##) maximum number of particles?
delay (ms) (###) delay in milliseconds between particle spawn 0-999
size (###) radius of particle generator? 0-999
deviation (##) deviation amount between each particle produced. Effects alpha, fade, speed, size, scale.
mult num (#) Unknown
scale (##) scale of spawned particles
red #2 (##) fade to red color of particle
green #2 (##) fade to green color of particle
blue #2 (##) fade to blue color of particle
textureid (##) unknown
flags (hex)(########) These do not appear to have any effect...? 0-4294967295 (00000000 - ffffffff)
unused (#) set to '0'
alpha cutoff (##) at what alpha value the particle should just disappear?
rotate speed (##) clockwise rotational speed.
unused (##################) Set all 18 characters to '0'. They are unused.

This system was abandoned after Joey created the 'NP' New particle system, and Particleman. The only benefit I have seen for the old particle system is that you can attach the particle definition to a geometric brush, and it will use the size of the brush to define it's scale(visible in AnachroRadiant).
Using the New Particle system you must attach the particle definition to a ob_squib, or surface tag, and use the "scale" KEY and Particleman Spawn Volume to define it's size(not visible in AnachroRadiant).

Currently this is the only documentation for the old particle system.
To learn how to create New Particles see Visual Effects/Particleman.

 

.APE
Anachronox Programming Environment
The scripting language layer that controls most of the standard interactivity within the world. If you can click something in the world that triggers a dialog, interface, or event, then chances are APE has played a major part in it.
Located in /gameflow for map initialization, they can also be found in /battle/%mapname% for battle scripting.

APE File Conventions
These files contain binary data and are not editable unless you can hex edit or decompile the binary data.

See APE

 

.ATD
Animated texture data.
Procedural textures provide interesting visual effects by modifying the color values of a texture in real time. All procedural textures are created through the use of text scripts called Anachronox Texture Definition files. The definition files have the extension .atd and are used as replacements for normal textures.
Located in /textures.

ATD File Conventions
Spaces aren't important, so you can format your files to look nice. Comment lines must have # as the first non-white space character in the line. End-of-line may be indicated by LF or CRLF.

NOTE: There is actually two diffeferent procedural texture definitions in Anachronox. The old definitions used a .map KEY and VALUE to specify the parameters for the procedural texture, and were extremely hard to use. As an example you could apply the KEY and VALUE of "dlltexture02" "iform4:zblah/pal-tol3:zblah/i-tol-4,scrolling,0,10:zblah/i-tol-7,scrolling,0,-10" to a brush to have the whole brush use that procedural texture.
One drawback of the old style is that you could not specify the procedural texture to apply only to one face of a brush. No information on how to use this method is currently available.
The new procedural texture definitions allow you to apply any procedural texture to just one geometric brush face. Thus you could have a single brush with multiple procedural textures applied to each face of that brush.

To learn how to create your own procedural textures see Visual Effects/Procedural Textures
To learn how to apply procedural textures to .map geometric brushes, or faces see AnachroRadiant/Textures.

 

.BED
Battle Entity Data.
Battle enity data files contain node, entity, and other battle data. They resemble .map files and are created with the in-game battle editor BED.
Located in /battle/%mapname%

BED File Conventions
Spaces aren't important, so you can format your files to look nice. Comment lines must have // as the first non-white space character in the line. End-of-line may be indicated by LF or CRLF.

See BED

 

.BSP
Binary Space Partition.
There are two map file formats used throughout the Anachronox editing environment. .bsp and .map. .bsp files are compiled map data created by QBSP from a .map file. BSP stands for "binary space partition", the type of data organization procedure John Carmack used when creating the graphic engine for "DOOM".
Located in /maps

BSP File Conventions
These files contain binary data and are not editable unless you can hex edit or decompile the binary data.

Anachronox BSP File Format

Lump

Offset

Structure Size

Max Entries

Secret 1

-

-

-

Secret 2

-

-

-

Secret 3

-

-

-

Entities

0

(max) 262144

1

Planes

1

20

65536

Vertexes

2

12

65536

Visibility

3

(max) 4194304

1

Nodes

4

28

65536

TexInfo

5

76

12288

Faces

6

20

65536

Lighting

7

(max) 4194304

1

Leafs

8

28

65536

LeafFaces

9

2

65536

LeafBrushes

10

2

65536

Edges

11

4

128000

SurfEdges

12

4

256000

Models

13

48

1024

Brushes

14

12

8192

BrushSides

15

4

65536

Pop

16

(fixed) 256

1

Areas

17

8

256

AreaPortals

18

8

1024

Data contributed by T-chip, or Anachronator from Laguna's message board.

.BSP File Hexadecimal breakdown
Sorry T-chip your data is wrong.. Thanks for giving me a starting point though. :)

Lump

Offset

Structure Size

Max Entries

Secret 1

-

-

-

Secret 2

-

-

-

Secret 3

-

-

-

Entities

0

(max) 262144

1

Planes

1

20

65536

Vertexes

2

12

65536

Visibility

3

(max) 4194304

1

Nodes

4

28

65536

TexInfo

5

76

12288

Faces

6

20

65536

Lighting

7

(max) 4931712
Not yet sure if this is the max.
found this larger size in the first map 'ballotine' I tried to decompile.
Makes me wonder about the other maxs.
Primarily Entities, and Visibility

1

Leafs

8

28

65536

LeafFaces

9

2

65536

LeafBrushes

10

2

65536

Edges

11

4

128000

SurfEdges

12

4

256000

Models

13

48

1024

Brushes

14

12

8192

BrushSides

15

4

65536

Pop

16

(fixed) 256

1

Areas

17

8

256

AreaPortals

18

8

1024

 

 

Header Information
Offset(HEX)
Offset(DEC)
Value
0H-3H
0-3
BSP Header always equals IBSP.
4H-7H
4-7
.bsp data version. Always 38.
8H-bH
8-11
Offset for entities
cH-fH
12-15
Total Entity data lump size.
10H-13H
16-19
Points to the starting offset of an unknown data lump
14H-17H
20-23
Total size of unknown data lump
18H-1bH
24-27
Offset for vertexes.
1cH-1fH
28-31
Total size of vertexes lump
20H-23H
32-35
Offset for visibility
24H-27H
36-39
Total size of visibility lump
28H-2bH
40-43
Offset for nodes
2cH-2fH
44-47
Total size for nodes lump
30H-33H
48-51
Offset for texinfo lump
34H-37H
52-55
Total size of texinfo lump
38H-3bH
56-59
Offset for faces
3cH-3fH
60-63
Total size of faces lump
40H-43H
64-67
Offset for lighting
44H-47H
68-71
Total size of lighting lump
48H-4bH
72-75
Beginning offset for leafs.
4cH-4fH
76-79
Total size of the leaf lump
50H-53H
80-83
Offset for leaffaces
54H-57H
84-87
Total size of the leaffaces lump
58H-5bH
88-91
Offset for leafbrushes
5cH-5fH
92-95
Total size of the leafbrushes lump
60H-63H
96-99
Offset for edges
64H-67H
100-103
Total size of edges lump
68H-6bH
104-107
Offset for surfedges
6cH-6fH
108-111
Total size of surfedges lump
70H-73H
112-115
Offset for models
74H-77H
116-119
Total size of models lump
78H-7bH
120-123
Offset for brushes
7cH-7fH
124-127
Total size of the brushes lump
80H-83H
128-131
Offset for brushsides
84H-87H
132-135
Total size for brushsides lump
88H-8bH
136-139
Offset for pop lump
8cH-8fH
140-143
Total size of pop lump
90H-93H
144-147
Starting offset for areas lump
94H-97H
148-151
Total size for areas lump
98H-9bH
152-155
Offset for areaportals
9cH-9fH
156-159
Total size of areaportals lump
 
Lump Information
Offset(HEX)
Offset(DEC)
Value
a0H-###H
###-###

The first data lump. Not sure exactly what this is. It does contain information about who created the map and what RAD compiler was used, as well as other unknown data.
Nothing in the header points to this lump or tells the size of it
I believe this lump is inserted by the RAD compiler.

    Unknown lump
    The leafs lump
###H-###H
###-###
The vertexes lump
###H-###H
###-###
The nodes lump
###H-###H
###-###
The texinfo lump
Contains brush face texture names, texture values, and spawn flags.
Each array in this lump consists of 76 bytes. The first 40 bytes contain texture values, and spawn flags?. The next 32 bytes contain the texture name. The last 4 bytes of the array always seems to contain 'FF FF FF FF' hex
###H-###H
###-###
The faces lump
###H-###H
###-###
The brushes lump
###H-###H
###-###
The brushsides lump
###H-###H
###-###
The leaffaces lump
###H-###H
###-###
The leafbrushes lump
###H-###H
###-###
The surfedges lump
###H-###H
###-###
The edges lump
###H-###H
###-###
The models lump
###H-###H
###-###
The areas lump
###H-###H
###-###
The areaportals lump
###H-###H
###-###
The lighting lump
###H-###H
###-###
The visibility lump
###H-###H
###-###

The entities lump.
Consists of strings exactly like the corresponding .map file.

{
"classname" "worldspawn"
}
{
"origin" "64 24 16"
"classname" "bush02"
}

etc...

###H-###H
###-###
The pop lump
Entity information is followed by 256 bytes of null data.
###H-###H
###-###
EOF.
40 headers. 20 lumps
Getting closer. Need to break down the formats of the lumps now.
I want to get this done so I can biuld an Anachronox map decompiler. I have never found one that decompiled maps correctly.

See AnachroRadiant

 

.CTC
Character Texture Control?
.ctc files are the old data format files used for skeletal, model light, and procedural textures. Skeletal systems were removed from the game and replaced with animation and morph frame data directly in model files(.md2). Model light data was replaced by the .mda file format and procedural textures were changed to the .atd file format.

CTC File Conventions
These files contain binary data and are not editable unless you can hex edit. There is no known editor or de compiler for this data format.
These files were left in the GDB for some particle effects.

 

.GDB
Game database
The GDB is the game database that keeps track of numerous things in the game including items, mystech, battleskills, quests, weapons, monsters, and more. It basically consists of numerous files in the Anachronox directory tree, (usually with a .gdb extension), that contain text entries that describe the previously mentioned elements of a game
Located in /objects

GDB File Conventions
Spaces aren't important, so you can format your files to look nice. Comment lines must have // as the first non-white space characters in the line. End-of-line may be indicated by LF or CRLF

See GDB.

 

.MAP
AnachroRadiant map data.
There are two map file formats used throughout the Anachronox editing environment. .bsp and .map. .map files are un compiled map data and are only used in AnachroRadiant. These files are text files describing brushes and entity data. They are then compiled to create the .bsp file format that are read by the Anachronox engine.

MAP File Conventions
Spaces aren't important, so you can format your files to look nice. Comment lines must have # as the first non-white space character in the line. End-of-line may be indicated by LF or CRLF.
Note: AnachroRadiant will strip all white spacing, comments, and LF or CRLF when map file is saved.

The Basic Brush
This is all the info describing a 64 3 brush with the c_met11_2 texture applied to it. If you care to check, one corner of this brush sits at the center of the world (0 0 0). Imagine having to construct an entire map using a text editor! Believe it or not, the first CAD programs were done exactly in this manner. Lucky for the users, they only had to worry about drawing a 2-dimensional world.

{
( 128 0 -64 ) ( 8 0 -64 ) ( 8 -128 -64 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
( 8 -128 0 ) ( 8 0 0 ) ( 128 0 0 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
( 8 -64 8 ) ( 128 -64 8 ) ( 128 -64 0 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
( 64 -128 8 ) ( 64 0 8 ) ( 64 0 0 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
( 128 0 8 ) ( 8 0 8 ) ( 8 0 0 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
( 0 0 8 ) ( 0 -128 8 ) ( 0 -128 0 ) e1u1/c_met11_2 0 0 0 1 1 0 0 0
}

What we're really interested in are the numbers following the texture name. You'll see there are eight. Taken from the example above, the first line would be 0 0 0 1 1 0 0 0 . These are all of the texture values and spawnflags. The fact that there are mostly zeros means the texture has no surface or content flags set for it; it's just a plain old texture. The two 1's are the texture's dimensions, which mean that it has been applied with it's default size. 

A visual reference for the texture property flags

Even though you may use a different editor, the flags still mean the same thing.

Texture Properties

Now that you know what the 8 data bits reference, you now need to know what possible values can be used. Let's take the light value, which is used typically for sky textures and light-emitting textures. Therefore, a string of 0 0 0 1 1 0 0 100 means that you've get a light value of 100. However, since the light flag is normally set for a situation like this, it would read 0 0 0 1 1 0 1 100. Reason being, is that 'light' is the first item in the surface property list, and therefore has a spawnflag value of '1'. 'Slick' is '2', sky is '4' and so on, following the numerical convention used for spawnflags. For multiple flag selection add all of the desired property Spawnflag values together. To mark a brush as slick slime for example it would read 0 0 0 1 1 32 10 0. The 32 value being equal to the water content flag and 10 is the slick and warp surface flags added together.
Here's a handy reference showing all of the spawnflags:

Surface Property Spawnflag Content Property Spawnflag

Light
Slick 
Sky Flag
Warp
Trans33 
Trans66 
NoDraw 
Hint
Skip
Alpha Banner
Alpha Test
No V-turbulence
Half Scroll
Quarter Scroll
Surface Fog
Surface Curve

1
2
4
8
16
32
128
256
512
65536
131072
262144
268435456
536870912
1073741824
2147483648


Solid
Window
Water
Mist
Areaportal
PlayerClip
MonsterClip
Current_0
Current_90
Current_180
Current_270
Current_up
Current_dn
Origin
Monster
Detail
Translucent

1
2
32
64
327768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
16777216
33554432
134217728
267435456

With this information you can now fix certain things in the blink of an eye.
NOTE to my self.. I need to add the values for Surface sounds if relevant(textureinfo.dat).

See AnachroRadiant

 

.MDA
Anachronox model shader data.
Shader data allows you to create multiple skins on any given model, as well as creating special effects! By using ONE model with many skin variants, it's possible to populate a level with hundreds of unique characters, while keeping a very low “model loading” footprint
Located in /models

MDA File Conventions
Spaces aren't important, so you can format your files to look nice. Comment lines must have # as the first non-white space character in the line. End-of-line may be indicated by LF or CRLF.

See Models

 

.MD2
Model Data
These are the model files for Anachronox. They contain all of the geometry, and morph data for Anachronox models.
Located in /models

MD2 File Conventions
These files contain binary data and are not editable unless you can hex edit.
For GUI modification of data see External Tools/lw2dm2.

.MD2 File Hexadecimal breakdown

Header Information
Offset(HEX)
Offset(DEC)
Value
0h-3h
0-3
aliasModelHeader always equals IDP2. IDP2 shows this file to be a binary format model file. All model files for Anachronox has this header.
4H-5H
4-5
.md2 data version. Always 15 for Anachronox models.
6H-7H
6-7
Vertex resolution flag 0=3, 1=4, 2=6 .See Anachrodox/Models for more information.
8H-bH
8-11
Texture height of first texture. If this is greater than 256 then model will not have AnimIds.
cH-fH
12-15
Texture width of first texture. If this is greater than 256 then model will not have AnimIds.
10H-13H
16-19
Offset for Texture Coordinates
14H-17H
20-23
The number of textures(skins). Or is it Emits?
The maximum number of skins a model can have is 32.
18H-1bH
24-27
Number of vertices.
1cH-1fH
28-31
Number of Texture Coordinates
20H-23H
32-35
Number of tris.
24H-27H
36-39
Cmd size. Not sure what the relevance of this number is yet.
28H-2bH
40-43
Number of frames.
The maximum number of frames a model can have is 1024.
2cH-2fH
44- 47
Offset for first texture name. Always equals 96.
Texture name lump data size allows texture names to be a maximum of 64 characters long .
30H-33H
48-51

Texture coordinate starting offset position number.
Is this most commely known as UV data?

This number always points to a data structure that always starts immediately after texture names have been defined. We can use this number to find out how many texture names this model has assigned to it; 96(starting offset of all texture names) - this number /64(bit length of texture name data structure). EXP: 96-160/64 = 1 texture name in this .md2, or 96-224/64 = 2 texture names in the .md2.

The end of this data string is always equal to: Frame 1 starting offset position number -1(34H-37H - 1). One position before the Frame 1 animation starting offset position number.

34H-37H
52-55
Frame 1 triangles starting offset position number.
To find the end of frame 1 use: the number of tris*12+offset of starting position.
EXP: If POS: 20H-23H(number of tris) = 18H(24D) and POS: 34H-37H(frame 1 triangles starting offset) = f8H(248D), the calculation would be 24*12+248 = 392(Frame 1 ending offset position number).
38H-3bH
56-59

Frame 1 ending offset position number, or do the math above.

This number could potentially be removed from the data structure since we could force the reading program to do the math. There are other header information that potentially could be removed from the header, but I do not need to study this futher for this documentation(Not relevant for the subject).......

  So to find total frame 1 lump size in bytes use; Frame 1 ending offset position number - Frame 1 starting offset position number = 144(frame 1 triangles lump size).
3cH-3fH
60-63
Ending offset for Animation Frame.
40H-43H
64-67
Offset for EOF.
44H-47H
68-71
Another byte that shows the number of textures? Or is it Emits?
Which is it?
48H-4bH
72-75
Ending offset for Strip Fan Data.
What is this?
4cH-4fH
76-79
The beginning of some unknown data lump. Contains duplicate data as offsets 80-83, and 84-87.
What os this? Possibly normals data
50H-53H
80-83
Unknown data lump. Contains duplicate data as offsets 76-79, and 84-87.
What is this? Possibly normals data
54H-57H
84-87
The end of unknown data lump. Contains duplicate data as offsets 76-79, and 80-83.
What is this?
58H-5bH
88-91
The number of Tagged Surfaces.
5cH-5fH
92-95
Starting offset for Tagged Surfaces.
60H-9fH
96-159
Texture 1 name. Data structure allows texture names to be 64 characters long.
 
Lump Information
Offset(HEX)
Offset(DEC)
Value
60H-###H
96-###

This first data lump shows texture names.

Data structure allows texture names to be 64 characters long. So the total size of this lump is the number of textures(skins) times 64(14H-17H*64).

###H-###H
###-###
The second data lump is for texture coordinates.
Is this really UV data?
###H-###H
###-###

The third lump contains triangle location data.
The maximum number of triangles a model can have is 4096.
The maximum number of vertexes is 2048.

Triangles are made out of three vertices(Everything 3D).
The data in this lump shows the location of each vertice in the triangle.
Each array in this lump contains 6 integer values that equal the location of the vertices that create the triangle(xy, yz, xz?). (32 , 117, 34 , 122, 30 , 120).

###H-###H
###-###
The fourth lump contains animation frame data.
The maximum number of frames a model can have is 1024.
###H-###H
###-###
The fifth lump contains strip fan data.
What is this?
###H-###H
###-###
The sixth and final data lump contains Tagged Surface names and Tagged Triangle number data.
Tagged surface data structure allows tagged surface names to be 8 characters long(8bytes). The number immediately following the tagged surface name is the tagged triangle number(4 bytes).
###H-###h
###-###

EOF(End of File). The offset for end of file can be found at 40H-43H, or can be found by the sum of all of the previous calculations.

This can be used as a evalutation in a program to see if any of the binary file is missing.

One more unknown header data to go. Also what what is Texture coordinates, animation frame data, and strip fan data?

See Models

 

.S
Planet scripts
Planet scripts contain movie data created by the in-game movie editor Planet.
Located in /scriptst

S File Conventions
Spaces aren't important, so you can format your files to look nice. Comment lines must have # as the first non-white space character in the line. End-of-line may be indicated by LF or CRLF.

See Planet