Hi everyone!
I've been making a little research on FF8's scene.out file for the last few days, and wanted to share with you my findings. I will update the thread with any new info I get. Also, since any of this information is on the wiki, it would be cool if someone puts it in there (I think I cant).
First of all, I wanted to thank to random_npc, because I read on a post of him that scene.out contained enemy encounters and that they was stored in 128byte blocks, which was very helpful. From there, here are my findings:
- scene.out doesn't have header, which means that first line is first encounter.
- As said before, each 128 byte block is an encounter (we'll call them that way from here), and file has 131072bytes, so there are 1024 encounters. A lot of them are not used in the game (when I say a lot a mean A LOT), so in a future mod, many new encounters could be programmed
- Each encounter can have up to 8 enemies, but if more than 4 are shown at the same time, the game will crash. This could seem stupid, but it's not. If you think about some battles, like final battle (where we have 8 enemies), they are be shown scriptedly, it takes more sense
- Each encounter has a clearly defined structure: first 8 bytes controls global aspects of the encounter, and the 120 remaining ones controls features relative to each enemy.
- Each encounter has two cameras for the begining animation. The game will use one of them randomly, but I checked experimentally that the game will pick the first camera most of the times (for each 5 battles, the game will use the first camera around 4 times). That's why I called the first one "Main camera" and the second one will be the "Secondary camera".
Encounter StructureAs told you before, each 128byte block (from now on we'll simply call it "encounter"), has a defined structure. Each section from the 8th(included) refers to each one of the eight enemies defined. In other words, is divided in eight sub-blocks or "slots".
Here's what I have:
Offset | Length | Description |
0x00 | 1 | Section 1: Battle scenario. The value here corresponds to the number in the a0stg???.x files (into battle.fs file). You have to convert it to hex |
0x01 | 1 | Section 2: Flags to configure some battle parameters and it works like 8 binary flags (see below) |
0x02 | 1 | Section 3: Main camera animation. This is for the battle entrance animation (when the party and the monsters appear). (See below about cameras) |
0x03 | 1 | Section 4: Secondary camera. Works exactly the same as the main camera, but this one will be used less frecuently.(See below about cameras) |
0x04 | 1 | Section 5: Hidden enemies. Hides an enemy for each bit in the byte. Also works like 8 binary flags. An activated flag means that this enemy is hidden (see below for "enemy flags") |
0x05 | 1 | Section 6: Not Loaded enemies. Show the enemies that are been actually fought. Loaded enemies will attack you. You can attack them, though. Also works like 8 flags. An activated flag means that this enemy is not loaded.(see below for "enemy flags") |
0x06 | 1 | Section 7: Not Targetable enemies. Show the enemies which will apear in the target window. Careful with this, if you put untargetable enemies battle will never end. Also, loaded enemies will attack you even if they are not targetable, so be careful again. Once more, this section works like 8 binary flags. An activated flag mean that this enemy is not targetable. (see "enemy switches" too) |
0x07 | 1 | Section 8: Enabled enemies. This section will specify which enemies will be loaded at the begining of the battle. Even if there's only 1 or 2 enemies, you can enable more enemies through enemy AI scripting(See this video to see what I mean). Also works like eight binary flags. An activated flag means that the enemy is enabled. If an enemy is not enabled, the 3 previous sections will be ignored. See below for enemy flags. |
0x08 | 48 | Section 9: Enemy coordinates. Its a set of 6x8 bytes which describes each enemy's coordinate in (x,y,z) format. So, first 6 bytes would be enemy 1's coords, next 6 enemy 2's ones, and so on. |
0x38 | 8 | Section 10: Enemies. Each byte represents an enemy. To know what enemy you're working with, you can check the c0m???.dat files in battle.fs. You just have to convert it to hex and add 0x10. Be careful, if you put numbers under 0x10 as enemies, battle will crash. |
0x40 | 16 | Section 11: Still under research.A certain enemy also has always the same value, and some of this values can be repeated between enemies. Slots with no enemies always have the value 0x00C81 |
0x50 | 16 | Section 12: Still under research. A certain enemy also has always the same value. Slots with no enemies always have the value 0x00C81 |
0x60 | 16 | Section 13: Still under research too. For a certain enemy has always the same value but different from section 12 and 13. Slots with no enemies always have the value 0xEA60 |
0x70 | 8 | Section 14: This is enemy relative, a certain enemy always have a certain value, e.g. Bite Bug always have 4B. There's only a few values used here: 38 91 0A 64 C8 2D 7B 4A 34 01 4B 02(when an enemy's not used), however setting it to any other value seems to do nothing. |
0x78 | 8 | Section 15: Enemy level. Each enemy level is 1 byte. Numbers from 0x0 to 0x64 are fixed levels up to 100. From 0x64 to 0xFF... Still don't know because it makes weird things... |
1: 0xC8 is the code to target self in AI script code for enemies. I wonder if this has some kind of relationship... I'll keep searching.
About binary/enemy flags.Sections 2, 5, 6, 7, and 8 works as binary flags. This means that each bit enables/disables something. When the bit is 1 it means the flag is
enabled. When is 0, the flag is
disabled. Since the 8 flags forms a Byte, I'll list in form of hex sums, from Most Significant Bit to Less Significant Bit:
For battle configuration (Section 2):
+0x80: Not random fight. Every scripted battle has this one enabled.
+0x40: Force back attack (
you will be back attacked, not the enemy xD).
+0x20: Force surprise attack (as before,
you are the one surprise attacked)
+0x10: Doesn't show exp screen at end.
+0x08: If you set this one up not exp will be gained at the end of battle (like in boss battles)
+0x04: Shows the timer. Like in dollet withdraw combats.
+0x02:
Can't figure it out. Some boss battles have it enabled but don't know its functionI'm stupid. This disables victory sequence.
+0x01: Can't escape.
For Sections 5,6,7 and 8:
+0x80: 1st enemy flag
+0x40: 2nd enemy flag
+0x20: 3rd enemy flag
+0x10: 4th enemy flag
+0x08: 5th enemy flag
+0x04: 6th enemy flag
+0x02: 7th enemy flag
+0x01: 8th enemy flag
About cameras.
Each encounter has two cameras, as explained above. Each camera is represented by a byte, but each byte stores two things: The camera number, and the camera animation. The camera number is stored on the most significant nibble of the byte (4 bits) and the animation is stored on the less significant nibble of the byte. I called it "Camera number" because I had to name it somehow, but I'm not even sure if they're different cameras, or just are "sets" of animations. Anyway, we'll call it that way until we find a better one. Also, a few considerations about these camera parameters:
- Camera number. It can take values from 0 to 3. The original scene.out never has greater values. Values greater than 3 will result in no camera animations, having a fixed camera. Some stages have less than 3 camera numbers. This leads me to think that this camera stuff is really stored on .x files, and this values are just pointers, or indexes, or something of the kind.
- Camera animation. It can take values from 0 to 7. The original scene.out never has greater values. Values higher than that will result in the same as that value minus 8. This is because the last bit of the nibble is ignored (still don't know why). Sometimes the camera has less animations than 7. In that case, if you use a number greater than actual animations, taking into account that the 4th bit is ignored, will result in a fixed scene.
An important note: If you put an enemy that "summons" another one (Ultimecia summoning Griever, Sphinxara summoning jelleye...) it will summon the enemy from certain slot. This means that if you put that enemy in another battle, it will still summon that slot, because (I
think can confirm) that summoning is scripted in its AI (in c9m???.dat) as an enemy ability.
I've also made a C++ class that stores a chosen encounter from the scene.out file. I've implemented a little command line program to see info and change some things,
but since I don't know anything about GUI programming and interacting with a cli program will be pretty tedious, I think I'll stop developing it xD.Well, I'll update this thread with my findngs. Also, any help will be appreciated
Update: Some pics to show up!
You can put any enemy you want:
However, sometimes enemy palletes could crash. Also, you should be careful with certain enemies like GF's or bosses as Seifer because when killed, they won't dissapear, fade out, or run away.
Encounter listA guy from gamefaqs called aladore384 made a pretty complete list of every encounter. Since it's very useful, I'll post it here. To edit a certain encounter in the scene.out, all you have to do is to get its encounter number, convert it to hex, and multiply it per 0x80, and you'll get the offset.
For example, lets say you want to edit Omega Weapon encounter:
- You find its number in the list: 462.
- Now you convert it: 462 = 0x1CE
- Multiply it for 0x80: 0x1CE*0x80 = 0xE700
- That's the offset you have to search for in the scene.out
Update July 2015Sections are updated with my new findings, flag stuff are (I think) better exlained, and
I started developing developed a GUI tool to modify the scene.out without all the hex pain.
Link to the tool thread:
http://forums.qhimm.com/index.php?topic=16275.0