Skip to content

Commit 478e36a

Browse files
Added Entry for MD3
Credits to icculus.org
1 parent bbfb62c commit 478e36a

5 files changed

Lines changed: 251 additions & 12 deletions

File tree

docs/engine/fileformats/cfg.md

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ sidebar_position: 1
33
description: Configuration Files (.cfg)
44
---
55

6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
69
# Configuration Files (.cfg)
710

811
---
@@ -11,22 +14,59 @@ description: Configuration Files (.cfg)
1114

1215
---
1316

14-
The .cfg files are ASCII text configuration files present in `/base` and used by id tech 4 based games for setting CVars, mapping player input to keys or buttons (see note below), and executing console commands. Usually the following files are available (by reading order of the engine):
17+
The .cfg files are ASCII text configuration files present in `/base` and used by id tech 4 based games for setting CVars, mapping player input to keys or buttons (see note below), and executing console commands:
18+
19+
You can use two forward slashes to write comments in .cfg files:
20+
21+
```cpp
22+
// This is a comment
23+
```
24+
25+
Usually the following files are available (by reading order of the engine):
1526

1627
- `DoomConfig.cfg`: Stores all the game’s options. It’s auto-generated by the engine so manual editing is not recommended. If you delete this file the engine will revert to a `default.cfg` file located inside one of the .pk4 files.
17-
- `editor.cfg`: Optional. Stores all the DoomEdit relevant options. It’s auto-generated by the engine so manual editing is not recommended.
18-
- `autoexec.cfg`: Optional. This file is read last and will override any options set elsewhere. It’s meant for user-manipulation so you can set any CVars here that you’d have to otherwise set in the game or editor shortcuts.
28+
29+
## config.cfg
30+
31+
Stores all the game’s options. It’s auto-generated by the engine so manual editing is not recommended. If you delete this file the engine will revert to a `default.cfg` file located inside one of the .pk4 files.
32+
33+
<Tabs>
34+
<TabItem value="doom3" label="Doom 3">
35+
In Doom 3 the .cfg file is `DoomConfig.cfg`
36+
</TabItem>
37+
<TabItem value="prey" label="Prey (2006)">
38+
In Prey the .cfg file is `PreyConfig.cfg`
39+
</TabItem>
40+
<TabItem value="quake4" label="Quake IV">
41+
In Quake IV the .cfg file is `Quake4Config.cfg`
42+
</TabItem>
43+
<TabItem value="wolf" label="Wolfenstein (2009)">
44+
In Wolfenstein the .cfg file is `wolf.cfg`
45+
</TabItem>
46+
<TabItem value="etqw" label="Enemy Territory: Quake Wars">
47+
In Enemy Territory: Quake Wars the main .cfg file is split into two .cfg
48+
`etqwdedbinds.cfg` for Keyboard Binds.
49+
`etqwdedconfig.cfg` for Main Game Settings.
50+
</TabItem>
51+
</Tabs>
52+
53+
## default.cfg
54+
55+
The config file to be use when the main config.cfg is missing, if this .cfg is missing the the game wouldn't boot up.
56+
57+
## editor.cfg
58+
59+
Optional. Stores all the DoomEdit relevant options. It’s auto-generated by the engine so manual editing is not recommended.
60+
61+
## autoexec.cfg
62+
63+
Optional. This file is read last and will override any options set elsewhere. It’s meant for user-manipulation so you can set any CVars here that you’d have to otherwise set in the game or editor shortcuts.
1964

2065
You can also create your own custom configuration files to load custom settings and execute console commands in notepad. You can then load these files by using the exec console command in the shortcut or adding the following line to your `autoexec.cfg`:
2166

2267
```cpp
2368
exec myconfig.cfg
2469
```
25-
You can use two forward slashes to write comments:
26-
27-
```cpp
28-
// This is a comment
29-
```
3070

