FF7/Battle/Battle scenes
Contents
Introduction
FF7 keeps each enemy battle configuration is a file called "scene.bin" This file is located in the following directories.
PSX Version | PC Version |
---|---|
/DATA/BATTLE/SCENE.BIN | /BATTLE/SCENE.BIN |
This file is exactly the same in both versions. This holds all the battle configurations for all enemies encountered in the game.
Scene.Bin file format
Overview
The scene.bin file contains 256 gziped files which give us information for all the FF7 monsters. In order to find these files in scene.bin, you have to know that the file is structured with blocks exactly 0x2000 bytes in length. In the first table (scene.bin block), you will see what contains a block. Blocks are concatenated with each other to form the scene.bin file. So if you want to extract data from scene.bin, you'll need to find the correct blocks and to extract the gziped files from it. After that you simply ungzip those files and you'll find 256 files, with a length is 7808 bytes. Known information about those files can be found in the second table (The Data File specification). Because extracting file manually would be a pain, several tools was developed in order to help you. You can use Scene Reader for example, it's a win32 tool to extract and repack scene.bin archive.
Also note, that in kernel.bin there is a look-up table for scene.bin, which tells how many files there are in each section of scene.bin. You need to update it every time you repack the file and something changes. The table is at offset 0x0F1C of kernel.bin file. You can use SceneFix program, which'll update the table for you.
We have 1024 possible battle numbers: 0 - 1023. Each group of *4* Battle Numbers refers to a particular Scene file: for instance, Battles 0-3 refer to File 0 in Scene.bin, Battles 4-7 refer to File 1 in Scene.bin, and so forth.
General file format
Offset | Length | Description |
---|---|---|
0x0000 | 4 bytes | Pointer to first data file. You must multiply it by 4 to get actual data file offset. If the pointer is equal to FFFFFFFFh then it means that the end of block has been reached. |
0x0004 | 4 bytes | Pointer to second data file. You must multiply it by 4 to get actual data file offset. If the pointer is equal to FFFFFFFFh then it means that the end of block has been reached. |
... | ||
0x003C | 4 bytes | Last pointer, usually it equal FFFFFFFFh. |
0x0040 | 4 * (pointer2 - pointer1) bytes | First data file in block. It's a gziped file. Note: Sometimes it may finish by 0xFF bytes, because its size must be multiple of 4. |
pointer2 * 4 | 4 * (pointer3 - pointer2) bytes | Second data file in block. It's a gziped file. Note: Sometimes it may finish by 0xFF bytes, because its size must be multiple of 4. |
... | ||
lastpointer * 4 | 4 * (2000h - lastpointer) bytes | Last data file in block. Note: There are about 6 to 12 files in each block. Each block finishes by 0xFF bytes, because its length must be 2000h (8192d) bytes. |
Data file format
Offset | Length | Description |
---|---|---|
0x0000 | 2 bytes | Enemy ID 1 |
0x0002 | 2 bytes | Enemy ID 2 |
0x0004 | 2 bytes | Enemy ID 3 |
0x0006 | 2 bytes | Padding (always FFFFh) |
0x0008 | 4 * 20 bytes | Battle Setup 1 (4 records) (format explaination) |
0x0058 | 4 * 48 bytes | Battle Setup 2 (4 records) |
0x0118 | 6 * 16 bytes | Battle Formation 1 (6 records) |
0x0178 | 6 * 16 bytes | Battle Formation 2 (6 records) |
0x01E8 | 6 * 16 bytes | Battle Formation 3 (6 records) |
0x0238 | 6 * 16 bytes | Battle Formation 4 (6 records) |
0x0298 | 184 bytes | Enemy Data 1 (format explaination) |
0x0350 | 184 bytes | Enemy Data 2 |
0x0408 | 184 bytes | Enemy Data 3 |
0x04C0 | 32 * 28 bytes | Attack Data (32 records) |
0x0840 | 32 * 2 bytes | Attack IDs (32 records) |
0x0880 | 32 * 32 bytes | Attack Names (32 records, in FF Text format) |
0x0C80 | 512 bytes | FFh Padding |
0x0E80 | 2 bytes | Enemy 1 AI Offset |
0x0E82 | 2 bytes | Enemy 2 AI Offset |
0x0E84 | 2 bytes | Enemy 3 AI Offset |
0x0E86 | varies | Beginning of AI Data (format explaination) |
Battle Setup 1 format
Offset | Length | Description |
---|---|---|
0x0000 | 2 bytes | Battle location, as follows: |
0000h : Blank 0001h : Bizarro Battle - Center 0002h : Grassland 0003h : Mt Nibel 0004h : Forest 0005h : Beach 0006h : Desert 0007h : Snow 0008h : Swamp 0009h : Sector 1 Train Station 000Ah : Reactor 1 000Bh : Reactor 1 Core 000Ch : Reactor 1 Entrance 000Dh : Sector 4 Subway 000Eh : Nibel Caves or AForest Caves 000Fh : Shinra HQ 0010h : Midgar Raid Subway 0011h : Hojo's Lab 0012h : Shinra Elevators 0013h : Shinra Roof 0014h : Midgar Highway 0015h : Wutai Pagoda 0016h : Church 0017h : Coral Valley 0018h : Midgar Slums 0019h : Sector 4 Corridors or Junon Path 001Ah : Sector 4 Gantries or Midgar Underground 001Bh : Sector 7 Support Pillar Stairway 001Ch : Sector 7 Support Pillar Top 001Dh : Sector 8 001Eh : Sewers 001Fh : Mythril Mines 0020h : Northern Crater - Floating Platforms 0021h : Corel Mountain Path 0022h : Junon Beach 0023h : Junon Cargo Ship 0024h : Corel Prison 0025h : Battle Square 0026h : Da Chao - Rapps Battle 0027h : Cid's Backyard 0028h : Final Descent to Sephiroth 0029h : Reactor 5 Entrance 002Ah : Temple of the Ancients - Escher Room 002Bh : Shinra Mansion 002Ch : Junon Airship Dock 002Dh : Whirlwind Maze 002Eh : Junon Underwater Reactor 002Fh : Gongaga Reactor 0030h : Gelnika 0031h : Train Graveyard 0032h : Great Glacier Ice Caves & Gaea Cliffs - Inside 0033h : Sister Ray 0034h : Sister Ray Base 0035h : Forgotten City Altar 0036h : Northern Crater - Initial Descent 0037h : Northern Crater - Hatchery 0038h : Northern Crater - Water Area 0039h : Safer Battle 003Ah : Kalm Flashback - Dragon Battle 003Bh : Junon Underwater Pipe 003Ch : Blank 003Dh : Corel Railway - Canyon 003Eh : Whirlwind Maze - Crater 003Fh : Corel Railway - Rollercoaster 0040h : Wooden Bridge 0041h : Da Chao 0042h : Fort Condor 0043h : Dirt Wasteland 0044h : Bizarro Battle - Right Side 0045h : Bizarro Battle - Left Side 0046h : Jenova*SYNTHESIS Battle 0047h : Corel Train Battle 0048h : Cosmo Canyon 0049h : Caverns of the Gi 004Ah : Nibelheim Mansion Basement 004Bh : Temple of the Ancients - Demons Gate 004Ch : Temple of the Ancients - Mural Room 004Dh : Temple of the Ancients - Clock Passage 004Eh : Final Battle - Sephiroth 004Fh : Jungle 0050h : Ultimate Weapon - Battle on Highwind 0051h : Corel Reactor 0052h : Unused 0053h : Don Corneo's Mansion 0054h : Emerald Weapon Battle 0055h : Reactor 5 0056h : Shinra HQ - Escape 0057h : Ultimate Weapon - Gongaga Reactor 0058h : Corel Prison - Dyne Battle 0059h : Ultimate Weapon - Forest | ||
0x0002 | 16 bytes | Unknown |
0x0012 | 1 byte | Battle layout type (normal, ambush, side). 0-8 types. |
0x0013 | 1 byte | Unknown |
Enemy data format
Offset | Length | Description |
---|---|---|
0x0000 | 32 bytes | Enemy's name (completed by FFh bytes) |
0x0020 | 1 byte | Enemy's level |
0x0021 | 1 byte | Enemy's speed |
0x0022 | 1 byte | Enemy's luck |
0x0023 | 1 byte | Enemy's evade |
0x0024 | 1 byte | Enemy's strength |
0x0025 | 1 byte | Enemy's defense |
0x0026 | 1 byte | Enemy's magic |
0x0027 | 1 byte | Enemy's magic defense |
0x0028 | 8 bytes | Element types (8 records): 00h - Fire 01h - Ice 02h - Bolt 03h - Earth 04h - Bio 05h - Gravity 06h - Water 07h - Wind 08h - Holy 09h - Health 0Ah - Cut 0Bh - Hit 0Ch - Punch 0Dh - Shoot 0Eh - Scream FFh - No element |
0x0030 | 8 bytes | Element rates for elements above, respectively (8 records): 00h - Death 02h - Double Damage 04h - Half Damage 05h - Nullify Damage 06h - Absorb 100% 07h - Full Cure FFh - Nothing |
0x0038 | 16 bytes | Attack action script id (1 byte each) |
0x0048 | 32 bytes | Enemy Attack ID's (2 bytes each) |
0x0058 | 38 bytes | Unknown data |
0x0088 | 4 bytes | Item drop/steal rates. These are chances to get items listed in next section. 1 byte per item. If the rate is lower than 80h, for e.g. 08h - then this is a drop item and has 8/63 [63 is max] chance for drop. But if rate is higher than 80h, let's say... A0h, then this is an item for steal, and chances for successful steal is A0h - 80h = 20h = 32/63. |
0x008C | 8 bytes | This is a list of Item ID's which are described above. 2 bytes per item. FFFFh means no item. |
0x0094 | 8 bytes | Unknown data |
0x009C | 2 bytes | Enemy's MP |
0x009E | 2 bytes | AP points you receive when you win the battle |
0x00A0 | 2 bytes | Enemy can be morphed into this item. FFFFh if it can't be morphed into anything. |
0x00A2 | 2 bytes | Unknown, usually 10h or FFh |
0x00A4 | 4 bytes | Enemy's HP |
0x00A8 | 4 bytes | Exp points you receive when you win the battle |
0x00AC | 4 bytes | Gil you receive when you win the battle |
0x00B0 | 4 bytes | Status immunities |
0x00B4 | 4 bytes | Unknown |
AI Data
This section contains Battle Script that is executed before or/and during every fight. Every enemy has it's own script, and this script is sometimes divided to several sections. Each enemy's AI data begins with 32 bytes that describes sections of this enemy AI data. Each section has it's 2 byte ID here and FFh means no section. After that, battle script follows. It's structure and opcodes are described here.
Useful downloads
There are few programs written that will help you edit scene.bin file: