Monochrome map (.bit, .lev)

From Worms Knowledge Base

Revision as of 09:08, 7 July 2006 by Annelid (Talk | contribs)

Jump to: navigation, search

History

Monochrome map files (*.lev and *.bit) represent a particular type of terrain playable as a battlefield in Worms Armageddon. Until Deadcode added colour .PNG maps support to the game in 2004, the only other type of map in the game was the IMG file, manifested in a finite library of graphics the Team17 artists had drawn. Although it would be wrong to say that the Monochrome format was the only one possible in network play (to this day, some IMG terrains such as GunBox appear on a pulldown bar as options), it has always been by far the most widely used.

Information

Monochrome maps break down into two types, commonly referred to by their respective extensions: LEV maps (*.lev), and BIT maps (*.bit). For the purposes of this entry they will be referred to as such. The formats have a large amount in common; they both represent an area of 1920x696 pixels in monochrome (black and white), with white representing terrain and black equating to empty space. The only difference between the formats is how this bitmap is represented: a LEV map contains a seed (sort of like a unique ID number) that Worms' terrain generator uses to draw the land. Because of how the generator creates terrain, any randomly generated landscape can be represented by a 4 byte long number, and can be redrawn exactly the same using only that number. A BIT map does not store such a seed; since the image is custom drawn, the actual black and white image is saved in the file. The rest of the data in a monochrome map is information such as what type the terrain should be, how many objects and bridges should occur, where they should be placed, how high the water should be... almost equivalent to the settings available in the W:A ingame map editor. This data ends up taking up 40 bytes of space. A LEV map is always 40 bytes in size. Since a BIT map is nothing more than a LEV map with an image appended to it, it can range in size from under 100 bytes to over 100 KB, depending on the complexity of the image.

File Format Specifications

The LEV file contains 40 bytes, while a BIT file contains these same 40 bytes as a header, followed by a 1-bit monochrome image compressed in the LEADTools proprietary CMP format. Currently the specifications for the CMP format are copyrighted and secret, and the only practical method to encode or decode a CMP image is by using LEAD's own imaging libraries - the very ones that come with Worms. This is how current 3rd-party software operates. The specifications for generating terrain from a seed are currently known only by Team17, which is why no external viewers of LEV maps exist currently.

It should be noted that these 40 bytes are common to all Worms Armageddon maps, even colour ones. When W:A saves a PNG image, it adds a chunk called "w2lv" which contains these 40 bytes of data. Many of the values are irrelevant in a colour map (and some are, to a degree, in a BIT map), but they occur anyway to preserve the 40 byte structure. This list of the 4-byte values occuring in the header is by offset, in hexidecimal.

  • 0x00 - Land Seed - The seed Worms uses to draw the terrain, in a LEV file. This value has no effect in a BIT or PNG file because actual image data is loaded instead.
  • 0x04 - Object Seed - The seed Worms uses to determine where to position objects and bridges on the landscape, should they be drawn. In a PNG file this value serves no purpose. In a BIT or LEV file where "Objects on Terrain" and "Bridges" are both set to zero, the value of this field has no effect.
  • 0x08 - Cavern - Whether Worms treats the map like a cavern, with a ceiling, or an island. A value of 0 means island, while a nonzero value means a cavern.
  • 0x0C - Style - This parameter is related to the Land Seed and refers to one of the 8 types of maps (such as single island, double island, single cavern, double tunnel cavern). The same Land Seed can generate 8 different terrains, based on this parameter.
  • 0x10 - Indestructable Borders - A setting of 0 puts an indestructable border on all sides of the map and forces it to behave like a cavern. A nonzero setting is equivalent to "off".
  • 0x14 - Object Percentage - A value from 0 to 100 decimal determining whether objects will occur on the terrain. The objects are different for each soil type, and their placement depends upon the Object Seed. The ingame editor allows modification of this value by selecting an image from "1" to "10". These images correspond to the values (and thus percentages) 0, 11, 22, 33, 44, 55, 66, 77, 88, and 100. Worms is capable of loading, interpreting, and saving other percentages, but these are the only ones offered by the internal editor.
  • 0x18 - Bridge Percentage - A value from 0 to 100, exactly like the Object Percentage, which determines how likely bridges are to occur on the terrain. The same rules apply. It should be noted that in W:A v3.0 there was a bug that caused this value to be saved and loaded improperly as though it were set to zero. This error was carried over into the BITmonkey map viewer. W:A v3.5 has corrected this bug.
  • 0x1C - Water Level - A value from 0 to 99 representing how many pixels above the bottom of the map the water level begins at. Values above 99 will be converted to 99 by the game upon load. It is worth noting that the water can be set to 100 pixels ingame, and even saved with the value 100; however, it converts to 99 upon load.
  • 0x20 - Soil Texture Index - A value from 0 to 28, corresponding to the different types of soil selectable (Beach, Art, Cheese, Construction, etc). The Tools terrain fell out of the game for v3.0, meaning that a value of 26 referred to Tribal, and 27 to Urban, with 28 having no meaning (in WWP, 28 was the new Dinos terrain). In v3.6.25.1, Deadcode split this value into two, 2-byte WORDs. 0x20 contains the Soil Texture Index, and 0x22 contains a signed Version. The Version has no effect unless set to 1; this tells the game that a value of 26 corresponds to Tools. The Version is not used for any other terrain at this time, and the setting is for compatability purposes.
  • 0x24 - Water Colour - An artifact from the original v1.0 of W:A, this value allows selection of one of the several water colours. 0 is equivalent to Blue, and no other values will have effects at this time.

Software

In order to operate on such files, 3rd-party software must access the Lead Tools redistributable run-time libraries, shipped with Worms Armageddon and Worms World Party.

Currently, programs that can operate with .bit files are Annelid's BIT Monkey and the Thumbnail Shell Extension.

Personal tools