Glacier Internals¶
This section explains how Hitman: Blood Money works inside: IO Interactive's Glacier engine as it shipped on the PlayStation 2, the game built on it, and the files on the disc. It is written for modders, reverse engineers and anyone curious about the engine. It describes the original game, independent of the port's additions.
- For changing the game, see Modding.
- For how the source was recovered and how the port replaces the PS2 platform code, see Development.
Every page comes from the decompiled source in src/, which compiles back into the original executable byte for byte, and cites the files it describes. Paths are relative to the repository root. Counts are over the PAL disc (SLES-53028).
Where the knowledge comes from¶
The disc holds two copies of the game's code. SLES_530.28 is the executable the console boots, with no symbols. HITMAN3.ELF has the same 3,638,588-byte .text section plus 31,000 symbols and IOI's full debug record: about 100 MB of .mdebug stabs with every source file path, class layout, function signature, local variable and line number. That record names the original source tree, which src/ follows file for file.
| Directory | Source files | What it holds |
|---|---|---|
src/engine/ |
509 | The Glacier engine: the object model, events, animation, physics, collision, path finding, audio, rendering, the GUI toolkit and the platform layer |
src/hitman3/ |
215 | The game: 47 and the other characters, cameras, level controllers, background behaviours, the HUD and menus |
src/common/ |
29 | IOI's containers and strings (zstl, which defines its own namespace std) and basic utilities |
src/audiolib/ |
60 | IOI's shared audio library: sound types, controllers, MIDI and wave handling |
src/scripts/ |
450 | The 14 levels' scene scripts as C: 34 shared scripts in Alllevels/ and 416 per-level files, compiling into 707 module objects |
The engine and the game¶
The engine runs a scene: a level loaded from one of the 71 archives on the disc (SCENES/<mission>/<scene>.ZIP), holding its geometry, objects, properties, collision, rooms, textures, sounds and text. Every object in a scene is a geom of a registered class. Geoms get behaviour from events attached to them, talk to each other with messages, and are described on the disc by property records that the serializer reads into their fields. Characters are geoms with an animation and AI layer on top, and the player is one of them.
Each level also has its scene scripts: C compiled into one module per level (SCRIPTCS/_GAMEREL/<LEVEL>.PS2, 14 modules holding 693 scripts) that run the mission's logic in states and call the engine through 716 script interfaces. A level controller class in the game code drives the mission around it: objectives, targets, the end of the mission, ratings and the newspaper.
The pages¶
| Page | Contents |
|---|---|
| Engine core | Startup, the main loop and the order of work in a frame, time, the platform classes, memory allocators, files and configuration |
| Geoms, classes and properties | The object model: geoms, class information and producers, references, properties and the serializer, and how a scene's objects are created |
| Events, messages and actions | How behaviour runs each frame, how objects message each other, and how 47's actions on objects are offered and run |
| Characters, AI and the player | Actors, 47, disguises, perception and alarms, animation and movesets, path finding and crowds |
| Gameplay and stealth systems | Doors, keycards, security zones, disguises, frisking, CCTV and VCRs, body containers, climbables, elevators, items, bombs, accidents and pause maps |
| Missions, scenes and scripts | The levels and their controllers, loading a scene, scene scripts and their interfaces, ratings, saves and the front end |
| Rendering | Visibility, draw lists, DMA packets, the VU1 programs, materials, lighting, shadows, water and post filters |
Scene scripts¶
| Page | Contents |
|---|---|
| Scene scripts as C | The 14 modules' 27,894 functions as C in src/scripts/, and how they rebuild byte for byte |
| Script SDK | The headers the scripts compile against |
| Script interfaces | The engine functions a script can call and how each call crosses the boundary |
| Message payloads | The structures messages carry between scripts and the engine |
| Script modules (.PS2) | The module files on the disc and how ScriptEngine::AttachSceneScripts loads them |
Scene formats¶
| Page | Contents |
|---|---|
| Scene archives (.ZIP) | The members of a scene archive, their load order and cross-references, and what a new scene needs |
| Geometry list (.GMS) | The compiled geometry tree that creates the scene's geoms (198,583 geoms in 35,318 groups across the disc) |
| Properties (.PRP) | The serializer stream with every geom's properties and controllers |
| Static buffer (.BUF) | Static data the geoms point into by offset |
| Prim data (.PRM) | Meshes: the prim records and their VIF streams |
| Textures (.TEX) | Texture records, pixel formats and palettes |
| PC materials (.MAT) | Material instances, texture bindings and shader layers in PC scene archives |
| Animations (.ANM) | Every animation of the scene, the variation tables and the meta keys such as footsteps |
| Collision trees (.OCT) | The scene's static bound and collision octrees |
| Room trees (.RMC, .RMI) | Rooms and portals for visibility |
| Sound (.SND, .WHD, .WAV) | Every sound, wave, set and controller record, and the wave headers and data beside the archive |
| Sound graph (.SGP) | The portals between rooms and the routes through them, for sound occlusion |
| Localisation (.LOC) | Interface text, names, briefings, newspapers and subtitles (56 of the 71 scenes have one) |
| Small members (.SUP, .ZGF, .SGD) | The remaining small members and their containers |
| VU microprograms | The 21 VU0 and VU1 programs in .vutext and what each draws or computes |