Wrp File Format - 8WVR: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Wrp File Format 8WVR moved to Wrp File Format - 8WVR: as above for consistent filename convention)
m (→‎Legend: better description, fixed errors)
Line 23: Line 23:
|align="middle"|byte||align="left"| 8 bit (1 byte)
|align="middle"|byte||align="left"| 8 bit (1 byte)
|-
|-
|align="middle"|short||align="left"| 16 bit signed short (2 bytes)
|align="middle"|ushort||align="left"| 16 bit unsigned short (2 bytes)
|-
|-
|align="middle"|int||align="left"| 32 bit signed integer (4 bytes)
|align="middle"|ulong||align="left"| 32 bit unsigned integer (4 bytes)
|-
|-
|align="middle"|float||align="left"| 32 bit signed single precision floating point value (4 bytes)
|align="middle"|float||align="left"| 32 bit signed single precision floating point value (4 bytes)
|-
|-
|align="middle"|asciiz||align="left"| Null terminated (0x00) variable length ascii string
|align="middle"|chae||align="left"| ascii character(s)
|-
|align="middle"|ascii||align="left"| fixed length ascii string
|-
|-
|-
|-
|}
|}


 
==8WVR==
::Although technically there should never be negetive values for many of the 16 bit & 32 bit values, it's 'safer' in programming terms to use signed datatypes as opposed to unsigned datatypes.
 
 
<code><nowiki>
   8WVR
   8WVR
   {
   {
     structHeader Header
     Header
     {
     {
       char[4] Filetype;
       char   Filetype;       // "8WVR"
       int TextureGrid_X;
       XYPair  TextureGridSize; // 256 eg
       int TextureGrid_Z;
       XYPair  TerrainGridSize; // ditto
      int TerrainGrid_X;
       float   CellSize;       // generally 50.0 meters
      int TerrainGrid_Z;
       float CellSize;
     }
     }
     float[TerrainGrid_Z,TerrainGrid_X] Elevations;
     float         Elevations[TerrainGridSize.y][TerrainGridSize.x];
     short[TextureGrid_Z,TextureGrid_X] TextureGridMaterials;
     short         Materials [TextureGridSize.y][TextureGridSize.x];
     int NoOfMaterials - 1; //1 Based array.
     ulong        NoOfMaterials - 1; //1 Based array.
     structMaterial[NoOfMaterials] Materials
     MaterialName  MaterialNames[NoOfMaterials] Materials
    Object        Objects[NoOfObjects];
}
===MaterialName===
    MaterialName
     {
     {
       int Length;
       ulong Always0;
       ascii[Length] Material;
      ulong Length;
      int Unknown; //always zero
       char  RvMatFileName[Length]; //"SomePboPrefix\SomeIsland\data\layers\p_002-000_l02.rvmat"
     }
     }
     structObject[NoOfObjects] Objects
 
*Note that the string is NOT asciiZ it does NOT have a null terminating character.
*Note further that there is 1 less MaterialName than it's count
*Note that file paths are *always* hard - wired to the (virtual) PrefixRoot\ directory. Like ArmA P3d files, there is NO, relative addressing.
===Object===
     Object
     {
     {
       float[12] TransformMatrix;
       float TransformMatrix[4][3];// standard directX transform matrix
       int ObjectId;
       ulong ObjectId;
       int Length;
       ulong Length;
       ascii[Length] Object;
       char  ObjectName[Length];   // "ca\buildings\ryb_domek.p3d"
     }
     }
  }
 
</nowiki></code>
Note again, that unlike Asciiz strings, all char strings in an 8WVR file are NOT null terminated. This presumably to get some speed up when skipping various blocks as otherwise, the count of characters (or at least null char detection) is required- real time.


== Notes ==
== Notes ==

Revision as of 09:11, 28 January 2009

Template:unsupported-doc

Introduction

The 8WVR.wrp file should be viewed as an intermediate file format and of little use to the community at large. The reason being it is not editable in Visitor directly (it is the product of exporting a .pew file) and the format is in an unoptimized state for use in the Real Virtuality game engine.


File Format

The following is a mix of pseudo-code and structure references that could be used to describe the file format of 8WVR.wrp game island.
Any naming definitions or naming conventions used may or may not be accurate.
  • This file format is principally used with Armed Assault.

Legend

Type Description
byte 8 bit (1 byte)
ushort 16 bit unsigned short (2 bytes)
ulong 32 bit unsigned integer (4 bytes)
float 32 bit signed single precision floating point value (4 bytes)
chae ascii character(s)

8WVR

 8WVR
 {
   Header
   {
     char    Filetype;        // "8WVR"
     XYPair  TextureGridSize; // 256 eg
     XYPair  TerrainGridSize; // ditto
     float   CellSize;        // generally 50.0 meters
   }
   float         Elevations[TerrainGridSize.y][TerrainGridSize.x];
   short         Materials [TextureGridSize.y][TextureGridSize.x];
   ulong         NoOfMaterials - 1; //1 Based array.
   MaterialName  MaterialNames[NoOfMaterials] Materials
   Object        Objects[NoOfObjects];

}

MaterialName

   MaterialName
   {
     ulong Always0;
     ulong Length;
     char  RvMatFileName[Length]; //"SomePboPrefix\SomeIsland\data\layers\p_002-000_l02.rvmat"
   }
  • Note that the string is NOT asciiZ it does NOT have a null terminating character.
  • Note further that there is 1 less MaterialName than it's count
  • Note that file paths are *always* hard - wired to the (virtual) PrefixRoot\ directory. Like ArmA P3d files, there is NO, relative addressing.

Object

   Object 
   {
     float TransformMatrix[4][3];// standard directX transform matrix
     ulong ObjectId;
     ulong Length;
     char  ObjectName[Length];   // "ca\buildings\ryb_domek.p3d"
   }

Note again, that unlike Asciiz strings, all char strings in an 8WVR file are NOT null terminated. This presumably to get some speed up when skipping various blocks as otherwise, the count of characters (or at least null char detection) is required- real time.

Notes

  • The 'Elevations' array extends from Bottom-Left to Top-Right in Visitor;
  • The 'TextureGridMaterials' array is a mapping of .rvmat material files to TextureGrid cells/tiles.
  • The 'Materials' array always contains a Material with no name (length == 0) at the first position.
  • The 'Objects' array will always have at least 1 object. This default object specifies the 'center' of the map and is always the last object in the array.
  • The 'Objects' array is the last structure in the file and the 'NoOfObjects' is a variable amount and extends from the starting offset of the structure to the EndOfFile.
  • The 'TransformMatrix' for a given object is a standard 4 x 3 transform matrix which when decomposed determines the objects x,z,y position, scale & orientation (NB: Special logic must be applied to decompose the orientation from a Matrix.).