dom+notes

September 20th, 2000
 * EDITING NOTES ON EAW TERRAIN AND AIRFIELD/GROUND TARGET FILES**

Dominique "DOM" Legrand Dominique.Legrand@univ-lille1.fr

Table of contents :

A) Introduction B) EAW.TM C) EAW16.HM D) Targets.dat E) Airfield.dat F) Tardata.dat G) Griddata.dat H) XY coordinates and the 640x320 tiles matrix I) Files provided in this ZIP J) Creating a new theater - a practical approach

A) *************** INTRODUCTION ***********************

The landscape in EAW is controlled, at least in part, by two files contained in DATA.CDF : EAW.TM and EAW16.HM. While EAW.TM codes for the sequence of the 640x320 (204800) tiles that constitute the EAW landscape, EAW16.HM codes for the height of these tiles. A tile represents a surface of 16.8 Km2 (4.1x4.1 Km). Therefore, the whole EAW map covers an area of about 2600x1300 Km (1500 x 750 miles).

The nature and location of airbases/ground targets are controlled, at least in part, by four files : Targets.dat, Airfield.dat, Griddata.dat and Tardata.dat. - Targets.dat contains a complete list of the 302 targets/airbases (162 airbases and 140 static ground targets) with corresponding XY coordinates. - Tardata.dat also contains the list of the 302 targets/airbases but with extensive infos on the composition of the targets. - Airfield.dat contains infos about the nature and orientation of the 162 airfields. - Griddata.dat manages the appearance of airbases and ground targets on the map. In other terms, it says to the program which targets will be displayed in a certain area. In fact, Griddata.dat looks like a "picture" of the 640x320 tiles matrix but in the 40x20 format.

B) ********************** EAW.TM ***********************

EAW.TM contains 204800 bytes which correspond to the 204800 tiles of the EAW landscape. As a matter of fact, every tile is coded by only one byte. The EAW.TM bytes form a 640x320 matrix. Bytes 00d to 639d correspond to the Northern upper row of tiles, from west to east. Bytes 640d to 1279d correspond to the row of tiles just below, also from west to east, and so on ...

There are 68 different terrain tiles provided in the PicPac utility (BN*.PCX files which can be transformed into BN*.TER (low altitude) and LR*.TER (high altitude)) but only 59 of them are used by the program.

Every tile is coded by four values corresponding to four different orientations (north, east, south and west). All these values range from 00 to FA. Values CB, CC, CD, CE ,CF, DB, DC, DD, DE, DF, EB, EC, ED, EE, EF, FB, FC, FD, FE and FF are not used. Changing an existing value with any of these values displays a black tile on the terrain.

The different values are listed thereafter :

Codes defining the nature and orientation of tiles in EAW

Orientation of the upper side of tiles Tiles North East South West (BN*.PCX files in PicPac)

Cities BNALCTY 0A 4A 8A CA BNALCTY2 0B 4B 8B CB BNALCTY3 0C 4C 8C CC BNALCTY4 0D 4D 8D CD BNALCTY5 2A 6A AA EA BNALCTY6* - - - - BNALCTY7 30 70 B0 F0 BNALCTY8 31 71 B1 F1 BNALCTY9 2E 6E AE EE

BNBASE* - - - -

Coasts BNCOAST1 03 43 83 C3 BNCOAST2 05 45 85 C5 BNCOAST3 04 44 84 C4 BNCOAST4 20 60 A0 E0 BNCOAST5 21 61 A1 E1 BNCOAST6 2C 6C AC EC BNCOSTBR 34 74 B4 F4 BNCOSTCT 39 79 B9 F9 BNCOSTRV 37 77 B7 F7 BNCOSTTR 3A 7A BA FA BNCOSTU1 32 72 B2 F2 BNCOSTU2 33 73 B3 F3

Fields BNFIELD1 06 46 86 C6 BNFIELD2 07 47 87 C7 BNFIELD3* - - - - BNFIELD4 09 49 89 C9 BNFIELD5 08 48 88 C8 BNFIELD6 2F 6F AF EF BNFIELD7 26 66 A6 E6 BNFIELD8 00 40 80 C0 BNFIELD9* - - - -