3171
:::note
3272

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
---
2+
description: MD5 (.md5)
3+
---
4+
5+
import Tabs from '@theme/Tabs';
6+
import TabItem from '@theme/TabItem';
7+
8+
# MD3 (.md3)
9+
10+
---
11+
12+
## Overview
13+
14+
---
15+
16+
MD3 is the 3D data format used in Quake 3: Arena and derivative games (Q3 mods, Return to Castle Wolfenstein, Jedi Knights 2, etc.). The file format is used to describe 3D objects in the game that move and interact with players, other objects, and/or the environment. Animation is recorded by describing the position of every vertex in the model for each frame of animation. This style of animation may also be known as "mesh deformation", "vertex animation", ???.
17+
18+
The Quake series was developed and run on IA32 (x86) machines, using C. The file format shows many evidences of x86-isms and C-isms (expected byte order, word sizes, data type names, etc.). Some of these isms spill over into this document.
19+
20+
The MD3 format is presented here from a larger scope to smaller ones.
21+
22+
:::note
23+
24+
While Doom 3 itself never use .md3 during its development, the engine supports loading MD3 files, though its usage its not advise because of some
25+
issues and crashes, though some source ports has fixed this issue, such source ports are:
26+
27+
- [Dhewm3](https://dhewm3.org/)
28+
- [rbdoom-3-bfg](https://www.moddb.com/mods/rbdoom-3-bfg)
29+
30+
:::
31+
32+
### Data type indicator
33+
34+
| Datatype | name / purpose | Description |
35+
| --- |---: |---|
36+
| U8 | char | 8-bit unsigned octet (character). |
37+
| S16 | short | Little-endian signed 16-bit integer. |
38+
| S32 | int | Little-endian signed 32-bit integer. |
39+
| F32 | float | IEEE-754 32-bit floating-point. |
40+
| VEC3 | vec3_t | Triplet of F32 in sequence (read 4 octets → float; read 4 → float; read 4 → float), representing a 3D vector. |
41+
| * | [] | Indicates sequential repeat count (homogenous aggregation, array, vector), e.g., "U8 * 16" = 16-octet array. |
42+
| - | - | File/array offset to note specially. |
43+
| ! | ! | Aggregate complex data that should be described elsewhere. |
44+
45+
### MD3
46+
47+
| Datatype | name / purpose | Description |
48+
| --- | ---: | --- |
49+
| - | MD3_START | Offset of MD3 object; usually 0 but not guaranteed. |
50+
| S32 | IDENT | Magic number; as 4-char string "IDP3"; little-endian 1367369843 (0x51806873); big-endian 1936228433 (0x73688051). |
51+
| S32 | VERSION | MD3 version number; latest known 15; use constant MD3_VERSION. |
52+
| U8 * MAX_QPATH | NAME | MD3 name, usually pathname in PK3; ASCII NUL-terminated string; MAX_QPATH = 64. |
53+
| S32 | FLAGS | Unknown/unused field. |
54+
| S32 | NUM_FRAMES | Number of Frame objects; maximum MD3_MAX_FRAMES (1024). |
55+
| S32 | NUM_TAGS | Number of Tag objects; maximum MD3_MAX_TAGS (16). |
56+
| S32 | NUM_SURFACES | Number of Surface objects; maximum MD3_MAX_SURFACES (32). |
57+
| S32 | NUM_SKINS | Number of Skin objects; typically unused (artifact from MD2). |
58+
| S32 | OFS_FRAMES | Relative offset from MD3 start to Frame objects; Frames are stored sequentially. |
59+
| S32 | OFS_TAGS | Relative offset from MD3 start to Tag objects; Tags are stored sequentially. |
60+
| S32 | OFS_SURFACES | Relative offset from MD3 start to Surface objects; Surfaces are stored sequentially. |
61+
| S32 | OFS_EOF | Relative offset from MD3 start to end of MD3 object; no offset for Skins. |
62+
| ! | (Frame) | Aggregate: array of Frame objects; usually follows header but use OFS_FRAMES. |
63+
| ! | (Tag) | Aggregate: array of Tag objects; usually after Frames but use OFS_TAGS. |
64+
| ! | (Surface) | Aggregate: array of Surface objects; usually after Tags but use OFS_SURFACES. |
65+
| - | MD3_END | End of MD3 object; should match MD3_START. |
66+
67+
### Frame
68+
69+
(member of MD3)
70+
71+
| Datatype | name / purpose | Description |
72+
| --- | ---: | --- |
73+
| VEC3 | MIN_BOUNDS | First corner of the bounding box. |
74+
| VEC3 | MAX_BOUNDS | Second corner of the bounding box. |
75+
| VEC3 | LOCAL_ORIGIN | Local origin, usually 0,0,0. |
76+
| F32 | RADIUS | Radius of bounding sphere. |
77+
| U8 * 16 | NAME | Name of Frame; ASCII NUL-terminated string. |
78+
79+
### Tag
80+
81+
(member of MD3)
82+
83+
| Datatype | name / purpose | Description |
84+
| --- | ---: | --- |
85+
| U8 * MAX_QPATH | NAME | Name of Tag; ASCII NUL-terminated string; MAX_QPATH = 64. |
86+
| VEC3 | ORIGIN | Coordinates of Tag object. |
87+
| VEC3 * 3 | AXIS | Orientation of Tag object (three column vectors). |
88+
89+
### Surface
90+
91+
(member of MD3)
92+
93+
| Datatype | name / purpose | Description |
94+
| --- | ---: | --- |
95+
| - | SURFACE_START | Offset relative to start of MD3 object. |
96+
| S32 | IDENT | Magic number "IDP3" (0x51806873 little-endian). |
97+
| U8 * MAX_QPATH | NAME | Surface name; ASCII NUL-terminated string; MAX_QPATH = 64. |
98+
| S32 | FLAGS | Flags (implementation-defined). |
99+
| S32 | NUM_FRAMES | Number of animation frames; matches MD3 header. |
100+
| S32 | NUM_SHADERS | Number of Shader objects; max MD3_MAX_SHADERS (256). |
101+
| S32 | NUM_VERTS | Number of Vertex objects per frame; max MD3_MAX_VERTS (4096). |
102+
| S32 | NUM_TRIANGLES | Number of Triangle objects; max MD3_MAX_TRIANGLES (8192). |
103+
| S32 | OFS_TRIANGLES | Offset from SURFACE_START to Triangle list. |
104+
| S32 | OFS_SHADERS | Offset from SURFACE_START to Shader list. |
105+
| S32 | OFS_ST | Offset from SURFACE_START to St (texture coord) list. |
106+
| S32 | OFS_XYZNORMAL | Offset from SURFACE_START to Vertex (XYZNormal) list. |
107+
| S32 | OFS_END | Offset from SURFACE_START to end of Surface. |
108+
| ! | (Shader) | List of Shader objects; use OFS_SHADERS. |
109+
| ! | (Triangle) | List of Triangle objects; use OFS_TRIANGLES. |
110+
| ! | (St) | List of TexCoord (St) objects; use OFS_ST. |
111+
| ! | (XYZNormal) | List of Vertex objects; total count = NUM_FRAMES * NUM_VERTS. |
112+
| - | SURFACE_END | End of Surface; should match OFS_END. |
113+
114+
### Shader
115+
116+
(member of MD3)
117+
118+
| Datatype | name / purpose | Description |
119+
| --- | ---: | --- |
120+
| U8 * MAX_QPATH | NAME | Pathname of shader in PK3; ASCII NUL-terminated string; MAX_QPATH = 64. |
121+
| S32 | SHADER_INDEX | Shader index number (allocation order implementation-defined). |
122+
123+
### Triangle
124+
125+
(member of MD3)
126+
127+
| Datatype | name / purpose | Description |
128+
| --- | ---: | --- |
129+
| S32 * 3 | INDEXES | Three vertex indices into the Vertex list that form the triangle. |
130+
131+
### TexCoord
132+
133+
(member of MD3)
134+
135+
| Datatype | name / purpose | Description |
136+
| --- | ---: | --- |
137+
| F32 * 2 | ST | Texture coordinates (S,T) typically in [0.0 .. 1.0], may wrap. |
138+
139+
### Vertex
140+
141+
(member of MD3)
142+
143+
| Datatype | name / purpose | Description |
144+
| --- | ---: | ---|
145+
| S16 | X | X coordinate scaled by MD3_XYZ_SCALE (multiply by MD3_XYZ_SCALE to recover). |
146+
| S16 | Y | Y coordinate scaled by MD3_XYZ_SCALE (multiply by MD3_XYZ_SCALE to recover). |
147+
| S16 | Z | Z coordinate scaled by MD3_XYZ_SCALE (multiply by MD3_XYZ_SCALE to recover). |
148+
| S16 | NORMAL | Encoded normal vector (see Normals section). |
149+
150+
## Tags
151+
152+
Tags are volumeless vectors. Tags are primarily used in aligning separate MD3 objects in-game. For example, the Tag object in the railgun model is called 'tag_weapon', and the position (and rotation) of this Tag gets aligned with those of the Tag named 'tag_weapon' in the player model, dragging the rest of the railgun model over with the [railgun's] Tag object. The railgun model follows its Tag positions and rotations, which in turn follows the positions and rotations of the player model Tag object (most noticeable in taunt animation). Tags are also used to line up the torso with the legs, and the head with the torso, and so on.
153+
154+
## Normals
155+
156+
### Encoding
157+
158+
The encoded normal vector uses a spherical coordinate system. Since the normal vector is, by definition, a length of one, only the angles need to be recorded. Each angle is constrained within [0, 255], so as to fit in one octet. A normal vector encodes into 16 bits. (XXX: more blah)
159+
160+
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
161+
|---:|---:|---:|---:|---:|---:|--:|--:|--:|--:|--:|--:|--:|--:|--:|--:|
162+
| lat | lat | lat | lat | lat | lat | lat | lat | lng | lng | lng | lng | lng | lng | lng | lng |
163+
164+
(Code in q3tools/common/mathlib.c:NormalToLatLong)
165+
```C
166+
lng <- atan2 ( y / x) * 255 / (2 * pi)
167+
lat <- acos ( z ) * 255 / (2 * pi)
168+
lng <- lower 8 bits of lng
169+
lat <- lower 8 bits of lat
170+
normal <- (lat shift-left 8) binary-or (lng)
171+
```
172+
173+
Two special vectors are the ones that point up and point down, as these values for z result in a singularity for acos. The special case of straight-up is:
174+
```C
175+
normal <- 0
176+
```
177+
178+
And the special case of straight down is:
179+
```C
180+
lat <- 0
181+
lng <- 128
182+
normal <- (lat shift-left 8) binary-or (lng)
183+
```
184+
185+
or, shorter:
186+
```C
187+
normal <- 32768
188+
```
189+
190+
### Decoding
191+
192+
(Code in q3tools/q3map/misc_model.c:InsertMD3Model)
193+
```C
194+
lat <- ((normal shift-right 8) binary-and 255) * (2 * pi ) / 255
195+
lng <- (normal binary-and 255) * (2 * pi) / 255
196+
x <- cos ( lat ) * sin ( lng )
197+
y <- sin ( lat ) * sin ( lng )
198+
z <- cos ( lng )
199+
```

docs/engine/fileformats/models/md5.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Animated cameras for use in cut scenes.
3333
- `MD5MESH` compressed into a binary format. (.BMD5MESH)
3434
- `MD5ANIM` compressed into a binary format. (.BMD5ANIM)
3535
</TabItem>
36-
<TabItem value="etqw" label="Enemy Territory:QW">
36+
<TabItem value="etqw" label="Enemy Territory: Quake Wars">
3737
Unlike Quake IV, ET:QW reverted the approach that Quake IV did and instead of hardcode paths
3838
it now uses:
3939

docs/intro.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ This wiki/archival couldn't be possible by the works of the sites:
4646

4747
- [Doom Archives](http://doomarchives.com/)
4848
- [ModWiki](https://modwiki.dhewm3.org/)
49+
- [icculus.org](https://icculus.org/)
50+
- [The Darkmod Wiki](https://wiki.thedarkmod.com/index.php?title=Main_Page)

src/components/HomepageFeatures/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ const FeatureList = [
2222
title: "Prey (2006)",
2323
Svg: require("@site/static/img/prey.svg").default,
2424
description: (
25-
<>
26-
Documentation for Prey (2006) and its rather interesting developtment.
27-
</>
25+
<>Documentation for Prey (2006) and its rather interesting development.</>
2826
),
2927
},
3028
];

0 commit comments

Comments
 (0)