Missing campaign map islands

For porting of the campaign to javascript discussions

Missing campaign map islands

Postby Berserk Cyborg » 04 Nov 2017, 05:31

A recent post in the campaign testing thread reminded me of something. There are missing islands. I first noticed it in the cam1-d map where the island with the sensor at 8:09 in this video has completely vanished.

See 2:14 in this video and compare it to how it is now for the cam2-6 map:
missing islands.JPG
missing terrain
missing islands.JPG (20.37 KiB) Viewed 89 times

The minimap, and flame, still shows that something should be there on all these maps, though for whatever reason they are gone.
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 304
Joined: 26 Sep 2016, 19:56

Re: Missing campaign map islands

Postby NoQ » 04 Nov 2017, 10:34

I suspect that these islands don't have a single tile of land (in pass-ability sense), and therefore the new renderer floods them with water. You can see that in FlaME if you show tile types it'd say water, and also in-game you should see the ground texture in this place under the water instead of the regular seabed texture.
User avatar
NoQ
Special
Special
 
Posts: 6092
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Missing campaign map islands

Postby NoQ » 04 Nov 2017, 12:50

I'm largely responsible for this logic, and i find that this is an interesting question.

== Map format and terrain rendering 101 ==

Map consists of squares - "tiles". Each tile has four "corners". In every 2x2 grid of tiles, four respective corners coincide to form a "vertex" that connects these four tiles. So a map of MxN tiles has (M+1)x(N+1) vertices.

In the current map format, which corresponds to the old 2.3 terrain renderer (that you also see in FlaME), each tile is assumed to have a fixed bitmap texture. Some of such textures can be seen as a blend of simple terrain colors ("red sand", "yellow sand", "mud", "water" etc.), one color per corner. Other tiles contain arbitrary special images ("decals"), such as craters. It is not strictly required that

    (1) for every vertex, colors in the four corresponding corners must coincide
but that's a nice soft requirement to have to make the map look good. It is often violated, even in classic and campaign maps, when the colors are similar, eg. yellow sand and yellow stony sand; however, (1) puts significant restrictions on the map because you cannot transition, for example, between red sand and mud since you simply don't have a tile with red color on one side and mud color on another side. Additionally, there is path/passability infromation attached to every tile, which allows (or disallows) you to move units or place buildings over the tile ("tile types"). Note how water is a corner color and also tile passability: the former is a property of a corner, the latter is a property of a tile, which is weird. In particular, tiles that have at least one corner of water are treated as water tiles when it comes to passability. It means that it is possible to make islands that are too small to land, but it is impossible to make lakes that are small enough to move through.

When the new renderer was introduced, it lifted the requirement (1), which was a paradise for making new maps. Now there were big textures that represent colors, which spanned across multiple tiles and blended automatically at transitions. Not only it removed the potential seams that would otherwise have been there when (1) is violated, but also it allowed transitions from every color to every color even if the respective transition tiles were not available.

Conversion from the old map format to the new renderer is not trivial. Textures are no-longer per-corner, but per-vertex, which works in an exact manner when (1) holds. In cases when (1) is violated, i.e. the old renderer would produce ugly seams, the new renderer performs voting: whichever color is present in most corners would have a priority to represent the color of the vertex. Corners coming from tiles of cliff and water type (as in passability) have different priorities in order to make sure seabed is constrained into underwater and all impassable cliffs are visible to the player.

Water surface graphical effect now is per-tile. This effect corresponds to tile type, not color. All unbuildable-and-impassable-for-tanks-but-not-for-hovers tiles are now covered with water, irrespective of their texture. However, the water texture of tile corners is converted into seabed texture color. Such independence between textures and tile types has two nice outcomes: (a) It is always obvious where is water and what is passable, (b) given how the map format allows redefining tile types on a per-map basis, it allows using different seabed colors on the same map, for instance. So as someone who made a lot of maps and wanted clear designs and fresh fancy effects, i went for this approach happily.

But now you point out that some old maps, including important campaign maps, have suffered from that^^ I still believe that both (a) and (b) are nice to have. It might still be possible to make water per-vertex, opening up the islands you mentioned. I suspect that in this case we'd see too much of the seabed texture above water, which would look poorly. Also small bodies of water or land might look unnaturally. Like, you'd still need some space to bend the ground surface into water for these islands, while keeping things naturally curved.

So i don't have any obvious solutions apart from (i) slightly redrawing the maps to make sure these islands actually contain some land or (ii) fixing the radar colors of water-typed tiles to make them blue and therefore hide the island from the radar (which is a great easy thing to do, just adjust the radar colors file which is a list of per-tile-number RGBs).

As usual, see also #4291 and wiki://NewMapFormat for more discussion.
User avatar
NoQ
Special
Special
 
Posts: 6092
Joined: 24 Dec 2009, 11:35
Location: /var/zone


Return to Campaign