Wrp File Format - 8WVR: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(→‎8WVR: Objects)
(new intro and cleanup)
Line 3: Line 3:
== Introduction ==
== 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.
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.


A wrp file is the 'world map' for the given island. The simplicity of the requirements for the map are very neatly exposed in the structure below.


== File Format ==
A 'world' is a square dimension divided into equidistant grids. Each Cell of the grid is a uniform 50 meter square of the map surface (be it land, or sea). The overall size of the map is a fixed-in-concrete dimension of the number of grids and their uniform cell size.
 
All that is required within each of these cells are definitions of
*it's mean elevation (above or below sea level),
*the texture for it's surface.
The 'elevation' is clearly a mean, or average value, since chunks of cells don't suddenly jump 200 meters etc. Instead, the engine smooths the differences.
Textures in arma can be very simple 'sea' or quite complex 'land terrain' and are represented in .rvmat files. Textures don't, of themselves, complicate the structure of a wrp file.


Provisions exist to alter the map to
*Non Square dimensions
*Separate grids for Textures versus Elevations.
*Something other than 50 meter cells.
Official BI maps have never used it. And I am unaware of any Oem map that does so.


::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.
The only other necessary component of a wrp file is to populate it with objects.
::Any naming definitions or naming conventions used may or may not be accurate.
Objects are models, and as such, any single model is represented by a p3d file. Naturally and of course, the same model (Pine tree) can be referred to multiple times. Each one is a unique Object from the perspective of the wrp file.
P3d models can of course be quite complex, even to the point of being inter-active, eg opening doors, but again, of themselves, they do no complicate the structural arrangement of a wrp file.
Objects are independent of the cell grid structure. They are placed on the map using their own dimensional space transform. For all the engine cares, the building could be upside down and buried 10 meters under the sea.


:::*This file format is principally used with Armed Assault.
For the purposes of game play, and no other reason, each, identical pine tree has a unique 'ID' number. (as does every other object). A soldier is told to goto THAT pine tree (as opposed to any other). The IDvalue, while guaranteed to be unique, is highly arbitrary. Any alterations / additions / deletions to the map and it's objects will result in different numbers for some / most / all of the objects. This represents no problem with game commands using NearestObject() style functions that return the ID of relevance, but, missions relying on a specific building ID (eg) will mostly fail if the 'island' is revised. This has particular relevance to porting OFP islands into Arma.


==== Legend ====
==Legend==
*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)
*char:  ascii character(s)


{| border="0"
===String===
!width="100"|Type
String
!width="300" align="left"|Description
{
|-
  ulong Length;
|-
  char  ascii[Length];
|align="middle"|byte||align="left"| 8 bit (1 byte)
}
|-
This is a Basic or Pascal way of doing things. Unlike the more familiar Asciiz (null terminated) strings used in other file formats, here, speed is used to NOT calculate string length (or at least hunt the null char)
|align="middle"|ushort||align="left"| 16 bit unsigned short (2 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"|chae||align="left"|  ascii character(s)
|-
|-
|}


====XYPair====
XYPair
{
  ulong x,y;
}
== File Format ==
:::*This file format is principally used with Armed Assault and a derivation of it was used for Elite.
==8WVR==
==8WVR==
   8WVR
   8WVR
   {
   {
     WRPHeader    Header
     WRPHeader    Header
     float        Elevations[TerrainGridSize.y][TerrainGridSize.x];
     float        Elevations   [TerrainGridSize.y][TerrainGridSize.x];
     short        Materials [TextureGridSize.y][TextureGridSize.x];
     ushort        MaterialIndex[TextureGridSize.y][TextureGridSize.x]; //zero based index into MaterialNames
     ulong        NoOfMaterials - 1;                               //1 Based array.
     ulong        NoOfMaterials - 1;                                   //1 Based array.
     MaterialName  MaterialNames[NoOfMaterials];
     MaterialName  MaterialNames[NoOfMaterials];
     ulong        Unknown;      // only seen zero
     ulong        Unknown;      // only seen zero
     Object        Objects[...];
     Object        Objects[...];
}
}
*The 'Elevations' array is Cartesian mapped. It extends from Bottom-Left to Top-Right in Visitor;
 
*The Objects extend to end of file. There is no count as such.
*There is always at least one Object entry.
*The last, (and possibly only) entry, has no p3d filename associated with it. This is the 'default' object specifying the 'center' of the map.


The Objects extend to end of file. There is no count as such.
The very last Object has no p3d filename associated with it and is in effect a dummy entry, indicating, end of objects (and end of file)


===WrpHeader===
===WrpHeader===
Line 58: Line 77:
  }
  }


This is a fairly traditional Header for all Wrp types (including OPWR). Resistance first introduced the cell Grid dimensions : formely hardwired to 256. And this, Arma format, simply adds a small wrinkle of a cellGrid Size. Formerly set at 50 meters.
This is a fairly traditional Header for all Wrp types (including "OPWRxx"). OFP Resistance first introduced the cell Grid dimensions : formely hardwired to 256. And this, Arma format, simply adds a small wrinkle of a cellGrid Size. Formerly set at 50 meters.


====XYPair====
XYPair
{
  ulong x,y;
}
===MaterialName===
===MaterialName===
     MaterialName
     MaterialName
     {
     {
       ulong Always0;
       ulong Always0;
       ulong Length;
       String RvMatFileName; //"SomePboPrefix\SomeIsland\data\layers\p_002-000_l02.rvmat"
      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 that there is 1 less MaterialName than it's count
*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.
*Note that file paths are *always* hard - wired to the (virtual) PrefixRoot\ directory. Like ArmA P3d files, there is NO, relative addressing.
*The 'Materials' array always contains a Material with no name (length == 0) at the first position.
Conceptually, this is a list of all the textures that are used by this 'world'. The MaterialIndex array indicates what type of texture should be used in any given cell. Ie any 50 meter chunk of the map. Thus, you should fully expect to see a lot of the same index value for 'sea' texture (wherever it is arbitrarily listed in the Materials list).
===Object===
===Object===
     Object  
     Object  
     {
     {
       float TransformMatrix[4][3];// standard directX transform matrix
       float TransformMatrix[4][3]; // standard directX transform matrix
       ulong ObjectId;
       ulong ObjectId;
       ulong Length;
       String P3dFileName[Length];  // "ca\buildings\ryb_domek.p3d"
      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.).
:*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.).


[[Category:BIS_File_Formats]]
[[Category:BIS_File_Formats]]
[[Category:ArmA: File Formats]]
[[Category:ArmA: File Formats]]

Revision as of 00:43, 29 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.

A wrp file is the 'world map' for the given island. The simplicity of the requirements for the map are very neatly exposed in the structure below.

A 'world' is a square dimension divided into equidistant grids. Each Cell of the grid is a uniform 50 meter square of the map surface (be it land, or sea). The overall size of the map is a fixed-in-concrete dimension of the number of grids and their uniform cell size.

All that is required within each of these cells are definitions of

  • it's mean elevation (above or below sea level),
  • the texture for it's surface.

The 'elevation' is clearly a mean, or average value, since chunks of cells don't suddenly jump 200 meters etc. Instead, the engine smooths the differences. Textures in arma can be very simple 'sea' or quite complex 'land terrain' and are represented in .rvmat files. Textures don't, of themselves, complicate the structure of a wrp file.

Provisions exist to alter the map to

  • Non Square dimensions
  • Separate grids for Textures versus Elevations.
  • Something other than 50 meter cells.

Official BI maps have never used it. And I am unaware of any Oem map that does so.

The only other necessary component of a wrp file is to populate it with objects. Objects are models, and as such, any single model is represented by a p3d file. Naturally and of course, the same model (Pine tree) can be referred to multiple times. Each one is a unique Object from the perspective of the wrp file. P3d models can of course be quite complex, even to the point of being inter-active, eg opening doors, but again, of themselves, they do no complicate the structural arrangement of a wrp file. Objects are independent of the cell grid structure. They are placed on the map using their own dimensional space transform. For all the engine cares, the building could be upside down and buried 10 meters under the sea.

For the purposes of game play, and no other reason, each, identical pine tree has a unique 'ID' number. (as does every other object). A soldier is told to goto THAT pine tree (as opposed to any other). The IDvalue, while guaranteed to be unique, is highly arbitrary. Any alterations / additions / deletions to the map and it's objects will result in different numbers for some / most / all of the objects. This represents no problem with game commands using NearestObject() style functions that return the ID of relevance, but, missions relying on a specific building ID (eg) will mostly fail if the 'island' is revised. This has particular relevance to porting OFP islands into Arma.

Legend

  • 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)
  • char: ascii character(s)

String

String
{
 ulong Length;
 char  ascii[Length];
}

This is a Basic or Pascal way of doing things. Unlike the more familiar Asciiz (null terminated) strings used in other file formats, here, speed is used to NOT calculate string length (or at least hunt the null char)

XYPair

XYPair
{
 ulong x,y;
}

File Format

  • This file format is principally used with Armed Assault and a derivation of it was used for Elite.

8WVR

 8WVR
 {
   WRPHeader     Header
   float         Elevations   [TerrainGridSize.y][TerrainGridSize.x];
   ushort        MaterialIndex[TextureGridSize.y][TextureGridSize.x]; //zero based index into MaterialNames
   ulong         NoOfMaterials - 1;                                   //1 Based array.
   MaterialName  MaterialNames[NoOfMaterials];
   ulong         Unknown;      // only seen zero
   Object        Objects[...];
}
  • The 'Elevations' array is Cartesian mapped. It extends from Bottom-Left to Top-Right in Visitor;
  • The Objects extend to end of file. There is no count as such.
  • There is always at least one Object entry.
  • The last, (and possibly only) entry, has no p3d filename associated with it. This is the 'default' object specifying the 'center' of the map.


WrpHeader

WrpHeader
{
  char    Filetype;        // "8WVR"
  XYPair  TextureGridSize; // 256 x 256 eg
  XYPair  TerrainGridSize; // ditto
  float   CellSize;        // generally 50.0 meters
}

This is a fairly traditional Header for all Wrp types (including "OPWRxx"). OFP Resistance first introduced the cell Grid dimensions : formely hardwired to 256. And this, Arma format, simply adds a small wrinkle of a cellGrid Size. Formerly set at 50 meters.

MaterialName

   MaterialName
   {
     ulong  Always0;
     String RvMatFileName; //"SomePboPrefix\SomeIsland\data\layers\p_002-000_l02.rvmat"
   }
  • Note 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.
  • The 'Materials' array always contains a Material with no name (length == 0) at the first position.

Conceptually, this is a list of all the textures that are used by this 'world'. The MaterialIndex array indicates what type of texture should be used in any given cell. Ie any 50 meter chunk of the map. Thus, you should fully expect to see a lot of the same index value for 'sea' texture (wherever it is arbitrarily listed in the Materials list).


Object

   Object 
   {
     float  TransformMatrix[4][3]; // standard directX transform matrix
     ulong  ObjectId;
     String P3dFileName[Length];   // "ca\buildings\ryb_domek.p3d"
   }
  • 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.).