Field File Format - niemasd/PyFF7 GitHub Wiki
The Field Files in Final Fantasy VII are found in the FLEVEL.LGP
file, and they are always LZSS-compressed. You must first decompress an LZSS-compressed Field File (e.g. using lzss_decompress.py) before you can play with it. This wiki is a useful reference for the general structure of the Field File. It is broken down into the following 9 sections:
- Section 1: Field Script
- Section 2: Camera Matrix
- Section 3: Model Loader
- Section 4: Palette
- Section 5: Walkmesh
- Section 6: Tile Map (unused)
- Section 7: Encounter
- Section 8: Triggers
- Section 9: Background
A Field File's File Header is essentially just a table storing information about where the other sections are located in the file.
The first 2 bytes of the File Header are just <NULL>
(i.e., 0x0
).
The next 4 bytes of the File Header list the number of sections in the file. It should be 9.
The first 4 bytes are an unsigned integer representing the start position of Section 1, the next 4 bytes representing the start of Section 2, etc.
Following the File Header are the actual 9 sections of the Field File. Refer to the links in the list above for information about each section.
-
File Header
- 2 bytes (
<NULL>
) - 4 bytes (Number of Sections = 9)
- 4 bytes (Section 1 Start Position)
- ...
- 4 bytes (Section 9 Start Position)
- 2 bytes (
-
Section 1: Field Script
- 4 bytes (Section Length)
-
Section Header
- 2 bytes (unknown)
- 1 byte (Number of Actors, nA)
- 1 byte (Number of Models)
- 2 bytes (String Table Offset)
- 2 bytes (Number of Akao/Tutorial Blocks, nB)
- 2 bytes (Scale of Field)
- 3 bytes (
<NULL>
Bytes) - 8 bytes (Field Creator)
- 8 bytes (Field Name)
-
Actor Names (nA entries)
- 8 bytes (Actor Name 1)
- ...
-
Akao/Tutorial Block Offsets (nB entries)
- 4 bytes (Akao/Tutorial Block Offset 1)
- ...
-
Actor Scripts (nA entries)
-
Scripts for Actor 1 (32 entries)
- 2 bytes (Actor 1 Script 1)
- ...
- ...
-
Scripts for Actor 1 (32 entries)
-
String Table (starts at String Table Offset)
- 2 bytes (Number of Strings, nS)
-
String Offsets (nS entries)
- 2 bytes (String 1 Offset)
- ...
-
Strings (nS entries)
- ? bytes (String 1) (start at String 1 offset, end at first
0xFF
) - ...
- ? bytes (String 1) (start at String 1 offset, end at first
- 0-3 bytes (
<NULL>
bytes) - *Akao/Tutorial Blocks (nB entries)
- ? bytes (Akao/Tutorial Block 1) (start at Block Offset 1, end at Block Offset 2)
- ...
-
Section 2: Camera Matrix
- 4 bytes (Section Length)
-
Camera Matrix (nCM = (section length / 38) entries)
- Camera 1 x-Axis Vector
- 2 bytes (x-Axis Vector Dimension 1)
- 2 bytes (x-Axis Vector Dimension 2)
- 2 bytes (x-Axis Vector Dimension 3)
- Camera 1 y-Axis Vector
- 2 bytes (y-Axis Vector Dimension 1)
- 2 bytes (y-Axis Vector Dimension 2)
- 2 bytes (y-Axis Vector Dimension 3)
- Camera 1 z-Axis Vector
- 2 bytes (z-Axis Vector Dimension 1)
- 2 bytes (z-Axis Vector Dimension 2)
- 2 bytes (z-Axis Vector Dimension 3)
- 2 bytes (Camera 1 z-Axis Vector Dimension 3 Duplicate)
- 4 bytes (Camera 1 x-Axis Space Position)
- 4 bytes (Camera 1 y-Axis Space Position)
- 4 bytes (Camera 1 z-Axis Space Position)
- 4 bytes (Camera 1 Blank)
- 2 bytes (Camera 1 Zoom)
- Camera 1 x-Axis Vector
-
Section 3: Model Loader
- 4 bytes (Section Length)
-
Section Header
- 2 bytes (
<NULL>
Bytes) - 2 bytes (Number of Models, nM)
- 2 bytes (Scale)
- Model Data (nM entries)
- 2 bytes (Size of Model 1 Name, nMN)
- nMN bytes (Model 1 Name)
- 2 bytes (Model 1 Unknown Attribute)
- 8 bytes (Model 1 HRC Name)
- 4 bytes (Model 1 Scale)
- 2 bytes (Model 1 Number of Animations, nA)
- 3 bytes (Model 1 Light 1 Color)
- 6 bytes (Model 1 Light 1 Coordinates)
- 3 bytes (Model 1 Light 2 Color)
- 6 bytes (Model 1 Light 2 Coordinates)
- 3 bytes (Model 1 Light 3 Color)
- 6 bytes (Model 1 Light 3 Coordinates)
- 3 bytes (Model 1 Global Light Color)
- Model 1 Animations (nA entries)
- 2 bytes (Size of Animation 1 Name, nAN)
- nAN bytes (Animation 1 Name)
- 2 bytes (Animation 1 Unknown Attribute)
- ...
- ...
- 2 bytes (
-
Section 4: Palette
- 4 bytes (Section Length)
-
Section Header
- 4 bytes (Section Length, again)
- 2 bytes (PalX)
- 2 bytes (PalY)
- 2 bytes (Number of Colors per Page, nC)
- 2 bytes (Number of Pages, nP)
- Color Data (nC * nP entries)
- 2 bytes (Color 1)
- ...
-
Section 5: Walkmesh
- 4 bytes (Section Length)
-
Section Header
- 4 bytes (Subsection 2 Offset)
- 4 bytes (Subsection 3 Offset)
- 4 bytes (Subsection 4 Offset)
- 4 bytes (Subsection 5 Offset)
-
Subsection 1
- TODO