Sonic Adventure 2/Object Editing
From Sonic Retro
Revision as of 15:12, 30 April 2020 by En Passant (talk | contribs) (→Object lists: It's probably easier to link to the spreadsheet containing lists rather than try and keep this page up to date with everything. There's a lot of stuff. The page would be very, very long.)
SCHG: Sonic Adventure 2 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dreamcast GameCube PC | ||||||||||||
|
Level layouts are stored as .bin files.
For the Dreamcast version, they are in the /SONIC2 directory of the disc.
For the GameCube version, they are in the root of the disc.
For the PC version, they are in the \resource\gd_PC subfolder of the installation directory.
Note: In the GameCube and PC versions, these files are in big endian byte order! You'll need to convert them with SETswitch if you want to edit them with a program other than a hex editor, then convert them again before putting them back in the game.
File Name layout
Level object files for levels 59 and under are always in the same format:
SETLLLL(_SS)(_D).BIN
Where LLLL is the level number, SS (optional) is the mode, and D is the definition type. See below for usable values.
Listing of levels
- 0000 - Test Level
- 0003 - Green Forest
- 0004 - White Jungle
- 0005 - Pumpkin Hill
- 0006 - Sky Rail
- 0007 - Aquatic Mine
- 0008 - Security Hall
- 0009 - Prison Lane
- 0010 - Metal Harbor
- 0011 - Iron Gate
- 0012 - Weapons Bed
- 0013 - City Escape
- 0014 - Radical Highway
- 0016 - Wild Canyon
- 0017 - Mission Street
- 0018 - Dry Lagoon
- 0021 - Sand Ocean
- 0022 - Crazy Gadget
- 0023 - Hidden Base
- 0024 - Eternal Engine
- 0025 - Death Chamber
- 0026 - Egg Quarters
- 0027 - Lost Colony
- 0028 - Pyramid Cave
- 0030 - Final Rush
- 0031 - Green Hill
- 0032 - Meteor Herd
- 0034 - Cannon's Core part 5 (Sonic)
- 0035 - Cannon's Core part 2 (Eggman)
- 0036 - Cannon's Core part 1 (Tails)
- 0037 - Cannon's Core part 3 (Rouge)
- 0038 - Cannon's Core part 4 (Knuckles)
- 0040 - Final Chase
- 0043 - Cosmic Wall
- 0044 - Mad Space
- 0045 - Sand Ocean 2P
- 0047 - Pyramid Race (SA2B 2P Only)
- 0049 - Pool Quest (SA2B 2P Only)
- 0050 - Planet Quest (SA2B 2P Only)
- 0051 - Deck Race (SA2B 2P Only)
- 0052 - Downtown Race (SA2B 2P Only)
- 0054 - Grind Race (SA2B 2P Only)
- 0070 - Route 101
- 0071 - Route 280
- 0090 - Chao World
Modes
- 2P - 2 Player
- HD - Hard Mode
Definitions
- S - Substantive Objects? (most of the objects important to the level layout are defined here)
- U - Unsubstantive Objects? (objects defined here are usually decorative, but functional objects can be defined here all the same)
There is no clear-cut evidence yet about what the S and U stand for; this is the spot in the filename that was used in SA1 and SADX to disambiguate between multiple characters that play the same levels. Since that isn't an issue in this game, you could make the case that only one object file is needed for each mode, but they made two, so we're stuck with two, both of which get loaded.
One notable difference that holds without exception is that every object definition in the S files has a 0x00 in its second byte, while every object definition in the U files has a 0x80 in that byte.
Examples
- SET0013_HD_S.BIN - City Escape Hard Mode
NOTE: If there is no file for a certain character in a level, it will load Sonic's file by default. If there is no file for Sonic, then no objects will be loaded. This can be corrected, though. Simply copy the appropriate file and rename it accordingly and the objects will appear in the level with that character.
The Object format
Header
Every file starts with a 32 byte (20 in hex) header in the following format, where red is an unsigned integer containing the total amount of objects in the level.
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(If you ever forget the amount of objects, take the offset of the very last object, divide in hex by 20, and convert to decimal.)
Body
Objects are defined after the header in the following format:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- The first byte, and part of the next byte are an unsigned short for the object type. You can find what value corresponds to each object here.
- This determines the lowest clipping level the object can appear on. 0 = Low (always), 1 = Normal, 2 = High
- This unsigned short is the X rotation of the object in BAMS (Binary Angle Measurement System).
- This unsigned short is the Y rotation of the object in BAMS.
- This unsigned short is the Z rotation of the object in BAMS.
- Note: To convert from degrees to BAMS: (degrees * 65536.0 / 360.0) = BAMS.
- This float is the X position of the object.
- This float is the Y position of the object.
- This float is the Z position of the object.
- This float is the object's first property.
- This float is the object's second property.
- This float is the object's third property.
Special objects
Beetle (E KUMI)
- X Scale - Type of Beetle:
- 0 - Normal
- 1 - Follows
- 2 - Electric
- 3 - Electric
- 4 - Gun
- X Rotation - Number of bullets fired at once
- Y Scale - Speed of bullets
- 5 - Appears
- 6 - Spring
- 7 - Bomb
- X Rotation
- 4 - May spawn rings?
- Y Scale - Time (in 1/100 sec) between bombs
- X Rotation
Object lists
An ongoing documentation of object lists and the functions of objects can be accessed below:
Each object is given by its ID, codename (the verbatim text string from the level file that corresponds to that slot), and a readable description of just what that object is. Apart from the first few stages that were created (Green Forest, White Jungle, Pumpkin Hill, Sky Rail, and Aquatic Mine), the team settled into a common scheme for shared objects, so the first 50 or so object IDs will usually be the same across levels.
Programs
If all that stuff above confuses you, there are two programs for editing objects.
DXEdit
- Main Article: DXEdit
This is a simple tool that allows you to edit objects in a numerical format.
SETedit
- Main Article: SETedit
This tool allows you to see names for objects, get position data from a running copy of SADXPC, and has a 3D preview window with customizable sprites.
References