Skip to content

Latest commit

 

History

History
297 lines (208 loc) · 11.2 KB

Conversion-Profile-Documentation.md

File metadata and controls

297 lines (208 loc) · 11.2 KB

Conversion Profile Documentation

Conversion profiles used by MapTool are INI files (text-based configuration files) which determine what sort of changes to tile & object data the tool should perform.

Users unfamiliar with structure of INI files should use one of the pre-made profile INI files as a reference.

Available Sections

ProfileData

Name

Name displayed in the GUI for this profile.

Description

Description displayed in the GUI for this profile.

IncludeFiles

A comma-separated list of filenames including file extensions to read from same directory as the current conversion profile. Contents of these files will be merged with the current one. This only works on one level, so trying to include files from already included files will fail.

ApplyMapOptimization

If set to yes / true, will ensure that on the saved map, section with name MultiplayerDialogSettings will be the first section, immediately followed by section with name Basic and finally the section with name Digest will be the last. This potentially allows for game to find these particular sections marginally faster.

ApplyMapCompress

If set to yes / true, no unnecessary white space is put on the saved map. This allows for map size to be marginally smaller.

DeleteObjectsOutsideMapBounds

If set to yes / true, removes all objects, including terrain objects and overlays that exist in map code but on tiles that do not exist within map bounds.

FixTunnels

If set to yes / true, fixes the [Tubes] section to get rid of unnecessary and malformed tunnel declarations generated by map editor.

TheaterRules

ApplicableTheaters

A comma-separated list of theater ID's which must match with one declared in a map for the tool to process it. Defaults to TEMPERATE,SNOW,URBAN,DESERT,NEWURBAN,LUNAR the list is omitted.

NewTheater

A single theater ID which is assigned on any processed maps. If omitted, defaults to processed map's theater.

TheaterTileOffsets

List of global tile offsets per theater, used for shifting the tile indices when applying tile conversion rules.

Example #1:

[TheaterTileOffsets]
TEMPERATE=0
SNOW=500

When applying rules to maps of TEMPERATE theater, no shifting will be done. When applying rules to maps of SNOW theater, every tile index in processed TileRules will have 500 added to it.

Example #2:

[TheaterTileOffsets]
DESERT=250,-250

When applying rules to maps of DESERT theater, the original tile indices in processed TileRules will have 250 added to them, and the new tile indices will have 250 deducted from them.

IsoMapPack5

Do note that effects of both SortBy and RemoveLevel0ClearTiles are removed when a map is opened and saved in a map editor (Final Alert 2 / FinalSun).

SortBy

Allows for sorting of tile data in IsoMapPack5, resulting in potentially better compression.

Sorting by following values is available: X, Y, TILEINDEX, SUBTILEINDEX, LEVEL, ICEGROWTH, X_LEVEL_TILEINDEX (Sort by X then by LEVEL then by TILEINDEX - the remaining ones follow a similar pattern), X_TILEINDEX_LEVEL, LEVEL_X_TILEINDEX,TILEINDEX_X_LEVEL.

Good compression is achieved by using either X_LEVEL_TILEINDEX or X_TILEINDEX_LEVEL.

RemoveLevel0ClearTiles

If set to yes / true, removes all clear tiles at lowest elevation level (0). Since game always fills cells that are missing tiles with clear tiles that have elevation level of 0, removing them from IsoMapPack5 is a way to trim down the size of a map file.

TileRules

A list of tile index conversion rules, each on its own line with | as separator between source and destination value, as well as optional height override and sub-tile index override values. Can also be prefixed by a tile coordinate filter in brackets, f.ex (X,Y).

To assist in figuring out the numbers to use, MapTool can be run with command line parameter -l with a game theater configuration INI (such as temperat(md).ini) as input file to extract a listing of tiles and their tile indices to a plaintext output file.

Example #1:

[TileRules]
0-15|25-40

Tiles 0-15 will get converted to tiles 25-40, respectively, respecting the range declarations.

Example #2:

[TileRules]
0-15|25

This example should produce results identical with the first one.

Example #3:

[TileRules]
0-15|25-25

Using a range declaration with identical start and end points as destination forces all matching source tiles to be converted to that specific tile.

Example #4:

[TileRules]
0-15|25-40|1

Adding a third value overrides the height of all of the applicable tiles with specific value. Only values from 0 to 14 are respected, with values lower than 0 interpreted as 0, and values higher than 14 interpreted as 14.

Example #5:

[TileRules]
0-15|25-40|*|0

Fourth value serves as an override to tile's sub-tile index, serving to determine which particular piece of that tile is used for a map cell. It might be necessary to set the override to 0 if you are converting from tiles with more than one sub-tile to a tile with just one.

If you declare sub-tile index override, you must also declare height override before it. Substituting the value with * retains the original height values in processed maps.

Example #6:

[TileRules]
0-15|0-15|*|*|1

Fifth value serves as an override to tile's ice growth flag. 0 means that ice growth is disabled, 1 means that is enabled. Values greater than 1 are interpreted as 1.

If you declare ice growth flag override, you must also declare height override and sub-tile index override before it. Substituting the value with * retains the original height values and sub-tile index values in processed maps.

Example #7:

[TileRules]
0-15|25~40
16|25~40

This randomly assigns new tile index from range 25 to 45 to tiles 0-15, as well as all tile 16.

