File Formats/RFL: Difference between revisions

From Red Faction Wiki
(wip)
 
Line 63: Line 63:
* RFLstring - Early level name
* RFLstring - Early level name
* RFLstring - Mod that RED was running when level was saved
* RFLstring - Mod that RED was running when level was saved
Sections follow.
* Sections follow.


== Section header ==
== Section header ==

Revision as of 19:14, 26 July 2015

Overall structure

An RFL file begins with a short header, and the rest of the file is divided into sections. Each section has its own header to specify the type and size of the section. Because of this, complete knowledge of all section formats is not required to parse an RFL -- unknown sections can be skipped over easily.

All numeric values are little-endian

For numeric values, -1 often represents an "undefined" value

All floats are 32-bit

Data types

A breakdown of the non-obvious data types in use in an RFL:

  • bool - one byte, 1 = true, 0 = false
  • RFLstring - uint16 to specify length, followed by the string
  • RFLposition - three floats in a row, X Y Z
  • RFLvertex - uint32 index, float U, float V
  • RFLscroll - used in scrolling textures - uint32 index, float U, float V
  • RFLrotmatrix - Rotation matrix. 9 floats

Section IDs

  • 0x00000000 - End (found at end of file)
  • 0x00000100 - Static geometry
  • 0x00000200 - Geo regions
  • 0x00000300 - Lights
  • 0x00000400 - Cutscene cameras
  • 0x00000500 - Ambient sounds
  • 0x00000600 - Events
  • 0x00000700 - Multiplayer spawn points
  • 0x00000900 - Level properties
  • 0x00000a00 - Particle emitters
  • 0x00000b00 - Gas regions (not working in-game)
  • 0x00000c00 - Room effects
  • 0x00000e00 - Bolt emitters
  • 0x00000f00 - Targets
  • 0x00001000 - Decals
  • 0x00001100 - Push regions
  • 0x00001200 - Lightmaps
  • 0x00002000 - Movers
  • 0x00003000 - Moving groups
  • 0x00005000 - Cutscene path nodes
  • 0x00020000 - Navpoints
  • 0x00030000 - Entities
  • 0x00040000 - Items
  • 0x00050000 - Clutter objects
  • 0x00060000 - Triggers
  • 0x00070000 - Player start
  • 0x01000000 - Level info
  • 0x02000000 - Brushes
  • 0x03000000 - Groups

RFL header

  • uint32 - Magic number
  • uint32 - Format version number
  • uint32 - Unix timestamp of level save
  • uint32 - player start offset (need confirmation)
  • uint32 - level info offset (need conf)
  • uint32 - Count of sections in the RFL
  • uint32 - Combined size of all sections minus 8 bytes
  • RFLstring - Early level name
  • RFLstring - Mod that RED was running when level was saved
  • Sections follow.

Section header

  • uint32 - Section type
  • uint32 - Section size

Section data follows.

Triggers

  • uint32 - Count of triggers

For each trigger

  • uint32 - Trigger UID
  • RFLstring - Script Name
  • uint8 - unknown
  • uint8 - Trigger shape (0=sphere 1=box)
  • uint8 - unknown
  • uint8 - unknown
  • uint8 - unknown
  • float - Resets after seconds
  • uint16 - Reset count
  • uint16 - unknown
  • bool - Use key required
  • RFLstring - Key name
  • bool - Weapon-activated
  • uint8 - unknown
  • bool - Triggered by NPCs
  • bool - Auto trigger
  • bool - Triggered by vehicles
  • RFLposition - trigger center position

If shape = sphere

  • float - Radius

End

If shape = box

  • RFLrotmatrix - Rotation matrix
  • float - Height
  • float - Width
  • float - Depth
  • bool - One-way

End

  • uint32 - Airlock ID
  • uint32 - Attached to ID
  • uint32 - Use clutter ID
  • bool - Disabled
  • float - Button active time
  • float - Inside time
  • uint32 - unknown
  • Links

Links

  • uint32 - Link count
  • uint32*Link count - UID of linked object



Acknowledgements

Compiled by digi and nokobon.

Includes analysis from Open Faction project by rafalh et al.