home pictures webcam about me various eu2
inferis.org

eu2 » TBL Files » boundbox.tbl

 
This file contains the coordinates of the boundboxes for each province.
A boundbox is the box that can be drawn connecting the "extremes" of a province.

Boundbox of Adirondak

In the example above, you can see the boundbox of the Adirondak province. As you can see, the province is entirely contained in the province, only touching the "extremes" of the province on each side. Another thing to notice is that other provinces can overlap the boundbox of a province. It is even possible that the boundbox of a small province is completely contained in the boundbox of a large province surrounding/neighbouring it.

File Info
Location » (eu2 root)\map\boundbox.tbl
Size » 25.840 bytes (26Kb)

File format
The file contains 1615 of coordinate pairs: each coordinate pair signifies the upper-left and the lower-right corner of each boundbox.
Each value is expressed as a 4-byte unsigned integer. This means that each block takes 16 bytes.

The first block is highlighted

Thus, each block starts at a 16 byte offset. This means you have easy access to the boundbox of a province: multiply the province id by 16, read 16 bytes and you have everything you need.

Each block has the following format:
offset + 0 offset + 4 bytes offset + 8 bytes offset + 12 bytes
upper-left X value upper-left Y value bottom-right X value bottom-right Y value

There are a few anomalies...
Since there are 1615 blocks, but only 1613 provinces, where do those 2 extra blocks come from? If you check out the province.csv file, you'll notice that the province ids count up to 1614.

The two invisible provinces

It turns out that the TI is also a province. But the zeroth block in the boundbox file is a strange block: it's first coordinate is actually the map size (18944,7296), and it's second coordinate is (0,0). If you follow the same logic of the rest of the blocks, this yields a "negative" boundbox. The same applies to the Dummy province (id=1614).
I guess using negative boundboxes gives the result that those provinces are not selectable, which is exactly what's needed, of course.

Usability
I'm not sure how this file is used by the EU2 engine. If you delete (or rename) the file, the game still boots without a problem. However, when starting a scenario or loading a game, you get an all white screen since everything seems to be TI. The funny thing is that the game continues, since you DO see the settler animations (for example) and it is still possible to select provinces.