ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Difference between revisions of "LAT system"

From ModEnc
Jump to: navigation, search
(Notes on the FinalAlert2 AutoLat feature)
m (How LAT and connecting LAT sets are specified in the Theater Control INI files)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Auto-LAT System=
+
[[File:OperationChronoStormLATSetsMarked.jpg|200px|thumb|right|LAT affected tiles marked on a region of the final allied mission map]]
[[File:OperationChronoStormLATSetsMarked.jpg|200px|thumb|right|Auto-LAT affected tiles marked on a region of the final allied mission map]]
+
[[File:OperationChronoStormAfterAutoLAT.jpg|200px|thumb|right|The same tiles after LAT has been applied to it]]
[[File:OperationChronoStormAfterAutoLAT.jpg|200px|thumb|right|The same tiles after Auto-LAT has been applied to it]]
 
  
The [[IsoMapPack5]] section within a map file contains information on location, tile number and sub-tile number for each tile in the map. This information is post-processed by the game by a system that this page will refer to as ''Auto-LAT''. The idea of ''Auto-LAT'' is to provide a smooth transition when different types of tiles are placed next to each other. The image below illustrates the effects of ''Auto-LAT'':
+
The [[IsoMapPack5]] section within a map file contains information on location and number of each [[TMP|tile]] in the map. This information is post-processed by the game by a system know as ''LAT'' (the acronym stands for '''''L'''ookup '''A'''djacent '''T'''ile''{{fnl|1}}). The idea of ''LAT'' is to provide a smooth transition when different types of tiles are placed next to each other. The image below illustrates the effects of ''LAT'':
  
  
[[File:AutoLAT_disabled.png|200px|What six SandTiles would look like when surrounded by ClearTiles, when ''Auto-LAT'' would be disabled]] [[File:AutoLAT_enabled.png|200px|What six SandTiles look like when surrounded by ClearTiles, due to ''Auto-LAT'']]
+
[[File:AutoLAT_disabled.png|200px|What six SandTiles would look like when surrounded by ClearTiles, when ''LAT'' would be disabled]] [[File:AutoLAT_enabled.png|200px|What six SandTiles look like when surrounded by ClearTiles, due to ''LAT'']]
  
On the left we see what six sand tiles would look like when surrounded by clear tiles, when ''Auto-LAT'' would be disabled. On the right we see what six sand tiles look like when surrounded by clear tiles, due to ''Auto-LAT''
+
On the left we see what six [[SandTile|sand tiles]] would look like when surrounded by [[ClearTile|clear tiles]], when ''LAT'' would be disabled. On the right we see what six sand tiles look like when surrounded by clear tiles, due to ''LAT''.
We see here that the six sand tiles have been replaced by tiles from the ''ClearToSandLat'' set.
+
We see here that the six sand tiles have been replaced by tiles from the [[ClearToSandLat]] set.
  
  
 
==How LAT and connecting LAT sets are specified in the Theater Control INI files==
 
==How LAT and connecting LAT sets are specified in the Theater Control INI files==
  
Every theater has 4 types of LAT tiles, internally named: ''GreenTile'', ''PaveTile'', ''RoughTile'' and ''SandTile''. We can find the TileSet number of these in the [[Terrain Control INI files]] under the INI section named 'General'. Also listed in this section are keys indicating the set numbers of TileSets that contain tiles which provide smooth transitions between LAT and non-LAT tiles, under keys ''ClearTo<LAT_name>Lat''. An example, copied from the'' snow.ini'' theater control file:
+
Every theater has four types of LAT tiles, internally named {{f|GreenTile}}, {{f|PaveTile}}, {{f|RoughTile}}, and {{f|SandTile}}. {{fs}} has a few more: {{f|CrystalTile}}, {{f|SwampTile}}, and {{f|BlueMoldTile}}. We can find the [[TMP#TileSets|tileset]] number of these in the [[General]] section of the [[Terrain Control INI files|applicable theater's terrain control INI]]. Also listed in this section are flags indicating the tilesets that provide the smooth transitions between LAT and non-LAT tiles; these flags appear in the simple format of {{f|<Terrain_1>To<Terrain_2>Lat}}. An example, copied from the {{ini|snow}} theater control file:
  
 
  [General]
 
  [General]
  PaveTile = 68
+
  PaveTile = 68 ; indicates TileSet0068
  ClearToPaveLat = 70
+
  ClearToPaveLat = 70 ; indicates TileSet0070
 
  ...
 
  ...
  
Line 31: Line 30:
 
  ..
 
  ..
  
 
+
==How the ''LAT'' system determines which image to use from the connecting TileSet==
 
+
LAT tests every tile which belongs to a LAT set on a map, and depending on which of this tile's neighbours do not belong to the same tileset, an image from the corresponding connecting LAT set is picked. This image below further illustrates this:
==How the ''Auto-LAT'' system determines which image to use from the connecting TileSet==
 
Auto-LAT tests every tile which belongs to a LAT set on a map, and depending on which of this tile's neighbours do not belong to the same tileset, an image from the corresponding connecting LAT set is picked. This image below further illustrates this:
 
  
 
[[File:ConnectingLATSetSubTileSelection.png|400px]]
 
[[File:ConnectingLATSetSubTileSelection.png|400px]]
  
We see here that if we have a tile X, and we assign values 1, 2, 4 and 8 to the top-right, bottom-right, bottom-left and bottom-right neighbour of X in that order, we can use a bitwise combination of the values of the neighbours which are not of the same set as X to find the used tile number from the set of connecting LAT tiles. Note that "not from the same set" is not entirely accurate. Details on this follow in the following section.
+
We see here that if we have a tile X, and we assign values 1, 2, 4 and 8 to the top-right, bottom-right, bottom-left and top-left neighbour of X in that order, we can use a bitwise combination of the values of the neighbours which are not of the same set as X to find the used tile number from the set of connecting LAT tiles. Note that "not from the same set" is not entirely accurate. Details on this follow in the following section.
  
  
==TileSets exempted from ''Auto-LAT''==
+
==TileSets exempted from ''LAT''==
 
It was mentioned above that if one tile from a LAT set has a tile from a different set next to it, the tile from the LAT set is replaced by one from the connecting LAT set. In most cases this is true, but some TileSets do not seem affected by this. For example, paved roads and pavement tiles do not have a ClearToPave tile to connect each other. The full list of exception is listed in the table below.
 
It was mentioned above that if one tile from a LAT set has a tile from a different set next to it, the tile from the LAT set is replaced by one from the connecting LAT set. In most cases this is true, but some TileSets do not seem affected by this. For example, paved roads and pavement tiles do not have a ClearToPave tile to connect each other. The full list of exception is listed in the table below.
[[File:AutoLATExceptionPaveTilePavedRoads.png|200px|left]]
+
[[File:AutoLATExceptionPaveTilePavedRoads.png|200px|right]]
  
 
'''TileSets between which no connecting LAT pieces are placed'''
 
'''TileSets between which no connecting LAT pieces are placed'''
 
{| class="table_horblock" cell_spacing="2"
 
{| class="table_horblock" cell_spacing="2"
|GreenTile
+
|[[PaveTile]]
|ShorePieces
+
|↔
 +
|[[MiscPaveTile]]
 +
|
 
|-
 
|-
|GreenTile
+
|[[PaveTile]]
|WaterBridge
+
|↔
 +
|[[Medians]]
 +
|
 
|-
 
|-
|PaveTile
+
|[[PaveTile]]
|Medians
+
|↔
 +
|[[PavedRoads]]
 +
|
 
|-
 
|-
|PaveTile
+
|[[CrystalTile]]
|PavedRoads
+
|
 +
|[[CrystalCliff]]
 +
|({{fs}} only)
 +
|-
 +
|[[GreenTile]]
 +
|↔
 +
|[[ShorePieces]]
 +
|({{ra2}}/{{yr}} only)
 +
|-
 +
|[[GreenTile]]
 +
|↔
 +
|[[WaterBridge]]
 +
|({{ra2}}/{{yr}} only)
 
|}
 
|}
  
  
  
==Notes on the FinalAlert2 AutoLat feature==
+
==Notes on the Final Sun and Final Alert 2 AutoLat feature==
While the [[Matze's tools#FinalAlert_2|Final Alert 2]] Map Editor has an option named ''AutoLat'' listed in the menu, there's not much use to it beyond previewing of what the game's ''Auto-LAT'' feature will do to your map. This is because the game will recalculate the tiling layer to apply its own ''Auto-LAT'' feature. Also, FinalAlert2 is not aware of the TileSets exempted from ''Auto-LAT'' as explained in the previous section.
+
While the [[Matze's tools#FinalSun|Final Sun]] and [[Matze's tools#FinalAlert_2|Final Alert 2]] map editors have an option named ''AutoLat'' listed in the menu, there's not much use to it beyond previewing of what the game's ''LAT'' feature will do to your map. This is because the game will recalculate the tiling layer to apply its own ''LAT'' feature. Also, the editors are not aware of the TileSets exempted from ''LAT'' as explained in the previous section.
 +
 
 +
An attempt has been made by zzattack to correctly mimic the game's ''LAT'' feature in his maps rendering project. Corresponding code can be found [https://github.com/zzattack/ccmaps-net/blob/master/CNCMaps/Game/TileCollection.cs#L334 here], more specifically in the ''RecalculateTileSystem'' function.
  
An attempt has been made by zzattack to correctly mimic the game's ''Auto-LAT'' feature in his maps rendering project. Corresponding code can be found [https://github.com/zzattack/ccmaps-net/blob/master/CNCMaps/MapLogic/TileCollection.cs here], more specifically in the ''RecalculateTileSystem'' function.
+
==Footnotes==
 +
{{fn|1|According to [[Joe Bostic]], the lead programmer of {{ts}}.}}
  
 
[[Category:General_Editing_Information]]
 
[[Category:General_Editing_Information]]

Latest revision as of 12:43, 26 August 2019

LAT affected tiles marked on a region of the final allied mission map
The same tiles after LAT has been applied to it

The IsoMapPack5 section within a map file contains information on location and number of each tile in the map. This information is post-processed by the game by a system know as LAT (the acronym stands for Lookup Adjacent Tile1). The idea of LAT is to provide a smooth transition when different types of tiles are placed next to each other. The image below illustrates the effects of LAT:


What six SandTiles would look like when surrounded by ClearTiles, when LAT would be disabled What six SandTiles look like when surrounded by ClearTiles, due to LAT

On the left we see what six sand tiles would look like when surrounded by clear tiles, when LAT would be disabled. On the right we see what six sand tiles look like when surrounded by clear tiles, due to LAT. We see here that the six sand tiles have been replaced by tiles from the ClearToSandLat set.


How LAT and connecting LAT sets are specified in the Theater Control INI files

Every theater has four types of LAT tiles, internally named GreenTile, PaveTile, RoughTile, and SandTile. Firestorm has a few more: CrystalTile, SwampTile, and BlueMoldTile. We can find the tileset number of these in the General section of the applicable theater's terrain control INI. Also listed in this section are flags indicating the tilesets that provide the smooth transitions between LAT and non-LAT tiles; these flags appear in the simple format of <Terrain_1>To<Terrain_2>Lat. An example, copied from the snow(md).ini theater control file:

[General]
PaveTile = 68 ; indicates TileSet0068
ClearToPaveLat = 70 ; indicates TileSet0070
...
[TileSet0068]
SetName = LAT Pavement
FileName = Pvclr
...
[TileSet0070]
SetName = Pavement/Clear LAT
FileName = plat
TilesInSet = 16
..

How the LAT system determines which image to use from the connecting TileSet

LAT tests every tile which belongs to a LAT set on a map, and depending on which of this tile's neighbours do not belong to the same tileset, an image from the corresponding connecting LAT set is picked. This image below further illustrates this:

ConnectingLATSetSubTileSelection.png

We see here that if we have a tile X, and we assign values 1, 2, 4 and 8 to the top-right, bottom-right, bottom-left and top-left neighbour of X in that order, we can use a bitwise combination of the values of the neighbours which are not of the same set as X to find the used tile number from the set of connecting LAT tiles. Note that "not from the same set" is not entirely accurate. Details on this follow in the following section.


TileSets exempted from LAT

It was mentioned above that if one tile from a LAT set has a tile from a different set next to it, the tile from the LAT set is replaced by one from the connecting LAT set. In most cases this is true, but some TileSets do not seem affected by this. For example, paved roads and pavement tiles do not have a ClearToPave tile to connect each other. The full list of exception is listed in the table below.

AutoLATExceptionPaveTilePavedRoads.png

TileSets between which no connecting LAT pieces are placed

PaveTile MiscPaveTile
PaveTile Medians
PaveTile PavedRoads
CrystalTile CrystalCliff (Firestorm only)
GreenTile ShorePieces (Red Alert 2/Yuri's Revenge only)
GreenTile WaterBridge (Red Alert 2/Yuri's Revenge only)


Notes on the Final Sun and Final Alert 2 AutoLat feature

While the Final Sun and Final Alert 2 map editors have an option named AutoLat listed in the menu, there's not much use to it beyond previewing of what the game's LAT feature will do to your map. This is because the game will recalculate the tiling layer to apply its own LAT feature. Also, the editors are not aware of the TileSets exempted from LAT as explained in the previous section.

An attempt has been made by zzattack to correctly mimic the game's LAT feature in his maps rendering project. Corresponding code can be found here, more specifically in the RecalculateTileSystem function.

Footnotes

1 According to Joe Bostic, the lead programmer of Tiberian Sun.