- Overview
- Quick Start
- Architecture
- Core Systems
- Directory Structure
- Building the Project
- Key Concepts
- Code Navigation Guide
- Further Reading
Arx Fatalis is a first-person action role-playing game developed by Arkane Studios and released in 2002. The source code was released under GPL in 2011, providing a complete example of a commercial game engine from the early 2000s era.
- Developer: Arkane Studios
- Release: November 2002
- Engine: Custom DirectX 7 engine
- Language: C++ with some C-style code
- License: GPL (Open Source since 2011)
- Lines of Code: ~150,000+
- Files: 251 source files (116 .cpp + 135 .h)
- Graphics: DirectX 7 (Direct3D)
- Audio: Custom Athena library with DirectSound + EAX
- Platform: Windows (Win32)
- Build System: Visual C++ 6.0 projects (.dsp files)
Recommended Reading Order:
- Start Here: Read this README and
CODEBASE_SUMMARY.md - Data Structures: Study
Include/EERIETypes.h- core game data structures - Game Loop: Look at DANAE's main game loop and update cycle
- Rendering: Examine EERIE rendering pipeline
- Pathfinding: Study MINOS pathfinding (fully documented example)
- Physics: Explore collision detection and physics systems
Common Modifications:
- Spell Effects: See
DANAE/ARX_SpellFX_Lvl*.cpp(10 spell level files) - Player Stats: Modify
DANAE/ARX_Player.cpp - NPC Behavior: Edit
DANAE/ARX_NPC.cpp - Item Properties: Adjust script files (not in this source tree)
Arx Fatalis uses a modular, component-based architecture with clear separation between subsystems:
┌─────────────────────────────────────────────────────────────┐
│ DANAE (Game Engine) │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Player │ │ NPC │ │ Script │ │
│ │ Management │ │ AI │ │ Interpreter │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Spells │ │ Particles │ │ Physics │ │
│ │ (10 levels) │ │ System │ │ Collision │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ EERIE (Rendering Engine) │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ 3D Objects │ │ Lighting │ │ Textures │ │
│ │ Animation │ │ Dynamic │ │ Management │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Polygon │ │ Camera │ │ LOD │ │
│ │ Rendering │ │ System │ │ (Meshes) │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Athena │ │ HERMES │ │ MINOS │
│ Audio Engine │ │ Resource │ │ Pathfinding │
│ (3D Sound) │ │ Management │ │ (A* AI) │
└──────────────┘ └──────────────┘ └──────────────┘
- Singleton Pattern - Debug logging (ArxDebug), managers
- Component-Based Entities - Game objects have modular data components
- Data-Oriented Design - Large structs with grouped data for cache efficiency
- Manager Pattern - Centralized resource management (textures, particles, lights)
- Object Pooling - Reuse of particles, effects, and temporary objects
Location: /DANAE/
Purpose: Main game logic, player systems, NPC AI, and gameplay mechanics.
Key Components:
- Files:
ARX_Player.cpp - Functionality: Character movement, camera control, inventory management, stats
- Key Structures: Player health, mana, stats, equipment
- Files:
ARX_NPC.cpp - Functionality: Enemy behavior, combat AI, dialogue
- Integration: Uses MINOS for pathfinding, scripts for behavior trees
- Files:
ARX_SpellFX_Lvl01.cppthroughARX_SpellFX_Lvl10.cpp - Functionality: Magic system with rune-based spell casting
- Features:
- Level 1: Basic spells (Magic Missile, Heal)
- Level 10: Advanced spells (Mass Paralysis, Control)
- Particle effects for each spell
- Mana cost and cooldown management
- Files:
ARX_Particles.cpp - Functionality: Visual effects for spells, weather, ambient effects
- Performance: Object pooling for efficiency
- Files:
ARX_Physics.cpp,ARX_Collisions.cpp - Functionality: Collision detection, damage calculation, object interaction
- Features: Cylinder-based collision for characters, mesh collision for objects
- Files:
ARX_Script.cpp - Functionality: Custom scripting language for interactive objects and quests
- Usage: Event-driven execution, state management
- Files:
ARX_Interface.cpp,ARX_Menu.cpp - Functionality: HUD, inventory screen, menus, dialogue boxes
Location: /EERIE/
Purpose: Low-level graphics rendering, animation, and visual systems.
Key Components:
- Files:
EERIEObject.cpp,EERIEPoly.cpp(142KB - largest file) - Functionality: 3D mesh loading, manipulation, rendering
- Format: Custom .TEO format for 3D models
- Features: Progressive mesh LOD, bone structure for animation
- Files:
EERIEAnim.cpp(112KB) - Functionality: Skeletal animation with keyframe interpolation
- Features:
- Bone hierarchy
- Animation blending
- Interpolation between keyframes
- Multiple animations per object
- Files:
EERIETexture.cpp(145KB) - Functionality: Texture loading, caching, management
- Formats: JPEG (via jpeglib), custom formats
- Features:
- Texture pooling and reuse
- Mipmapping
- Compression support
- Files:
EERIELight.cpp - Functionality: Dynamic and static lighting calculations
- Features:
- Point lights with falloff
- Colored lighting (RGB)
- Light intensity control
- Static lightmaps for performance
- Files:
EERIEDraw.cpp - Functionality: DirectX 7 polygon rendering
- Process:
- Visibility determination (portal culling)
- LOD selection based on distance
- Texture binding
- Polygon submission to DirectX
- Post-processing effects
- Purpose: Optimize rendering of large indoor environments
- How it Works:
- Scene divided into portal-connected rooms
- Only render visible rooms through portals
- Significant performance gain for complex levels
- Files:
EERIECloth.cpp - Functionality: Spring-mass system for realistic cloth
- Usage: Character clothing, banners, curtains
Location: /Athena/
Purpose: Custom 3D audio system for game sounds and music.
Key Features:
- 3D Positional Audio: Sound sources positioned in game space
- Streaming: Large audio files (music) streamed from disk
- Formats: WAV, ASF (Advanced Streaming Format)
- Codec: ADPCM compression for smaller file sizes
- EAX Support: Hardware-accelerated environmental audio effects
- Ambiance System: Layered ambient sounds for atmosphere
Key Files:
AthenaSample.cpp- Audio sample playbackAthenaStream.cpp- Streaming audio for musicAthenaAmbiance.cpp- Environmental sound managementAthenaMixer.cpp- Audio mixing and output
Location: /HERMES/
Purpose: File packaging, compression, and resource loading.
Key Features:
- PAK Files: Archive format for game resources
- Compression: Reduce file sizes for distribution
- Hashing: Fast resource lookup by name
- Clustering: Group related resources for efficient loading
Key Files:
HERMES_PAK.cpp- PAK archive format implementationHERMES_File.cpp- File I/O abstractionHERMES_Compression.cpp- Compression algorithms
Location: /MINOS/Minos_PathFinder.cpp
Purpose: AI pathfinding for NPC navigation.
Algorithm: A* (A-star) pathfinding
Key Features:
- Anchor-Based Navigation: Pre-placed waypoint network
- Configurable Heuristic: Balance between speed and optimality
- Stealth Mode: AI avoids lit areas when sneaking
- Behaviors:
- Move: Find path from A to B
- Flee: Move away from danger to safe distance
- Wander: Random patrol in area
- LookFor: Search around target position
Status: ✅ Fully documented - Study this file as an example of well-commented code
/arx/
│
├── DANAE/ # Main game engine (65 .cpp files)
│ ├── ARX_Player.cpp # Player character management
│ ├── ARX_NPC.cpp # NPC AI and behavior
│ ├── ARX_SpellFX_Lvl*.cpp # Spell effects (10 levels)
│ ├── ARX_Particles.cpp # Particle system
│ ├── ARX_Physics.cpp # Physics and collision
│ ├── ARX_Script.cpp # Script interpreter
│ ├── ARX_Interface.cpp # User interface
│ └── ... # 58 more game logic files
│
├── EERIE/ # 3D rendering engine (20 .cpp files)
│ ├── EERIEPoly.cpp # Polygon rendering (142KB)
│ ├── EERIETexture.cpp # Texture system (145KB)
│ ├── EERIEAnim.cpp # Animation system (112KB)
│ ├── EERIELight.cpp # Lighting system
│ ├── EERIEObject.cpp # 3D object management
│ ├── EERIEDraw.cpp # DirectX rendering
│ └── ... # 14 more rendering files
│
├── Athena/ # Audio engine (16 .cpp files)
│ ├── AthenaSample.cpp # Audio sample playback
│ ├── AthenaStream.cpp # Streaming audio
│ ├── AthenaAmbiance.cpp # Environmental audio
│ └── ... # 13 more audio files
│
├── HERMES/ # Resource management (10 .cpp files)
│ ├── HERMES_PAK.cpp # PAK file format
│ ├── HERMES_File.cpp # File I/O
│ └── ... # 8 more resource files
│
├── MINOS/ # Pathfinding (1 .cpp file)
│ └── Minos_PathFinder.cpp # A* pathfinding (FULLY DOCUMENTED)
│
├── Mercury/ # Utility module (2 .cpp files)
│ └── ... # Additional functionality
│
├── ArxCommon/ # Common utilities (1 .cpp file)
│ └── ARX_Common.cpp # Debug logging (FULLY DOCUMENTED)
│
├── Include/ # Header files (135 .h files)
│ ├── EERIETypes.h # Core data structures (IMPORTANT!)
│ ├── ARX_*.h # Game engine headers
│ ├── EERIE*.h # Rendering engine headers
│ ├── Athena_Types.h # Audio system headers
│ └── OtherLibs/ # Third-party library headers
│ ├── jpeglib.h # JPEG support
│ ├── eax.h # EAX audio
│ └── ...
│
├── lib/ # Pre-compiled libraries
│ └── otherlibs/
│ ├── Jpeglib.lib # JPEG image support
│ ├── zlib.lib # Compression
│ ├── eax.lib # 3D audio
│ └── ...
│
├── CODEBASE_SUMMARY.md # Detailed architecture document
└── README.md # This file
- Visual C++ 6.0 (or compatible compiler)
- DirectX 7 SDK
- Windows Platform SDK
- Debug: Full debug symbols, no optimizations
- Release: Optimized for speed, minimal debug info
All required libraries are included in /lib/otherlibs/:
- JPEG library (jpeglib.lib)
- zlib compression (zlib.lib)
- EAX audio (eax.lib, eaxguid.lib)
- DirectShow (amstrmid.lib)
What: Pre-placed waypoint network for NPC pathfinding
How it Works:
- Level designers place "anchor points" throughout the game world
- Each anchor has: position, links to neighbors, clearance (height/radius)
- NPCs use A* pathfinding to navigate between anchors
- See:
/MINOS/Minos_PathFinder.cpp(fully documented)
Data Structure:
typedef struct _ANCHOR_DATA {
EERIE_3D pos; // 3D position
short nblinked; // Number of connected anchors
short *linked; // Array of neighbor indices
float radius; // Clearance radius
float height; // Clearance height
long flags; // Status flags (blocked, etc.)
} ANCHOR_DATA;What: Game objects with scripts and behaviors
Structure:
typedef struct INTERACTIVE_OBJ {
EERIE_3DOBJ *obj; // Visual 3D model
char *script; // Script code
ANIM_HANDLE *anims; // Animations
INVENTORY_DATA *inv; // Inventory (if container)
EERIE_3D pos; // World position
float speed_modif; // Movement speed
long ioflags; // Object type flags
// ... many more fields
} INTERACTIVE_OBJ;How it Works:
- Player draws rune sequences with mouse
- Sequences map to spells (e.g., AAM + MEGA + STREGUM = Mass Lightning)
- Each spell has: mana cost, duration, particle effects
- Spell levels 1-10 implemented in separate files
Purpose: Optimize rendering performance
How it Works:
- Each 3D model has multiple detail levels
- Engine selects LOD based on distance to camera
- Smooth transitions prevent popping artifacts
Purpose: Efficiently render large indoor environments
How it Works:
- Level divided into "rooms" connected by "portals"
- Camera view frustum tested against portals
- Only render rooms visible through portal chain
- Massive performance gain for complex architecture
- Movement:
DANAE/ARX_Player.cpp→ARX_PLAYER_ManageMovement() - Combat:
DANAE/ARX_Player.cpp→ARX_PLAYER_Combat() - Inventory:
DANAE/ARX_Inventory.cpp→ inventory functions
- AI Update:
DANAE/ARX_NPC.cpp→ARX_NPC_Manage_Behaviour() - Pathfinding:
MINOS/Minos_PathFinder.cpp→PathFinder::Move() - Combat AI:
DANAE/ARX_NPC.cpp→ combat behavior states
- Main Draw:
EERIE/EERIEDraw.cpp→EERIE_DRAW_*functions - 3D Objects:
EERIE/EERIEObject.cpp→ object loading/rendering - Textures:
EERIE/EERIETexture.cpp→ texture management - Lighting:
EERIE/EERIELight.cpp→ light calculations
- Level 1 Spells:
DANAE/ARX_SpellFX_Lvl01.cpp - Level 10 Spells:
DANAE/ARX_SpellFX_Lvl10.cpp - Spell System:
DANAE/ARX_Spells.cpp→ spell management
- Play Sound:
Athena/AthenaSample.cpp→ sample playback - 3D Audio:
Athena/→ positional audio functions - Music:
Athena/AthenaStream.cpp→ streaming playback
Location: Include/EERIETypes.h
Key structures to understand:
EERIE_3DOBJ- 3D mesh objectINTERACTIVE_OBJ- Game object with scriptEERIE_CAMERA- Camera systemEERIE_LIGHT- Light sourceEERIE_3D- 3D vector (x, y, z)
// Simplified game loop structure
while (game_running) {
// 1. Input Processing
ARX_INPUT_Update();
// 2. Game Logic Update
ARX_PLAYER_Frame_Check(); // Update player
ARX_NPC_Manage_Behaviour(); // Update NPCs
ARX_SCRIPT_Timer_Check(); // Run scripts
ARX_PARTICLES_Update(); // Update particles
ARX_PHYSICS_Apply(); // Apply physics
// 3. Audio Update
ARX_SOUND_Update3DSource(); // Update 3D audio
// 4. Rendering
EERIE_DRAW_Scene(); // Draw 3D world
ARX_INTERFACE_Draw(); // Draw UI
// 5. Present
Flip(); // Show rendered frame
}-
Object Pooling
- Particles reused instead of allocated/freed each frame
- Reduces memory allocation overhead
-
Spatial Partitioning
- Portal-based culling for indoor areas
- Grid-based acceleration for collision detection
-
LOD System
- Multiple mesh detail levels
- Automatic selection based on distance
-
Texture Caching
- Textures loaded once and cached
- Reference counting for memory management
-
Data-Oriented Layout
- Structures organized for cache efficiency
- Hot data grouped together
File: ArxCommon/ARX_Common.cpp (fully documented)
Usage:
ArxDebug::GetInstance()->Log(eLog, "Message: %s", text);
ArxDebug::GetInstance()->Log(eLogWarning, "Warning: %d", value);
ArxDebug::GetInstance()->Log(eLogError, "Error: %s", error);Features:
- Color-coded output (normal, warning, error)
- Timestamped messages
- File logging to
../Log/Log__<timestamp>.txt - Hierarchical log tags for organization
Hierarchical Logging:
ArxDebug::GetInstance()->OpenTag("Initialization");
Log(eLog, "Loading textures...");
Log(eLog, "Loading sounds...");
ArxDebug::GetInstance()->CloseTag();// Typical error checking pattern
if (!resource) {
Log(eLogError, "Failed to load resource");
return FAILURE;
}// Allocation
texture = LoadTexture("player.jpg");
// Usage
if (texture) {
RenderWithTexture(texture);
}
// Cleanup handled by manager// Debug system
ArxDebug::GetInstance()->Log(eLog, "Message");
// Cleanup on shutdown
ArxDebug::CleanInstance();-
Fixed Function Pipeline
- No programmable shaders
- Limited per-pixel effects
- Lighting computed per-vertex
-
Memory Constraints
- Designed for 128-256MB RAM systems
- Aggressive resource pooling required
-
Single-Threaded
- No multi-threading
- All processing on main thread
- CODEBASE_SUMMARY.md - Detailed architecture overview
- ArxCommon/ARX_Common.cpp - Debugging system (fully commented)
- MINOS/Minos_PathFinder.cpp - Pathfinding (fully commented)
For Game Programmers:
- Study DANAE game loop and update cycle
- Examine spell system implementation
- Explore NPC AI and pathfinding
- Review physics and collision systems
For Graphics Programmers:
- Study EERIE rendering pipeline
- Examine lighting system
- Review texture management
- Explore animation system
For Audio Programmers:
- Study Athena audio architecture
- Examine 3D audio positioning
- Review streaming audio system
- Explore ambiance management
This is a study of historical game engine code. The original Arx Fatalis source was released under GPL.
For the open-source continuation of this engine, see:
- Arx Libertatis - Modern cross-platform port (https://arx-libertatis.org/)
GNU General Public License (GPL)
Copyright (C) 1999-2010 Arkane Studios SA, a ZeniMax Media company.
This source code is provided for educational and historical purposes.
- Arkane Studios - Original development
- ZeniMax Media - GPL source release
- Arx Libertatis Team - Continued open-source development
- Anchor: Waypoint in navigation mesh for pathfinding
- DANAE: Main game engine module name
- EERIE: 3D rendering engine module name
- Interactive Object: Game object with script and behavior
- LOD: Level of Detail - mesh complexity based on distance
- Portal: Connection between rooms for rendering optimization
- Rune: Symbol used in spell casting system
- TEO: 3D object file format (.teo extension)
Last Updated: 2025 For: Arx Fatalis GPL Source Code Study
For detailed architectural information, see CODEBASE_SUMMARY.md