Forests BNFORST1 1B 5B 9B DB BNFORST2 1F 5F 9F DF BNFORST3 1E 5E 9E DE BNFORST4 1A 5A 9A DA BNFORST5 1C 5C 9C DC BNFORST6 1D 5D 9D DD BNFORST7 29 69 A9 E9

Grass BNGRASS 01 41 81 C1 BNGRASS2* - - - -

Mountains BNMOUNT1 16 56 96 D6 BNMOUNT2 19 59 99 D9 BNMOUNT3 18 58 98 D8 BNMOUNT4 17 57 97 D7

Rivers BNRIVER1 0E 4E 8E CE BNRIVER2 0F 4F 8F CF BNRIVER3* - - - - BNRIVER4 11 51 91 D1 BNRIVER5 12 52 92 D2 BNRIVER6 13 53 93 D3 BNRIVER7 14 54 94 D4 BNRIVER8 15 55 95 D5 BNRIVER9 10 50 90 D0 BNRIVRBR 35 75 B5 F5 BNRIVRFK 36 76 B6 F6 BNRIVRND 2B 6B AB EB BNRIVRTR 38 78 B8 F8

Roads BNROAD1 22 62 A2 E2 BNROAD2 23 63 A3 E3 BNROAD3* - - - - BNROAD4 25 65 A5 E5 BNROAD5* - - - - BNROAD6 24 64 A4 E4 BNROAD7* - - - - BNROAD8 27 67 A7 E7 BNROAD9 28 68 A8 E8 BNROAD10 2D 6D AD ED

Water BNWATER 02 42 82 C2

(* : not used in EAW)

C) *************** EAW16.HM ***********************

EAW16.HM codes for the height of tiles (more precisely, the upper left corner (node) of tiles) in EAW. The structure is very similar to the one of EAW.TM. However, the data for every tile are coded by two bytes whose values range from 00h 00h (sea level) to FFh FFh (higher altitude, about 5000 meters). EAW16.HM is 409600 bytes long and is organized as a 1280x320 matrix. Bytes 00d to 1279d correspond to the Northern row of tiles, from west to east. Bytes 1280d to 2559d correspond to the row of tiles just below, also from west to east, and so on ...

D) ************ TARGETS.DAT ************************************

Targets.dat is 9668 bytes big and is organized into 302 chunks of 32 bytes (302 targets) more 4 "end" bytes.

Example of the first chunk (0d-31d) :

2E 01 00 00 31 B5 B6 FD 0D 9C CC E7 5F 1A 00 00 E8 D2 12 00 16 00 08 10 F5 00 00 00 00 00 00 00

and the second chunk (32d-63d) :

00 00 00 00 9A C2 18 FE 9C 6E B3 E7 DE 22 00 00 76 3D 14 00 61 00 41 0B 8D 04 00 00 82 00 00 00

Structure of a chunk :

Bytes 0d & 1d : 2E01 in the first chunk; always 0000 in the 301 other chunks Bytes 2d & 3d : always 0000 Bytes 4d-7d : X coordinate of the target (see further chapter) Bytes 8d-11d : Y coordinate of the target (see further chapter) Bytes 12d-13d : still unknown Bytes 14d-15d : always 0000 Bytes 16d-25d : still unknown Bytes 26d-32d : 000000000000 for a target which is not an airbase 0000XXXX0000 for an airbase, where XXXX is so- called the "A code" in the EAWK3.wdb file. The A code identifies the different airbases in the Squ*.dat files (campaigns). For example, in chunk The "A code" of every target is contained in EAWK3.wdb
 * 2, "82" refers to Morlaix, France.

E) *************** AIRFIELD.DAT **********************

The file is 7132 bytes big. It consists of 162 chunks of 44 bytes more 4 "end" bytes. The 62 chunks correspond to the 162 airfields available in EAW. It contains data on the nature, size and orientation of the airfields.

