Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse Grid Interpreter needs more work #24

Open
Shad0wlife opened this issue Oct 16, 2022 · 4 comments
Open

Sparse Grid Interpreter needs more work #24

Shad0wlife opened this issue Oct 16, 2022 · 4 comments

Comments

@Shad0wlife
Copy link
Contributor

Shad0wlife commented Oct 16, 2022

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)
      <VarMapData>
        <SparseEnabled>True</SparseEnabled>
        <x>320</x>
        <y>320</y>
        <block>
          <mode>1</mode>
          <x>16</x>
          <y>16</y>
          <default>
            <None />
          </default>
        </block>
        <block>
          <x>64</x>
          <y>80</y>
          <values>
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None>
              <data>65 0</data>
            </None>
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None>
              <data>3928 -16384</data>
            </None>
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None>
              <data>3929 -15360</data>
            </None>
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None>
              <data>3930 -14336</data>
            </None>
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None>
              <data>3931 -13312</data>
            </None>
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None>
              <data>66 0</data>
            </None>
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None>
              <data>66 0</data>
            </None>
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None>
              <data>193 0</data>
            </None>
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
            <None />
          </values>
        </block>
        <block>
          <mode>0</mode>
        </block>
      </VarMapData>

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
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor

Atria1234 commented Oct 17, 2022

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
Copy link
Contributor Author

Shad0wlife commented Oct 17, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants