Difference between revisions of "FF8/BattleStructure"

From Final Fantasy Inside
< FF8
Jump to navigation Jump to search
my_wiki>JeMaCheHi
 
(3 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
Scene.out contains enemy placement data and flags for each of the game's battle encounters.
 
Scene.out contains enemy placement data and flags for each of the game's battle encounters.
  
See the corresponding thread: http://forums.qhimm.com/index.php?topic=15816.0  
+
See the corresponding thread: http://forums.qhimm.com/index.php?topic=15816.0
 
 
Encounter list: [[FF8/Encounter_Codes|Original encounter codes]]
 
  
 
==File Structure==
 
==File Structure==
 
Scene.out contains no header. It is a raw list of 1024 encounters. Each encounter block consists of 128 bytes and has the following structure:
 
Scene.out contains no header. It is a raw list of 1024 encounters. Each encounter block consists of 128 bytes and has the following structure:
  
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;"
+
{| class="wikitable"
! style="background:rgb(204,204,204)" | Offset
+
! Offset
! style="background:rgb(204,204,204)" | Length
+
! Length
! style="background:rgb(204,204,204)" | Description
+
! Description
 
|-
 
|-
 
! align="left" | 0x00
 
! align="left" | 0x00
Line 21: Line 19:
 
! align="left" | 0x01
 
! align="left" | 0x01
 
| 1
 
| 1
| Flags to configure some battle parameters and it works like 8 binary flags (see below)
+
| Refers to some battle aspects and it works like 8 binary switches (see below)
 
|-
 
|-
 
! align="left" | 0x02
 
! align="left" | 0x02
 
| 1
 
| 1
| Main camera animation. This is for the battle entrance animation (when the party and the monsters appear). The first nibble represents the '''camera number''', the second one the '''animation number'''. (See below about cameras)
+
| Still don't know, but I suspect that it has something to do with camera movement. If you set it to 0xFF camera will always be fixed
 
|-
 
|-
 
! align="left" | 0x03
 
! align="left" | 0x03
 
| 1
 
| 1
| Secondary camera. Works exactly the same as the main camera, but this one will be used less frecuently.(See below about cameras)
+
| unkonwn
 
|-
 
|-
 
! align="left" | 0x04
 
! align="left" | 0x04
 
| 1
 
| 1
| Hidden enemies. Hides an enemy for each activated bit in the byte. (see below for "enemy flags")
+
| Visible enemies. Shows an enemy for each bit in the byte. (see below for "enemy switches")
 
|-
 
|-
 
! align="left" | 0x05
 
! align="left" | 0x05
 
| 1
 
| 1
| Loaded enemies. Show the enemies that are been actually fought. Loaded enemies will attack you(also, refer to "enemy flags").
+
| Loaded enemies. Show the enemies that are been actually fought. Loaded enemies will attack you.
 
|-
 
|-
 
! align="left" | 0x06
 
! align="left" | 0x06
 
| 1
 
| 1
| Targetable enemies. Show the enemies which will appear in the target window. Careful with this, if you put untargetable enemies battle will never end. (see "enemy flags" too)
+
| Targetable enemies. Show the enemies which will apear in the target window. Careful with this, if you put untargetable enemies battle will never end. (see "enemy switches" too)
 
|-
 
|-
 
! align="left" | 0x07
 
! align="left" | 0x07
 
| 1
 
| 1
| Enabled enemies. Also works like eight binary flags. Each activated flag is an enabled enemy. If the flag for a certain enemy is disabled, the three previous sections will be ignored. See below
+
| Number of enemies. Also works like eight binary switches. See below
 
|-
 
|-
 
! align="left" | 0x08
 
! align="left" | 0x08
Line 57: Line 55:
 
! align="left" | 0x40
 
! align="left" | 0x40
 
| 16
 
| 16
| Unknown. A certain enemy also has always the same value (f.e G-Soldier -> 0x7f70), and some of this values can be repeated between enemies. Slots with no enemies (with a dummy) always have the value 0x00C8.
+
| unknown
 
|-
 
|-
 
! align="left" | 0x50
 
! align="left" | 0x50
 
| 16
 
| 16
| Unknown. It always has the same value as the previous section.
+
| Still under research, but this is usually the same as the previous field's value.
 
|-
 
|-
 
! align="left" | 0x60
 
! align="left" | 0x60
 
| 16
 
| 16
| Unknown. A certain enemy has always the same value but different from the two previous sections. Slots with no enemies always have the value 0xEA60
+
| unknown
 
|-
 
|-
 
! align="left" | 0x70
 
! align="left" | 0x70
 
| 8
 
| 8
| Unknown. Once more, A certain enemy has always the same value but different from previous sections.
+
| unknown
 
|-
 
|-
 
! align="left" | 0x78
 
! align="left" | 0x78
 
| 8
 
| 8
| 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...
+
| Enemy level. Each enemy level is 1 byte. Numbers from 1 to 100 are fixed levels. From 101 to 199 are max levels fixed (min level remains 1). When 255, it is disabled (standard behaviour). And 215 (Deep Sea), 210 (Deep Sea), 251 (Final Bosses), 252 (Ultimecia Castle), 254 (Scripted battles)... Still don't know...
 
|}
 
|}
  