Example of chunk #1 in airfield.dat (0d-43d) :

A2 00 00 00 00 00 DC 78 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF 09 00 09 00 09 00 00 01 02 00 07 00 07 00 51 00 00 00

Structure of a chunk :

Bytes 0d-5d : still unknown, sometimes all 00 Bytes 6d &7d : still unknown, never 00 Bytes 8d-23d : always 00 Bytes 24d-39d : still unknown, repeats of 0X 00 Bytes 40d & 41d: so-called "T code" in EAWK3.wdb. This code is specific to a given airfield. Elsewhere, any of the 302 targets in EAW has its own T code. Bytes 42d & 43d : always 00

The bytes coding for every airfield and the T codes are indicated in EAWK3.wdb

I noted that the exchange of a chunk of an existing airfield (displayed on the map) with the one of an airfield which is not activated, does activate this latter and desactivates the first one.

This finding was used to move some allied bases from west to east, in order to play with frontlines #10 to 22.

F) *************** TARDATA.DAT ***********************

Tardata.dat is 122436 bytes big. It consists of 3826 chunks of 32 bytes more 4 "end" bytes. Every chunk corresponds to an element (sub-target) of a given target. Depending on the target, the number of chunks may vary from 4 to 22.

Example of a set of 5 chunks coding for the "Fürth" target (bytes 20224d-20383d):

00 00 00 00 81 00 00 00 04 00 00 00 03 01 00 00 B3 FC FF FF A6 0C 00 00 16 00 00 00 D4 7F 00 00

00 00 00 00 81 00 00 00 11 00 00 00 03 01 00 00 32 10 FF FF E5 38 FF FF 80 01 00 00 00 28 00 00

00 00 00 00 81 00 00 00 11 00 00 00 03 01 00 00 F3 CA 00 00 E6 C4 00 00 57 01 00 00 00 58 00 00

00 00 00 00 81 00 00 00 12 00 00 00 03 01 00 00 B3 25 01 00 E5 B4 FE FF 69 FF FF FF 00 88 00 00

00 00 00 00 81 00 00 00 12 00 00 00 03 01 00 00 72 02 FF FF A6 40 01 00 06 05 00 00 00 60 00 00

Structure of a chunk :

Bytes 0d-3d: always 00h Byte 4d: still unknown Bytes 5d-7d: always 00h Byte 8d: Code specific to a "subtarget". There are 25 subtargets in total. So far I know, 01 and 02 code for factories, 03 = oil factory, 05 = factory, 05 = the airfield itself, 06 = factory, 07 = RR station, 08 small hangar, 09 submarine shelter, 0A = ???, 11 = AAA, 12 = airfield light AAA, 13 = oil tank, 14 = radar center, 15 = radar tower, 17 = Bunker, 18 = airfield petrol storage, 19 = airfield control tower, 1A = airfield bunker, 1B = airfield large hangar, 1C = airfield small barrack, 1D = airfield mess, 1E = airfield QG, 1F, airfield large barrack and 29 = large hangar. Warning : some of these codes are maybe not correct and have to be further investigated. Bytes 9d-31d: still unknown but they are likely to code for the relative positions of subtargets inside the main target. Setting these bytes to 00 moves the subtargets to an unique position.

When studying the Tardata.dat file, very odd things occured when replacing some data with others. Managing data in Tardata.dat is probably not so simple as one could imagine ...For example, one subtarget can be changed with an other one, but not all. Some changed subtargets can be viewed on one side (german for example) but not when playing on the other side (allies). The Tardata.dat structure has to be further investigated.

G) *************** GRIDDATA.DAT **********************

Griddata.dat is 6400 bytes big. It manages the appearance of airbases and ground targets on the map. Griddata.dat consists of 800 chunks of 8 bytes each. It is organized as a 40 columns (40x8=320 bytes) x 20 lines matrix. It is like a "picture" of the 640x320 tiles matrix but in the 40x20 format.

The content of a chunk indicates to the program which airbases/targets are present in a given area. This area is 2304 (48x48) tiles big.