Example #8:

[TileRules]
(25,50)0-15|25-40
(32,*)16-20|50-54

Tiles 0-15 will get converted to tiles 25-40, respectively, but only at specific tile coordinate X = 25, Y = 50.
Tiles 16-20 will get converted to tiles 50-54, respectively, but only at specific tile coordinates where X = 32.

Example #9:

[TileRules]
0-15|25-40|*|*|*|0-3|1-1
16-20|50-54|*|*|*|1|2
21|60|3|*|*|1|2

Tiles 0-15 will get converted to tiles 25-40 but only for tiles using sub-tiles 0-3, which will also get converted to using sub-tile 1.
Tiles 16-20 will get converted to tiles 50-54 but only for tiles using sub-tile 1, which will also get converted to using sub-tile 2.
Tile 21 will get converted to tile 60 but only for tiles using sub-tile 1, which gets converted to sub-tile 3 because sub-tile index override has been defined and takes precedence over the target sub-tile range which has been set to 2.

OverlayRules

A list of overlay ID conversion rules, each on its own line with a | as a separator between source and destination value. Can also be prefixed by a tile coordinate filter in brackets, f.ex (X,Y).

Example:

[OverlayRules]
0|5
15|20~30
16-19|20~30
6|6|0-2|12
8|8|0-255|0~50
(25,50)20|52
(32,*)31|53

Overlays with ID 0 are converted to overlays with ID 5.
Overlays with ID 15 are randomly assigned new ID from range of 20 to 30, likewise for overlays with ID in range of 16 to 19.
Overlays with ID 6 will have their frame data for frames 0 to 2 changed to 12.
Overlays with ID 8 will have their frame data for frames 0 to 255 changed to randomly assigned value from 0 to 50.
Overlay with ID 20 will be converted to overlay with ID 52, but only at tile coordinate where X = 25 and Y = 50.
Overlay with ID 31 will be converted to overlay with ID 64, but only at tile coordinates where X = 32.

ID values from 0 to 254 are available for for regular use. Using 255 as destination ID will remove overlays. 255 as a source ID is ignored unless tile coordinate filter is in use. Frame values from 0 to 255 are available for use as both source and destination values.

ObjectRules

A list of object ID conversion rules, each on its own line with a | as a separator between source and destination value.

Example #1:

[ObjectRules]
GACNST|YACNST

All objects with ID GACNST, be it Infantry, Building, Aircraft, Vehicle or Terrain are replaced by an object of same type with ID YACNST.

Example #2

[ObjectRules]
GACNST

All objects with ID GACNST, be it Infantry, Building, Aircraft, Vehicle or Terrain are removed.

Example #3

[ObjectRules]
GAPOWR+GAPOWRUP|NAPOWR
GAPOWR+GAPOWRUP,GAPOWRUP|NAAPWR
GACTWR+*|GACTWR+GAVULC
GAPLUG+GAPLUG3|GAPLUG+None,None,None

All buildings with ID GAPOWR with upgrade with ID GAPOWRUP in first upgrade slot are replaced with building with ID NAPOWR.
All buildings with ID GAPOWR with upgrade with ID GAPOWRUP in both first and second upgrade slots are replaced with building with ID NAAPWR.
All buildings with ID GACTWR with any upgrade or no upgrade in the first upgrade slot with building are replaced with building with ID GACTWR with upgrade with ID GAVULC in first upgrade slot.
All buildings with ID GAPLUG with upgrade with ID GAPLUG3 in the first upgrade slot with building are replaced with building with ID GAPLUG with no upgrades in any slot.

SectionRules

A list of section name, keys and values conversion rules, each on its own line with | as a separator between section name, key and value information. A combination of two characters -> can be used to separate old and new value for section and key names.

Example #1:

[SectionRules]
Basic|Official|no

Sets the value for key Official under section Basic to no.

Example #2:

[SectionRules]
Basic|Official->

Removes key Official under section Basic.

Example #3:

[SectionRules]
Basic->

Removes section Basic altogether.

Example #4:

[SectionRules]
Basic->NotSoBasic|Official->Unofficial|Yes

Changes name of section Basic to NotSoBasic, name of key Official under said section to Unofficial and its value to Yes.

Example #5:

[SectionRules]
Basic|Official|$GETVAL(SpecialFlags,DestroyableBridges)

Sets the value of key Official under section Basic to the value of key DestroyableBridges under section SpecialFlags.

Example #6:

[SectionRules]
Lighting|IonAmbient|$GETVAL(Lighting,Ambient,+,0.1)
Lighting|IonRed|$GETVAL(Lighting,Red,-,0.1)
Lighting|IonGreen|$GETVAL(Lighting,Green,*,0.5)
Lighting|IonBlue|$GETVAL(Lighting,Green,/,0.25)
Lighting|IonLevel|$GETVAL(Lighting,Level,*,0.2515,false)

Sets the value of following keys under Lighting to:

IonAmbient to value of Ambient plus 0.1.
IonRed to value of Red minus 0.1.
IonGreen to value of Green multiplied by 0.25.
IonBlue to value of Blue divided by 0.
IonLevel to value of Level multiplied by 0.2515 with fractional part of the result truncated.

Negative values can be used for the operand. With / operator, using 0 is treated same way as 1.