Research / Sonic Adventure DX / Format

Part 1 : The Format

All objects are stored in binary files in the game's /system dir. ALL object files start with "set" and the number/letter code afterward, which I will touch upon later.

Here's the outline of the format.

// Block 1 : The header
// The file is split into "object definition" blocks, each totaling $20 (0x20/32 dec) bytes
// The header simply states how many blocks are to be read. This is an important
// Value, and is quite versatile.
longword objectnum; // Defines howmany blocks to read
void null; // Covers the reast over the header, 28($1C) bytes long, and fills the restt
// of the block (thanks to Sintendo for pointing a mistake in this - drx)

// Part 2 : Definitions
// Each "block" ($20/32 dec bytes afterward) defines all of the properties for ONE
// object that is to be placed in the level.
byte type; // Determines what kind of object to place
byte null; // nothing
byte null; // nothing
byte xrot; // Object's x-rotation
byte null; // nothing
byte yrot; // Object's y-rotation
byte null; // Nothing
byte zrot; // Object's z-rotation
float xpos; // Object's x-position
float ypos; // Object's Y-position
float zpos; // Object's Z-position
float attrib1; // Misc. attribute/flag. Dependant on type;
float attrib2; // Misc. attribute/flag. Dependant on type;
float attrib3; // Misc. attribute/flag. Dependant on type;

Part 3 : Tricks
The objectnum value is quite actually quite versatile, contrary to what one may think. Remember, the game will ONLY read how many objects you tell it to. So you can decrease the number, and objects will be removed (in inverse order, starting with last object first), without having to delete the data. You can utilize this to test and see where an object file is crashing, or add text/data to the end of the file, either to store old builds, or just add an easter egg for the more technically inclined user.

Part 4 : Getting values
While typing in random numbers is GREAT if you're a masochist, most of us normal developers prefer to get their numbers from the game itself. There are 2 ways to do this. The first, and easiest, is to become acquainted with a memory editing/viewing package (read : I use cheat engine for this), and refrence the adresses :

03B2CAB0 (x-position of character)
03B2CAB4 (y-position of character)
03B2CAB8 (z-position of character)
(all floats)

These adresses will always display the user's current position in a level.

Another method I'm looking into, is ripping an obj file from either the DC geometry file, and finding the coordinates in a model editor, or doing the same, but from sonic.exe
One last thing you'll need before you can sucessfully edit a file, is a list of availiable/working object types.

Part 5 : Final tips
Before I close, I'd like to touch upon 2 final topics. One being the filenaming system the game uses, and the other being a short list of universal object types.
In SA, filenames work in a fashion much like ths one :

Types documented :

CAM - Camera binary
SET - Object binary

Levels : Action Stages are numbered with the appropriate segment (level part) following suit immediately afterward. ALL FILENAME NUMBERS ARE DECIMAL VALUES. No matter how used you are to using hex values to designate levels during memory editing, the filenames are always decimal. No exceptions.
Other levels (boss, adv, etc) are actually given a name, instead of being numbered.

The character designations are one letter, as follows :
A- Amy
B - Big
E - E102 Gamma
K - Knucles
M - Tails
S - Sonic

And the final thing for this guide, is the universal (or close to it) object types. These are USUALLY universal, but technically still level-specific. They're just the same for damn near all the levels. BUT, they are different (as proven by the final boss' object set)
Said common types are as follows :

00. Ring
01. Spring
02. Spring
03. Dash Panel
04. Spinning Spike Ball + Chain
05. Falling Spike Ball
06. Spikes
07. Nothing
08. Egg prison
09. Switch
0A. Plant
0B. Dash hoop

Back | Printer friendly
<< 2. How to Add a Dash Panel

© 2004, 2005 drx, Don't copy without permission yadda yadda yadda.