A chunk is in the format : XX 00 00 00 YY YY 00 00 where XX is the number of airbases/targets coded by the chunk and YY YY is the "T code" of the first airbase/target.

For example, such a chunk : "00 00 00 00 00 00 00 00" indicates to the program that no airbase/target needs to be displayed within a given 48x48 tiles area.

Another example : "01 00 00 00 01 00 00 00" indicates to the program that one airbase/target corresponding to Morlaix, France (01 is the T code for Morlaix) will be present within 48x48 tiles on the map.

Last example : "03 00 00 00 FC 00 00 00" indicates to the program that three airbases/targets with consecutive T codes (FC, FD and FE) will be present within 48x48 tiles on the map.

About the 48x48 tiles areas covered by the chunks:

Up to 9 different chunks may code for a airbase/target or a series of airbases/targets at a given location on the map. In fact, two adjacent chunks code for areas which overlap on 32 tiles (i.e. the areas are shifted by 16 tiles).

Correspondence between the 640x320 tiles matrix and the 40x20 griddata chunks matrix :

Columns : Chunk #1 of one of the 20 lines of the griddata matrix covers columns 1 to 31 of the 640x320 tiles matrix. Chunk #2 covers columns 1 to 48 of the 640x320 tiles matrix. Chunk #3 covers columns 17 to 64 of the 640x320 tiles matrix. Chunk #4 covers columns 33 to 80 of the 640x320 tiles matrix. ......... Chunk #40 covers columns 609 to 640 of the 640x320 tiles matrix.

Lines : Chunks of the first line of the griddata matrix cover lines 1 to 31 of the 640x320 tiles matrix. Chunks of the second line of the griddata matrix cover lines 1 to 48 of the 640x320 tiles matrix. Chunks of the third line of the griddata matrix cover lines 17 to 64 of the 640x320 tiles matrix. Chunks of the fourth line of the griddata matrix cover lines 33 to 80 of the 640x320 tiles matrix. ........ Chunks of the 20th line of the griddata matrix cover lines 289 to 320 of the 640x320 tiles matrix.

H) ******* XY coordinates and the 640x320 tiles matrix *****

The precise position of targets on the map is coded through the XY coordinates found in targets.dat. The format of these coordinates is similar to the one of frontlines coordinates (frntline.dat).

About the X coordinates :

They range from 00 00 81 FD to 00 00 80 07 that correspond to column #1 and #640 of the 640x320 tiles matrix, respectively. Every increment of the fourth byte corresponds to 64 columns. For example, 00 00 81 FE will correspond to column #64, 00 00 81 FF to column #128, 00 00 81 00 to column #192 and so on... Every four increments of the third byte correspond to one column. For example, 00 00 85 FE will correspond to column #65, and so on ... Bytes one and two are much less important and correspond to fractions of a column.

About the Y coordinates :

They range from 00 00 81 E4 to 00 00 80 E9 that correspond to line #1 and #320 of the 640x320 tiles matrix, respectively. Every increment of the fourth byte corresponds to 64 lines. For example, 00 00 81 E5 will correspond to line #64, 00 00 81 E6 to line #128, 00 00 81 E7 to line #192 and so on... Every four increments of the third byte correspond to one column. For example, 00 00 85 E5 will correspond to line #65, and so on ... Bytes one and two correspond to fractions of a line.

I) *************** Files provided in this ZIP ******************

- Readme.txt (this file) - Eawk3.wdb (database file in MSWorks 3.0 format)containing infos about any of the 302 targets in the original EAW configuration : Name of target; T code; A code, bytes in Griddata.dat; bytes in Airfield.dat; line in Griddata.dat matrix; X coordinates; Y coordinates; bytes in Targets.dat; offset in EAW.TM; line and column numbers of the 640x320 Tiles matrix. - Targetset.zip containing utilities written in MS Qbasic : - Blankfiles.zip : a set of Targets.dat and Griddata.dat files providing a "no target/airbase" map. These files should be used as a starting material for constructing new maps, adding airbases and targets one by one.
 * Convert.bas : utility which converts the XY coordinates of targets from targets.dat into the corresponding tiles of the 640x320 terrain matrix (lines and columns of the 640x320 matrix and bytes in EAW.TM), the bytes coding for the height of tiles (bytes in EAW16.HM) and the corresponding bytes in Griddata.dat.
 * Vertcon.bas : the same as Convert.bas but allowing the reverse thing, i.e. the conversion of lines/columns into the XY coordinates used in Targets.dat.
 * French Qbasic.exe and Qbasic.hlp for running the utilities (if necessary, of course) are included.

J) ****** Creating a new theater - a practical approach ******

This last chapter deals with the practical way to create a new EAW theater.

First main step : creating a new map.

It is better starting with a EAW.TM file filled with randomly-distributed 02, 42, 82 and C2 tiles. This gives the ocean everywhere. "Ground" tiles should be added, one by one to get islands/continents on the map. Then, or later, a blank EAW16.HM (all bytes set to zero) should be modified to set the height of tiles.

Second main step : placing new airbases/targets on the blank map.

A practical and simple example : How to set two airbases/targets on a blank map ? 1) Lille at line #145 and column #209 of the 640x320 tiles matrix 2) Cambrai at line #97 and column #190 of the 640x320 tiles matrix

The way to do :

1) Open EAWK3.wdb and search for the T codes of Lille and Cambrai, as well as the corresponding bytes in targets.dat. T codes are 85 and 88 for Lille and Cambr ai, respectively, and the bytes in Targets.dat are 4256-4287 and 4352-4383.

2) Place Qbasic.exe, Qbasic.hlp, convert.bas, vertcon.bas in a temporary folder. - Open a DOS-windows and set the pathway to the temporary folder. - Type "Qbasic.exe /run vertcon.bas" to run the utility. - Enter line = 145 and column = 209. - The utility gives you the offsets in EAW.TM, EAW.HM but also : and Y = 0000C2E6 case, 2984-2991 is the best choice. - Press Space to run the utility again - Enter line = 97 and column = 190 - The utility gives you the offsets in EAW.TM, EAW.HM but also : and Y= 000002E6 case, 2016-2023 is the best choice.
 * the corresponding X & Y coordinates as X = 0000C600
 * the bytes of the adequate griddata.dat chunks. In that
 * the corresponding X & Y coordinates as X = 00007A00
 * the bytes of the adequate griddata.dat chunks. In that

3) Using a Hex-editor, open the "blank" Targets.dat provided within this ZIP. The targets.dat file has any of the targets set in only one default location (north-west corner of the map). - Display bytes 4256-4287 (bytes for Lille) - Type 0000C600 at bytes 4260-4263 and 0000C2E6 at bytes 4264- 4267. - Display bytes 4352-4383 (bytes for Cambrai) - Type 00007A00 at bytes 4356-4359 and 000002E6 at bytes 4360- 4363. - Record and close Targets.dat

4) Using a Hex-editor, open the blank Griddata.dat provided within this ZIP. All bytes are set to zero. - Display bytes 2984-2991 - Type 01 00 00 00 85 00 00 00 (i.e. one airbase/target whose T code is 85 and corresponds to Lille) - Display bytes 2016-2023 - Type 01 00 00 00 88 00 00 00 (i.e. one airbase/target whose T code is 88 and corresponds to Cambrai). - Record and close Griddata.dat

That's done : the two first airbases/targets are now available on the map. This can be checked by dropping both modified Targets.dat and Griddata.dat into the EAW directory and running EAW. Of course, the default frontline (#1) has to be loaded to play Cambrai as Allied and Lille as Axis.

WARNING : depending on the size, complexity (various subtargets) and exact XY coordinates of a given airbase/target, the airbase/target may lie on several tiles. Thus, both convert.bas and vertcon.bas utilities give the main tile (in the center of the 9 tiles patch) which supports the airbase/target, more the adjacent tiles. This is also true for the height of tiles.

Please, give credits to this work in further applications and developments. Thanks.

D. Legrand