A4 Programmer’s Manual © Conitec 2000 1
3D GameStudio
A4 Programmer's Manual
© 1999, 2000 Johann Christian Lotter / Conitec GmbH
A4 Programmer’s Manual © Conitec 2000 2
This manual is protected under the copyright laws of Germany and the U.S. Any reproduction of
the material and artwork printed herein without the written permission of Conitec is prohibited. We
undertake no guarantee for the accuracy of the information given. Conitec reserves the right to
make alterations or updates without further announcement.
A4 Programmer’s Manual © Conitec 2000 3
Contents
The A5 DLL interface _________________________________________________________ 4
WDL object structures ____________________________________________________________ 4
The WMP map format________________________________________________________ 6
Blocks __________________________________________________________________________ 8
Map Properties___________________________________________________________________ 9
The MDL model format _____________________________________________________ 10
MDL file header_________________________________________________________________ 10
MDL skin format ________________________________________________________________ 11
MDL skin vertices _______________________________________________________________ 11
MDL mesh triangles _____________________________________________________________ 11
MDL frames ____________________________________________________________________ 12
MDL bones _____________________________________________________________________ 13
A4 Programmer’s Manual © Conitec 2000 4
The A5 DDL interface
DLLs are customer-programmed extensions to the engine and to the WDL language. They can be
used with the commercial and professional editions, but can only be created with the SDK (source
development kit) that comes with the professional edition. This way, professional edition owners
can create arbitrary DLLs for adding new effects, actor AI or WDL instructions, and distribute or
sell them to other 3D GameStudio users.
The Microsoft Visual C++ development system is required for creating DLL extensions. The DLL
SDK contains an interface library that must be linked to any DLL. An example VC++ project with a
DLL template is also provided, which makes it pretty easy to create extensions even for not-soexperienced C programmers who have never used DLLs before.
DLL extensions work bidirectionally: WDL instructions can access DLL functions, and DLL
functions can access essential engine functions and variables. On opening a DLL, the engine
transfers the pointer to an internal interface structure to the interface library. The interface contains
pointers to engine variables and functions, like the frame buffer, the DirectX interface, the network
interface, the DirectInput interface, the level, the WDL functions and so on. Theoretically everything
- MP3 or MOD players, a physics engine, another 3D engine or even another scripting language could be added to the engine this way.
On accessing system resources like sound, video, joystick and so on, the DLL must take care of
possible resource conflicts. The engine shares its resources and expects the same from the code
inside the DLL. For instance, code that requires exclusive access to the sound device (like some old
MOD players) won't work. Some resources (like the midi player) can't be shared - if midi music is
played by the DLL, the engine must not play a midi file at the same time and vice versa. Also care
must be taken that for writing something into the frame buffer it must be locked before, and
unlocked afterwards. The interface library provides functions for that.
WDL object structures
Pointers to WDL objects can be transferred to DLL functions, thus allowing object manipulation.
The internal engine format of important WDL objects is listed here.
typedef long fixed; // internal 22.10 fixed point number format
typedef struct {
long index; // A4 internal use only
char *name; // A4 internal use only
long next; // A4 internal use only
long modelindex; // A4 internal use only
// the following variables can be externally used by WDL or DLL functions
fixed x,y,z; // position of the entity
fixed pan,tilt,roll; // angles
fixed scale_x,scale_y,scale_z;
long flags;
fixed frame; // model or sprite frame
fixed nextframe; // next frame for inbetweening
fixed skin; // skin number
fixed ambient; // brightness added to the entity, in percent
fixed alpha; // transparency of the entity, in percent
fixed lightrange; // range of dynamic light emitted by the entity
fixed red,green,blue; // colour of dynamic light emitted by the entity
long emask; // event enable flags
long eflags; // internal status flags
A4 Programmer’s Manual © Conitec 2000 5
fixed min[3],max[3]; // bounding box
fixed trigger_range;
fixed push; // collision behaviour
fixed shadow_range; // range within a shadow is projected onto to the floor
fixed floor_range; // range within the entity reflects light from the floor
long client_id; // client who has created this entity (when in multiplayer mode)
fixed skill[48]; // entity skills
} A4_ENTITY;
(to be continued)