Medal Of Honor Reverse Engineering Project
Introduction
This page contains some information about my reverse engineering project for the Playstation
game Medal Of Honor by Dreamworks Interactive, released in 1999.
A level viewer binary was supposed to be forthcoming, but don't hold your breath.
Space Partitioning
Each MOH level is subdivided into several partitions (I believe the developers called them
'compartments'). These are stored into individual TSP files, several for each level.
MOH uses binary tree space partitioning stored in a balanced AABB tree, for frustum culling
and depth sorting, a necessity due to the lack of z-buffer on the PSX.
The level geometry looks wobbly here and there, a side effect caused by compressing vertex
attribute data to 16-bit integers.
Where the Playstation required extreme optimization to render large levels, on a relatively
modern PC the entire level can be dispatched to the graphics hardware in one single batch.
Textures
MOH's textures are stored in regular TIMs, packed together in a resource file for each level.
These are positioned into VRAM at load time, but not swapped or updated at runtime AFAIK.
My level viewer loads them into seperate textures to avoid edge seems when bi-linear
filtering is enabled. I had to figure out the texture page layout by looking at the texture
coordinates. The TIMs include information about the placement in VRAM (i.e. the page location).
The multiplayer levels leave a page empty so the user selected player character textures
can be loaded into these slots at load time.
Collision Detection
Each level partition contains collision geometry. This is derived from the visible level
geometry, but simplified to speed up collision routines. There does not seem to be any
partitioning information however, I believe it may be stored outside the level geometry
files, or utilizes the AABB tree of the visible geometry somehow.
I suspect the developers made use of the "Optimize" Editable Mesh modifier in 3dsmax due
to the ineffective collision mesh simplification (in some levels the polygon reduction
ratio is as bad as 5%, while there clearly is room for further optimization).
Audio
The in-game effects are stored in VABs, which are binary containers for VAGs, a generic PSX/Sony audio
format. The wave data is stored in ADPCM format, with 16 bytes for each packet. Have yet to
write a decoder for it, but there are some generic tools that work on these files
(courtesy of Hitmen).
The music is stored in CD audio tracks AFAIK, these are a bit problematic to recover but
can be found elsewhere.
Screen Shots
These are some early screenshots taken in my experimental level viewer. Transparancy and alpha testing
were disabled due to broken OpenGL drivers (*cough* Intel).
Notice the clever use of vertex color lighting in the first image.