==About flags==
+
==Notes==
 
Each 128block 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 the final battle (where we have 8 enemies), all the monsters are present, but only one or two are shown at any given time. The rest appear through scripting.
 
Each 128block 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 the final battle (where we have 8 enemies), all the monsters are present, but only one or two are shown at any given time. The rest appear through scripting.
  
Some byte fields are just 8 flags contained in a byte. To configure it you just have to sum the values you need. Here's what I've found:
+
Some byte fields are just 8 switches. Here's what I've found:
 
 
In 0x01 (battle configuration flags):
 
:+0x80: Not random fight. Every scripted battle has this one enabled.
 
:+0x40: Force back attack (you will be back attacked, not the enemy).
 
:+0x20: Force surprise attack (as before, you are the one surprise attacked).
 
:+0x10: Doesn't show exp screen at end.
 
:+0x08: No exp will be gained at the end of battle (like in boss battles).
 
:+0x04: Shows the timer on battle. Like in dollet withdraw combats, or missile base.
 
:+0x02: This disables victory fanfare.
 
:+0x01: Can't escape.
 
 
 
In 0x04, 0x05, 0x06, and 0x07 (hidden/loaded/targetable/enabled enemies).
 
:+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
 
 
 
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 (It's now confirmed) that summoning is scripted in its AI (in c9m???.dat) as an enemy ability.
 
 
 
==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.
 
  
The game engine will use one or other camera randomly, but will use the main one way more frequently (in my tests, for each 5 battles, the game used the main camera around 4 times)
+
In 0x01:
 +
{{:FF8/Field/Script/Opcodes/069 BATTLE}}
  
Also, a few considerations about these camera parameters:
+
In 0x04, 0x05, 0x06, and 0x07
 +
:+128: 1st enemy relative
 +
:+64: 2nd enemy relative
 +
:+32: 3rd enemy relative
 +
:+16: 4th enemy relative
 +
:+8: 5th enemy relative
 +
:+4: 6th enemy relative
 +
:+2: 7th enemy relative
 +
:+1: 8th enemy relative
  
:-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.
+
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) that summoning is scripted in its AI (in c9m???.dat)
:-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.
 

Latest revision as of 01:30, 6 January 2020

By JeMaCheHi

Scene.out contains enemy placement data and flags for each of the game's battle encounters.

See the corresponding thread: http://forums.qhimm.com/index.php?topic=15816.0

File Structure

Scene.out contains no header. It is a raw list of 1024 encounters. Each encounter block consists of 128 bytes and has the following structure:

Offset Length Description
0x00 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 Refers to some battle aspects and it works like 8 binary switches (see below)
0x02 1 Still don't know, but I suspect that it has something to do with camera movement. If you set it to 0xFF camera will always be fixed
0x03 1 unkonwn
0x04 1 Visible enemies. Shows an enemy for each bit in the byte. (see below for "enemy switches")
0x05 1 Loaded enemies. Show the enemies that are been actually fought. Loaded enemies will attack you.
0x06 1 Targetable enemies. Show the enemies which will apear in the target window. Careful with this, if you put untargetable enemies battle will never end. (see "enemy switches" too)
0x07 1 Number of enemies. Also works like eight binary switches. See below
0x08 48 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 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 crush.
0x40 16 unknown
0x50 16 Still under research, but this is usually the same as the previous field's value.
0x60 16 unknown
0x70 8 unknown
0x78 8 Enemy level. Each enemy level is 1 byte. Numbers from 1 to 100 are fixed levels. From 101 to 199 are max levels fixed (min level remains 1). When 255, it is disabled (standard behaviour). And 215 (Deep Sea), 210 (Deep Sea), 251 (Final Bosses), 252 (Ultimecia Castle), 254 (Scripted battles)... Still don't know...

Notes

Each 128block 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 the final battle (where we have 8 enemies), all the monsters are present, but only one or two are shown at any given time. The rest appear through scripting.

Some byte fields are just 8 switches. Here's what I've found:

In 0x01:

  • Opcode: 0x069
  • Short name: BATTLE
  • Long name: Start a battle

Argument

none

Stack

Encounter ID
Battle Flags
BATTLE

Description

Begin a battle with the given encounter id.

Battle Flags

+0: Regular battle.
+1: No escape?
+2: Disable victory fanfare (battle music keeps playing after win/loss)
+4: Inherit countdown timer from field.
+8: No Item/XP Gain?
+16: Use current music as battle music.
+32: Force preemptive attacked
+64: Force back attack
+128: unknown

In 0x04, 0x05, 0x06, and 0x07

+128: 1st enemy relative
+64: 2nd enemy relative
+32: 3rd enemy relative
+16: 4th enemy relative
+8: 5th enemy relative
+4: 6th enemy relative
+2: 7th enemy relative
+1: 8th enemy relative

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) that summoning is scripted in its AI (in c9m???.dat)