{"name":"Wrp File Format - OPRW2 & 3","title":"Wrp File Format - OPRW2 & 3","type":"topic","url":"https://community.bistudio.com/wiki/Wrp_File_Format_-_OPRW2_%26_3","revid":373401,"updated":"2025-05-08T11:27:10Z","aliases":["Wrp File Format - OPRW"],"markdown":"> **Disclaimer: This page describes internal undocumented structures of Bohemia Interactive software.**\n>\n> This page contains unofficial information.\n>\n> Some usage of this information may constitute a violation of the rights of Bohemia Interactive and is in no way endorsed or recommended by Bohemia Interactive.\n> Bohemia Interactive is not willing to tolerate use of such tools if it contravenes any general licenses granted to end users of this community wiki or BI products.\n\n### General\n\n*Flashpoint wrp files use two different file formats to contain the data. This document contains information on OPRW format as used by WrpEdit, and as supplied in the standard BI Islands of Malden, Nogova and etc. OPRW files are, essentially, binarised.*\n\nThis document does **not** provide information on the better known 4WVR format.\n\nSee Island File Formats for more info\n\nSeveral versions of OPRW format exist.\n\n- Version2: Cold War Crisis. The original.\n- Version3: Resistance.\n- Version17: Elite\n- Version18: General Arma editing.\n- Version20: Arma's sara.pbo (at least)\n\nThis document describes ONLY Versions 2 & 3.\n\nThe **only** difference between these two formats is a 16 byte added map dimension size inserted towards beginning of header. Since all BI islands, including Resistance's Nogova, are 256 x 256 cells square, the information is redundant in terms of the 'official' maps. However this feature has been exploited heavily by map modellers to make some huge territories. Cat Afghansitan, and PMC Vietnam to name but two.\n\n### Conventions\n\n#### Legend\n\nsee Generic FileFormat Data Types\n\n### Structure\n\n```\nOPRWv2_3\n{\n WrpHeader  Header;\n ulong      PackedCellBitFlags[LayerDimensions];\n byte       PackedCellEnvSoundsp[LayerDimensions];\n ulong      nPeaks;\n XYZTriplet Peaks[nPeaks];////see http://en.wikipedia.org/wiki/Maxima_and_minima\n ushort     PackedCellTextureIndexes[LayerDimensions];\n ulong      PackedCellExtFlags[LayerDimensions];\n float      PackedCellElevations[MapDimensions];\n ulong      nTextures;\n Texture    Textures[nTextures];        // At least 1\n ulong      nModels;\n Model      Models[nModels];            //can be zero\n Object     Objects{...};               //56 byte records\n long      EndOfObjects;                //always -1\n};\n```\n\n#### WrpHeader\n\n```\n WrpHeader\n {\n char  Signature[4]; //\"OPRW\"\n ulong Version;      // 2(cwr) or 3 (Resistance)\n if (Resistance)\n {\n  XYPair  LayerDimensions; // (texture) 256 x 256 eg\n  XYPair  MapDimensions;   // (terrain) ditto\n }\n}\n```\n\nThis is a fairly common header througout all wrp formats (including WVR types). There are wrinkles to each one, so check the documentation for each.\n\nOfficial bis Operation Flashpoint islands are ALL 256 x 256 map and layer dimensions on a 50meter cube 'cell' (the cell also has a height)\n\n#### CellBitFlags\n\n```\n00000000 00000000 0iiiddgg00RF0Gaa\n```\n\n- iii incline 0..7\n- dd damage 0..3\n- Ggg geometry levels 0..7\n- F forest bit\n- R roadway bit\n- aa surfacetype\n  - 0: GROUND\n  - 1: TIDAL\n  - 2: COASTLINE\n  - 3: SEA\n\n#### CellEnvSounds\n\ncorresponds to Config.cpp CfgEnvSounds class.\n\n- 0 none\n- 1 sea\n- 2 tree\n- 3 meadow\n- 4 hill\n- 5 rain\n- 0ther...\n\n#### Peaks\n\n```\n  Ignored. OFP recalculates them at loading-time.\n```\n\nWhen present, the XYZ co-ordinate of each peak.\n\nThese are the 'points of interest'. Ie 'bumps' in the terrain and are shown in visitor and map game as '24', '6' etc on various parts of the island that have 'bumps' (or 'depressions') relative to the general (cell) area.\n\nsee http://en.wikipedia.org/wiki/Maxima_and_minima\n\nThe coordinates are expressed in meters on the world grid, X and Y have to be divided by the map, or layer resolution to get the map or cell co-ordinate respectively.\n\nIn the case of official Operation Flashpoint islands, both resolutions are 50 meters. All layers, All maps, are 256x256 on 50meter cubes per cell.\n\n#### CellTextureIndexes\n\nEach value is index into the Asciiz Textures List.\n\nindex = 0 has a corresponding entry in the Textures List, but is not used.\n\n#### CellExtFlags\n\nXXXXabcc\n\nContains 3 subsections:\n\n- cc 0-FF Random values (0..255)\n- b signed 7 -> -8 Random values, depends on texture color\n- a signed Random value, depends on texture color flag\n\nIgnored. OFP recalculates them at loading-time.\n\nSection can be filled with zero.\n\n#### CellElevations\n\nValues of vertices of 257x257 mesh (cells - 256x256). Last right column, and last top row of this mesh (257x257) contains 0.0 and is not included in this section.\n\nNo restriction for min/max values but recommended values: from -50.0 to 1000.0\n\n#### Texture\n\n```\n Texture\n {\n  asciiz Filename;\n  byte Color;\n }\n```\n\nLike all similar formats, there is a minimum of one entry. The 1st entry is a dummy and never accessed but typically contains the string\n\n\"data\\more_anim.01.pac\".\n\nThis is the transparent index value.\nMost of the other textures have color values.\n\nAlthough unusual, other entries *could* contain empty names. Where encountered, they would never be referenced.\n\n#### Model\n\n```\n Model\n {\n   asciiz Filename; //\"data3d\\thing.p3d\"\n }\n```\n\n#### Object\n\n```\nObject\n{\n ulong ObjectID;        // 4 gig of objects\n ulong ModelIndex;      //The index number to use from the model list above to obtain the filename.\n float Transform[4][3]; //This is the traditional 9 cell vertex to orient and rotate a model.\n}\n```\n\nObjects, if any, are indexes into the models named above (if any).\n\nObjects, and the models they refer to, are the way to place buildings, trees, etc on the map.\n\nThe ObjectID is a unique value that identifies **this** PineTree\n\nTransform[4][3];\n\nThis is the transform matrix used directly by Microsoft DirectX engines.\n\nIn fact, the 'correct' matrix is actually 4 x 4, but the last column always represents 0,0,0,1 thus\n\n```\nM11,M12 M13 (0.0)\nM21,M22,M23 (0.0)\nM31,M32,M33 (0.0)\nM41,M42,M43 (1.0)\n```\n\nand so is never stored.\n\nThis identical matrix is used for WRP files (both formats) and RTM files.\n\nThe last row (M41...) happens to be the position of the object X Z Y co-ordinates, and is often referred to separately.\n\nFor further information visit [Microsoft](http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/fixedfunction/transforms/transforms.asp).\n\n### FILE PACKING\n\nIn order to conserve space, where, the majority of cells will contain identical information (if not zero, then an awful lot of 'sea' texture). run length packing is used. The algorithm is identical to that used in pbo compression. Principally, a flag byte followed by mixtures of 8 raw bytes and 2byte pointers.\n\nEach of the array[ ][] entries above are packed. They are treated as separate compressed blocks each with their own checksum. Since the desired size is known (256x256), unpacking consists of decoding the file up to that limit then checking the checksum.\n\nThe next 'block' ie, the next array is then treated in a similar manner.\n\nFor further information on this packing method see PBO File Format","sections":[{"heading":null,"level":1,"markdown":"> **Disclaimer: This page describes internal undocumented structures of Bohemia Interactive software.**\n>\n> This page contains unofficial information.\n>\n> Some usage of this information may constitute a violation of the rights of Bohemia Interactive and is in no way endorsed or recommended by Bohemia Interactive.\n> Bohemia Interactive is not willing to tolerate use of such tools if it contravenes any general licenses granted to end users of this community wiki or BI products."},{"heading":"General","level":3,"markdown":"*Flashpoint wrp files use two different file formats to contain the data. This document contains information on OPRW format as used by WrpEdit, and as supplied in the standard BI Islands of Malden, Nogova and etc. OPRW files are, essentially, binarised.*\n\nThis document does **not** provide information on the better known 4WVR format.\n\nSee Island File Formats for more info\n\nSeveral versions of OPRW format exist.\n\n- Version2: Cold War Crisis. The original.\n- Version3: Resistance.\n- Version17: Elite\n- Version18: General Arma editing.\n- Version20: Arma's sara.pbo (at least)\n\nThis document describes ONLY Versions 2 & 3.\n\nThe **only** difference between these two formats is a 16 byte added map dimension size inserted towards beginning of header. Since all BI islands, including Resistance's Nogova, are 256 x 256 cells square, the information is redundant in terms of the 'official' maps. However this feature has been exploited heavily by map modellers to make some huge territories. Cat Afghansitan, and PMC Vietnam to name but two."},{"heading":"Conventions","level":3,"markdown":""},{"heading":"Legend","level":4,"markdown":"see Generic FileFormat Data Types"},{"heading":"Structure","level":3,"markdown":"```\nOPRWv2_3\n{\n WrpHeader  Header;\n ulong      PackedCellBitFlags[LayerDimensions];\n byte       PackedCellEnvSoundsp[LayerDimensions];\n ulong      nPeaks;\n XYZTriplet Peaks[nPeaks];////see http://en.wikipedia.org/wiki/Maxima_and_minima\n ushort     PackedCellTextureIndexes[LayerDimensions];\n ulong      PackedCellExtFlags[LayerDimensions];\n float      PackedCellElevations[MapDimensions];\n ulong      nTextures;\n Texture    Textures[nTextures];        // At least 1\n ulong      nModels;\n Model      Models[nModels];            //can be zero\n Object     Objects{...};               //56 byte records\n long      EndOfObjects;                //always -1\n};\n```"},{"heading":"WrpHeader","level":4,"markdown":"```\n WrpHeader\n {\n char  Signature[4]; //\"OPRW\"\n ulong Version;      // 2(cwr) or 3 (Resistance)\n if (Resistance)\n {\n  XYPair  LayerDimensions; // (texture) 256 x 256 eg\n  XYPair  MapDimensions;   // (terrain) ditto\n }\n}\n```\n\nThis is a fairly common header througout all wrp formats (including WVR types). There are wrinkles to each one, so check the documentation for each.\n\nOfficial bis Operation Flashpoint islands are ALL 256 x 256 map and layer dimensions on a 50meter cube 'cell' (the cell also has a height)"},{"heading":"CellBitFlags","level":4,"markdown":"```\n00000000 00000000 0iiiddgg00RF0Gaa\n```\n\n- iii incline 0..7\n- dd damage 0..3\n- Ggg geometry levels 0..7\n- F forest bit\n- R roadway bit\n- aa surfacetype\n  - 0: GROUND\n  - 1: TIDAL\n  - 2: COASTLINE\n  - 3: SEA"},{"heading":"CellEnvSounds","level":4,"markdown":"corresponds to Config.cpp CfgEnvSounds class.\n\n- 0 none\n- 1 sea\n- 2 tree\n- 3 meadow\n- 4 hill\n- 5 rain\n- 0ther..."},{"heading":"Peaks","level":4,"markdown":"```\n  Ignored. OFP recalculates them at loading-time.\n```\n\nWhen present, the XYZ co-ordinate of each peak.\n\nThese are the 'points of interest'. Ie 'bumps' in the terrain and are shown in visitor and map game as '24', '6' etc on various parts of the island that have 'bumps' (or 'depressions') relative to the general (cell) area.\n\nsee http://en.wikipedia.org/wiki/Maxima_and_minima\n\nThe coordinates are expressed in meters on the world grid, X and Y have to be divided by the map, or layer resolution to get the map or cell co-ordinate respectively.\n\nIn the case of official Operation Flashpoint islands, both resolutions are 50 meters. All layers, All maps, are 256x256 on 50meter cubes per cell."},{"heading":"CellTextureIndexes","level":4,"markdown":"Each value is index into the Asciiz Textures List.\n\nindex = 0 has a corresponding entry in the Textures List, but is not used."},{"heading":"CellExtFlags","level":4,"markdown":"XXXXabcc\n\nContains 3 subsections:\n\n- cc 0-FF Random values (0..255)\n- b signed 7 -> -8 Random values, depends on texture color\n- a signed Random value, depends on texture color flag\n\nIgnored. OFP recalculates them at loading-time.\n\nSection can be filled with zero."},{"heading":"CellElevations","level":4,"markdown":"Values of vertices of 257x257 mesh (cells - 256x256). Last right column, and last top row of this mesh (257x257) contains 0.0 and is not included in this section.\n\nNo restriction for min/max values but recommended values: from -50.0 to 1000.0"},{"heading":"Texture","level":4,"markdown":"```\n Texture\n {\n  asciiz Filename;\n  byte Color;\n }\n```\n\nLike all similar formats, there is a minimum of one entry. The 1st entry is a dummy and never accessed but typically contains the string\n\n\"data\\more_anim.01.pac\".\n\nThis is the transparent index value.\nMost of the other textures have color values.\n\nAlthough unusual, other entries *could* contain empty names. Where encountered, they would never be referenced."},{"heading":"Model","level":4,"markdown":"```\n Model\n {\n   asciiz Filename; //\"data3d\\thing.p3d\"\n }\n```"},{"heading":"Object","level":4,"markdown":"```\nObject\n{\n ulong ObjectID;        // 4 gig of objects\n ulong ModelIndex;      //The index number to use from the model list above to obtain the filename.\n float Transform[4][3]; //This is the traditional 9 cell vertex to orient and rotate a model.\n}\n```\n\nObjects, if any, are indexes into the models named above (if any).\n\nObjects, and the models they refer to, are the way to place buildings, trees, etc on the map.\n\nThe ObjectID is a unique value that identifies **this** PineTree\n\nTransform[4][3];\n\nThis is the transform matrix used directly by Microsoft DirectX engines.\n\nIn fact, the 'correct' matrix is actually 4 x 4, but the last column always represents 0,0,0,1 thus\n\n```\nM11,M12 M13 (0.0)\nM21,M22,M23 (0.0)\nM31,M32,M33 (0.0)\nM41,M42,M43 (1.0)\n```\n\nand so is never stored.\n\nThis identical matrix is used for WRP files (both formats) and RTM files.\n\nThe last row (M41...) happens to be the position of the object X Z Y co-ordinates, and is often referred to separately.\n\nFor further information visit [Microsoft](http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/fixedfunction/transforms/transforms.asp)."},{"heading":"FILE PACKING","level":3,"markdown":"In order to conserve space, where, the majority of cells will contain identical information (if not zero, then an awful lot of 'sea' texture). run length packing is used. The algorithm is identical to that used in pbo compression. Principally, a flag byte followed by mixtures of 8 raw bytes and 2byte pointers.\n\nEach of the array[ ][] entries above are packed. They are treated as separate compressed blocks each with their own checksum. Since the desired size is known (256x256), unpacking consists of decoding the file up to that limit then checking the checksum.\n\nThe next 'block' ie, the next array is then treated in a similar manner.\n\nFor further information on this packing method see PBO File Format"}],"categories":["Operation Flashpoint: Modelling","Real Virtuality File Formats"],"groups":["Tools and File Formats"]}