Skip to content

Conversation

@TheLazzoro
Copy link
Contributor

@TheLazzoro TheLazzoro commented Aug 25, 2025

On the PTR for build 2.0.3.23052 Blizzard added support for 64 tile textures, up from 16.

Textures for each tile now use 6 bits instead of 4 and the rest of the flags have been shiftet to the left by 2.
Since there's no extra space otherwise, they've added 1 additional byte to all terrain tiles.

@Luashine
Copy link

I understand the conditional code for the textureAndFlags union will be ugly either way, but here's how I solved it. Seems less clunky. Although it is only for deserialization: https://github.com/Luashine/wc3-packhelper-library/blob/e44513d50b4a44d2bb0549d892a0e00092a42fdd/example/w3e.lua#L64-L98

High-level explanation: texture doesn't need shifting and is saved in a separate variable immediately upon parsing. The flags are:

  1. AND-ed by a mask
    • that is conditionally bit-shifted in-line
  2. and then saved in separate variables each.

private ushort _heightData;
private ushort _waterDataAndEdgeFlag;
private byte _textureDataAndFlags;
private ushort _textureDataAndFlags;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to turn this into two separate bytes, one for texture (6 bits), and one for the flags (4 bits, this could even be a Flags enum). Even though it doesn't match the binary data, it would be a cleaner solution because you don't need to store the _formatVersion for every tile, and it'll keep the property getters/setters simple.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is basically what @Luashine suggested as well. Makes me wonder why Blizzard didn't just increase the limit to 256, they got 6 bits to spare anyways.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retera went off talking about his renderer being limited to 16 tiles/textures etc. It's possible there's truth to that point and the WC3 render is the limiting factor in the end.

@Drake53
Copy link
Owner

Drake53 commented Sep 16, 2025

Could you also include an example .w3x or .w3e file to the test data?

@Drake53 Drake53 added the Area-Build Related to project War3Net.Build or War3Net.Build.Core label Sep 16, 2025
@Luashine
Copy link

I have these test maps as folders, would you like me to upload them? old retail vs ptr and then the topic I was testing

2.0.3-16-deep-grass.w3m
2.0.3-16-flag-test.w3m
2.0.3-16-tile-pattern.w3m
2.0.3-ptr-64tilesv2.w3m
2.0.3ptr-16-deep-grass.w3m
2.0.3ptr-16-flag-test.w3m
2.0.3ptr-16-tile-pattern.w3m
2.0.3ptr-64-tile-pattern.w3m

@Drake53
Copy link
Owner

Drake53 commented Sep 20, 2025

@Luashine Just one v12 .w3e file is fine, it's mainly for test coverage.

@Drake53
Copy link
Owner

Drake53 commented Sep 27, 2025

Fixed in #82

@Drake53 Drake53 closed this Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Build Related to project War3Net.Build or War3Net.Build.Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants