5online

New OpenedCF is out: TeamVanilla’s free Windows viewer that opens CrossFire’s maps, weapons and characters in 3D, straight from your own install. See OpenedCF

Educational & research material. TeamVanilla documents how the game is built for study and preservation — we do not endorse or teach cheating.

CFireSDK

For developers · from TeamVanilla

A C++ library for reading CrossFire’s own files — archives, textures, models, maps and the data tables the game runs on — plus the class model and runtime facts recovered from the game itself. It is what OpenedCF and this site are built on.

Get told when it’s out The public release is being prepared. The Discord hears first.
Classes recovered 705 from build US_V1901
Content tables 139 weapons, characters, maps, modes, items
Classes laid out 541 2,392 fields placed
Dependencies 0 headers only; liblzma optional

Two halves

The files on disk. Header-only readers for CrossFire’s own formats — archives, textures, models, worlds and the content tables — plus the class model and table schema recovered by static analysis of the game’s binaries. This half works entirely offline, on your own install.

The game as it runs. A layer of constants recovered from a live client: the Direct3D 9 draw path, the vertex formats, the network protocol, the module map and the timing windows, together with what was learned about which hooks are safe and which crash the game. These are observed facts, published as data. They came from hooking and instrumenting a running client during our own diagnostics — work written up in full in the CrossFire Encyclopedia. The headers carry what that work found; what you do with it is your own.

What it reads

HeaderWhat it readsStatus
core.hppResult and error types, and a bounds-checked little-endian byte reader every other part is built onStable
geometry.hppVectors, quaternions, 4×4 matrices and bounding boxes, with the camera and 3×4 bind-matrix helpers the model and world code useStable
formats.hppThe on-disk format constants and the helpers that identify a file from its first bytesStable
rez.hppREZ archives: open one, list it, pull a file out — including the directory cipher that unlocks the packed RF archivesWorks
dtx.hpp · image.hppDTX textures (DXT1, DXT3, DXT5 or 32-bit) to plain RGBA, and a BMP writer so you can see the resultWorks
ltb.hppLithTech models: meshes, the bind-pose skeleton and animation names (LZMA decode built in with liblzma)Meshes work
world.hppLithTech worlds (.DAT): the container, its sections, and the objects placed in it — spawns, weapon-spots, flags, doors, lightsObjects work
content.hppThe scripts (.ENC/.nut) and content tables (.CFT) the game is driven by, decrypted into records: weapons, skills, modes, AIWorks
cf_generated.hppThe recovered class model, the 139 content-table names and the symbol catalogue, generated from the SDK’s data filesGenerated
runtime.hppConstants recovered from a live client: D3D9 vtable slots, FVF codes, texture formats, the network protocol, the module map and hook timingConstants

One include brings in all of it: #include <cfsdk/cfsdk.hpp>. Every call returns a checked result and never throws — a truncated file is an error, not a crash. The one piece still being worked out is the baked render mesh inside a world file; its container and placed objects already read.

Start in a few lines

Use it
#include <cfsdk/cfsdk.hpp>      // one include brings in everything

// Decode a texture you have on disk and write it out as a picture.
cfsdk::Image img;
if (cfsdk::dtx_load("observer_C4.DTX", img))
    img.write_bmp("c4.bmp");             // img.w x img.h

// Read a map's placed objects straight from the world file.
for (auto& o : cfsdk::world_read_objects("EM_ALASKA.DAT"))
    if (o.name.find("weaponspot") != std::string::npos)
        /* o.x, o.y, o.z */;

// The recovered model is plain constants, checked when you compile.
static_assert(cfsdk::kContentTableCount == 139);
auto weapons = cfsdk::ContentTable::ADDWEAPON;
Build the example tools
cmake -S . -B build
cmake --build build

build/dtx2bmp observer_C4.DTX c4.bmp     # a texture as a picture
build/datinfo EM_ALASKA.DAT              # a map's sections
build/ltb2obj model.ltb model.obj        # a model for any 3D program
build/rezls   engine.rez                 # what an archive holds

Names in the sample follow the SDK’s headers. The function guide that ships with it lists every call.

Checked against the real files

Every reader has a small Python twin in tools/ that needs no compiler. Each was run against real game files and its result checked by eye before the C++ was written — so what the SDK claims to read, it has read. They are handy on their own, too.

Textures & models

Textures to imagesdtx_ref.py

Decodes a LithTech DTX texture — 32-bit BGRA or DXT1/3/5 — and writes a 24-bit BMP you can open anywhere.

Verified · observer_C4.DTX → the exact 32×32 C4 HUD icon

Model metadataltb_ref.py

Decompresses an .ltb (LZMA) to the LithTech Model v9 binary and lists its name table: pieces, nodes and sockets like “l_body”.

Verified · container + skeleton names confirmed

Models to OBJltb_to_obj.py

Finds each mesh’s vertex and index buffers by their 32-byte signature and writes a Wavefront OBJ any 3D program opens.

Verified · “Box004” → 28 verts, 12 tris, a closed box

Worlds & maps

Map containerdat_ref.py

Reads a world .DAT (version 85) and dumps its six-section map, every offset in-bounds and in order.

Verified · verified across all 194 maps

Map point clouddat_points.py

Pulls the WorldModel points out of the leading region and writes the vertices as an OBJ cloud.

Map BSP layoutdat_geometry.py

Maps the world’s collision/PVS BSP — the plane and point arrays and the topology laid out between them.

Verified · first planes and points match the map’s bounding box, every map

Content & text

Content tablescf_cft.py

Decodes a .CFT table — LZMA, then XOR, then fixed-width columns — to text or CSV, header row and all.

In-game textcf_msz.py

Resolves the message tables the UI points at by id, turning MSG numbers back into the strings players read.

Verified · id 1 = “%s - Select Channel”

Effect catalogueclientfx_ref.py

Parses the ClientFX index into every client effect — muzzle flashes, tracers, explosions, buff auras — and its group tree.

Archives

Open archivesrez_ref.py

Lists an unencrypted RezMgr .rez archive — the reference reader the C++ mirrors.

Verified · engine.rez → CONSOLE_FONT and the rest

Packed archive namescf_rez_index.py

Decrypts the encrypted RF archive directories with the recovered cipher and lists every packed file by name.

What each RF holdscf_rez_inventory.py

Labels every numbered RF archive by its contents, so “RF016” reads as “weapon and character models”.

Generation

Regenerate the headersgen_sdk.py

Turns the recovered catalogues in data/ into the generated header, baking the counts in as compile-time checks.

The recovered data

The class model and table schema are shipped as plain files in data/, so you can search, diff and build against them without the headers. gen_sdk.py turns these into the generated header; re-run the static pass on a new build, regenerate, and the compile-time counts catch anything that drifted.

  • classes.csv · classes.json705 recovered RTTI classes, with the binary each came from
  • class_catalogue.jsonThe same classes grouped: engine, game tables, bindings
  • content_tables.csv · content_tables.json139 content tables, categorized, with what references each
  • cf_symbols.jsonThe recovered function and symbol catalogue
  • messages_us.jsonThe game’s message table: every on-screen string by id

The game, written down

CrossFire is table-driven: weapons, characters, maps and modes are rows in 139 content tables, read by 705 classes in the engine and game code. The SDK carries the names of all of them, and where each class keeps its fields — 2,392 offsets across 541 classes. When a new game build comes out, the data is read again and the headers are regenerated; if anything moved, the build stops and says so.

The same model is written up in plain words in the Encyclopedia, starting at Game files.

The game as it runs

from a live capture, build US_V1901

These are compile-time constants in runtime.hpp, recovered from a single live client session. They describe how the game draws, talks and loads. Nothing here runs anything.

The Direct3D 9 draw path

Eleven device vtable slots were confirmed in use. The catch worth knowing: CrossFire streams all its geometry through the user-pointer draw calls — DrawPrimitiveUP (slot 83) and DrawIndexedPrimitiveUP (slot 84). The plain DrawPrimitive (81) and DrawIndexedPrimitive (82) exist but are never called, so anything that watches only those sees zero draws. Steady state in the lobby runs ~86 draw calls and ~172 primitives a frame at ~240 FPS.

BeginScene41
EndScene42
DrawPrimitive81
DrawIndexedPrimitive82
DrawPrimitiveUP83
DrawIndexedPrimitiveUP84
SetTexture65
SetRenderState57
CreateTexture23
CreateVertexBuffer26
CreateIndexBuffer27

Vertex formats, textures and memory

fvf::kBasicXYZ + Normal + 1 tex — terrain and static propsstride 16
fvf::kDiffuse+ diffuse colour — vertex-coloured geometrystride 20
fvf::kSpecular+ specular — character and weapon meshesstride 24
fvf::kFull+ diffuse + specular — environment and map geometrystride 40
texfmtDXT1 (opaque), DXT5 (alpha), X8R8G8B8 and R5G6B5 render targets, INDEX16—
mem~227 MB executable, ~49 MB writable at launch—

The network protocol

Auth / world portsLogin on 13008, game world on 10009; three NA endpoints—
Packet framingStart byte 0xF1, end byte 0xF2—
OpcodesLogin 0x01F4, heartbeat 0x0009, world state 0x4C3C—
CEF / lobbyLobby origin crossfire.z8games.com, with the full connect-src allowlist; blob Workers are blocked by CSP—

The module map (nine key modules with their observed bases) notes that the proxy dinput8.dll, not the system one, is the vtable to hook, and that BugTrap-x64.dll sits at a fixed base to watch for collisions.

What was learned about hooking

We recovered the constants above by hooking a running client ourselves, and in doing so learned which hooks hold and which bring the game down. This is that record — the methodology, for study and for anyone researching how the engine behaves. It is knowledge, not a cheat: it points at no one else’s game and ships no injector of its own.

TargetHook typeResult
D3D9 device vtableVTable Safe (11/11) — one COM object, no system-wide effect
ws2_32 Winsock callsTrampoline Safe (8/8) — leaf API: send/recv/connect/closesocket…
System observationNone — scanning Safe — read-only Win32 queries (EnumProcessModules, VirtualQuery)
kernel32 functionsTrampoline Crashes — patches the loader/CRT, game fails at startup
IAT without a module nameIAT Silent fail — installs without error, detour never called

Install before these deadlines

WindowDeadlineWhat fires
WinsockT+1.3sWinsock hooks must be live before the first connect() to the auth server
D3D9 vtableT+33sThe D3D9 device is created lazily, after login — install vtable hooks here
Geometry burstT+35sThe vertex/index buffer allocation storm begins
LoginT+57sThe first login packet is sent
WorldT+117sThe game world connection is established

What runs on it

Ground rules

CFireSDK is read-only and header-only: the file readers run on your own installed copy of CrossFire and ship none of the game’s content. The runtime layer is observed data — recovered by capturing a live client and written up in full in the CrossFire Encyclopedia. That research reaches into how the game draws, loads and communicates, and it shows the client can be hooked and instrumented; the constants and findings here are what came out of it.

We publish all of it for one reason: to understand and preserve how CrossFire is built. TeamVanilla does not make, endorse or teach cheats, and nothing here is for use against other players or any live service. What you do with this knowledge is yours, and yours to be responsible for. If you build something in that spirit, we would like to see it: show us on Discord.