anno-mods / FileDBReader

A command line tool for working with a proprietary bluebyte file compression used in Anno 2205 and 1800.
15 stars 4 forks source link

Sparse Grid Interpreter needs more work #24

Open Shad0wlife opened 2 years ago

Shad0wlife commented 2 years ago

Tagging @Atria1234 for this as well.

The values of the sparse grid don't get handled correctly. They aren't just a byte array, but for a Sparse Grid with 16x16 Tiles, the values tag contains 256 None tags, which are either empty (self closing) or contain a data element that is 4 bytes in size. This also means that that data cannot be interpreted as AreaID data because there each coordinate only has 2 bytes of data.

[Clickable Spoiler] Here is a sparse grid from the community island (data interpreted as 2x Int16) ```xml True 320 320 1 16 16 64 80 65 0 3928 -16384 3929 -15360 3930 -14336 3931 -13312 66 0 66 0 193 0 0 ```

So generally the info about the mode is correct, just the actual data is not what we expected it to be. I don't know if it's 4 Bytes or 2 Shorts (like above), I'm just mostly certain it's not 1 Int32 😄

Atria1234 commented 2 years ago

What is the None interpreted from? Is it already in uninterpreted XML?

Also isn't it possible that they use different sparse grid for the AreaIds and VarMapData?

Shad0wlife commented 2 years ago

Yes, the None Tags are part of the uninterpreted export. Also, AreaIDs is not a Sparse Grid, but a "full" one with 2 bytes per Grid coordinate.

The only 2 Sparse Grids I know are VarMapData and the IrrigationManager or so.

Atria1234 commented 2 years ago

AreaIds is also a sparse grid of 2 bytes per grid cell for some maps in last GU. For example colony01_l_05_river_01

Shad0wlife commented 2 years ago

Ok, yeah I just opened a storyisland. The AreaIDs Sparse Grid definitely has a different data type per grid cell (the same 2 bytes as non-sparse) than eg. the VarMapData.

Though I have to admit, for storyisland_01 why they even use a sparsegrid, when they don't use any defaults there but only values, for all tiles. That is just a regular grid, but inefficient :D (Doesn't affect our interpreter though)