How aheadley/homeworld works
1. This repository is the source release of the original Homeworld PC game. Architecturally it is a classic Windows game split into a runtime executable, a large shared game engine, a content repository, and a separate production/tooling pipeline.
2. The runtime entry point is the Win32 layer under src/Win32, which contains main.c, render/audio/input glue, DirectDraw/Direct3D setup, optional 3dfx/Glide support, windowing, screenshots, and low-level platform services. This layer is the boundary between the OS and the game engine.
3. The core gameplay engine lives in src/Game. It owns the universe simulation, object model, physics, combat, selection/camera, UI, save/load, objectives, resources, taskbar/menus, and single-player/multiplayer session control. Most higher-level systems are exposed here as C modules and headers rather than as a modern subsystem framework.
4. AI is a major internal subsystem inside src/Game, organized into dedicated managers for attack, defense, fleets, resources, teams, movement, and orders. The AI layer talks to the rest of the engine through shared object, command, and team abstractions rather than directly manipulating rendering or platform code.
5. Ship behavior is factored into src/Ships, where each ship or structure type has its own module plus a shared default implementation. These modules plug into the game object system and define race-specific variants, production units, support units, and special structures.
6. Campaign and scenario logic is driven by scripting and mission data. src/SinglePlayer contains mission scripts and mission databases, while src/Game/KAS* implements the KAS scripting runtime and helpers. The tutorial system and mission objectives connect scripted events to in-engine triggers and state changes.
7. Multiplayer is a distinct subsystem. src/Game/Multiplayer*, titannet, CommandNetwork, and related modules implement session flow, networking, chat, commands, and synchronization. The src/Titan tree provides the underlying network/auth/message framework used by Homeworld’s online services and multiplayer transport.
8. Rendering and media are supported by several specialized code paths. src/rgl is the low-level graphics layer with software, Direct3D, and Glide-era backends, while src/JPG provides JPEG decoding. The tree also includes Bink/Smacker libraries and sound banks, showing that video, audio, and speech are integrated as separate asset pipelines rather than being generated at runtime.
9. The content side is large and format-driven. EB Levels holds built level assets such as .level, .mdr, .HSF, .btg, .missphere, and .dist files, while sound/ stores speech and SFX bank definitions. The game runtime loads these authored assets directly, so the diagram should show a strong “data files into engine” path.
10. tools/win32 is the production toolchain that feeds the game. It includes exporters and editors for missions, textures, fonts, sound effects, bigfile packing, CD keys, video tweaks, and object/level conversion (MissionMan, Biggie, BTG, Paco, FEMan, SFXTool, SPTool, etc.). These tools generate the formats consumed by the runtime and are part of the build/content pipeline, not the shipped game loop.
11. The repository also carries external dependencies and platform libraries under Lib/ and src/Titan//src/rgl/, including DirectX, Glide, and custom WON/Titan networking components. These dependencies materially shape the architecture because they define the game’s rendering, networking, and service integration boundaries.
12. For an architecture diagram, the clearest top-level view is: Windows executable and low-level drivers on one side; the core game engine in the middle; ship/AI/script/multiplayer modules around it; and a separate asset/tool pipeline feeding mission, level, sound, and archive data into the runtime.
Main entry points: Game Game core · SinglePlayer Single player · main.c Win32 layer · render.c Device glue
Components 19
Runtime
Windows executable and platform layer
- Homeworld.exe · Shipped Windows game executable
exe/Homeworld.exe - Win32 layer · OS boundary, launcher, and low-level platform services
src/Win32/main.c - Device glue · DirectDraw, Direct3D, Glide, sound, input, and screenshots
src/Win32/render.c - rgl · Software, Direct3D, and Glide-era rendering layer
src/rgl
Game Engine
Core simulation, AI, scripts, multiplayer, and ship behavior
- Game core · Universe, objects, physics, combat, UI, save/load, and session control
src/Game - AI managers · Attack, defense, fleets, movement, orders, teams, and resource AI
src/Game/AIHandler.c - Ship modules · Per-ship and per-structure behavior modules plus defaults
src/Ships - Single player · Mission scripts, mission databases, tutorial flow, and objectives
src/SinglePlayer - KAS runtime · Mission scripting runtime and helper functions
src/Game/KAS.c - Multiplayer · Session flow, chat, commands, and synchronization
src/Game/MultiplayerGame.c - Titan network · Underlying WON/Titan networking and service integration
src/Titan
Content
Authored assets and mission data loaded by the game
- EB Levels · Authored level, mission, geometry, and scenario data
EB Levels - Sound banks · Speech and SFX bank definitions consumed by the runtime
sound - Tutorials · Tutorial mission scripts and databases
src/Tutorials
Toolchain
Editors and exporters that produce runtime data
- Mission tools · MissionMan and mission-format tooling for authored scenarios
tools/win32/Mission - Asset tools · Geometry, texture, font, and package conversion tools
tools/win32 - Audio tools · Speech and SFX bank builders and related asset editors
tools/bin/SFXTool
Dependencies
External libraries and service SDKs
- DirectX libs · DirectDraw, Direct3D, DirectInput, and sound libraries
Lib/d3d - Titan libs · Compiled Titan/WON client libraries
Lib/Titan
Connections 19
- Homeworld.exe → Win32 layer: starts in · Executable enters through the Win32 platform layer
- Win32 layer → Device glue: configures · Initializes graphics, audio, input, and window services
- Device glue → rgl: drives · Platform layer delegates rendering to the graphics backend
- Win32 layer → Game core: boots · Platform layer hands control to the game engine
- Game core → AI managers: hosts · Core simulation provides shared state and command/object abstractions to AI
- Game core → Ship modules: invokes · Object model resolves ship- and structure-specific behavior modules
- Game core → Single player: runs · Core engine executes mission and campaign flow
- Single player → KAS runtime: scripts via · Mission logic is executed through KAS scripting support
- Game core → Multiplayer: coordinates · Session control and in-game multiplayer state live in the engine
- Multiplayer → Titan network: uses · Multiplayer/network features depend on Titan/WON messaging and transport
- Device glue → DirectX libs: links · Rendering and device setup are backed by DirectX-era libraries
- Multiplayer → Titan libs: links · Online services and transport use Titan libraries
- EB Levels → Game core: loaded by · Runtime loads level and mission assets directly into the engine
- Sound banks → Game core: loaded by · Speech and SFX banks are consumed by runtime audio systems
- Tutorials → Single player: feeds · Tutorial data is consumed by the single-player mission flow
- Mission tools → Single player: generates · Mission editors produce .kas and mission database content
- Asset tools → EB Levels: produces · Exporters and packers generate level, geometry, and archive assets
- Audio tools → Sound banks: produces · Audio tools build the speech and SFX bank assets
- Asset tools → rgl: supports · Texture and geometry tools align with rendering formats and pipelines