Jump to content

How to use minimap color rules in tileset .ini file


Klofkac

Recommended Posts

In the other thread ([Release] - New Dune 2000 tileset. Warcraft 2 snowdy + bonus mission) I had some discussion with Cm_blast regarding configuring minimap colors in tileset .ini file. It seems it's still quite unclear (I tried to write some hints in template.ini file, but that's likely not enough) so I'll try to explain that here in more detail.

I will split the tutorial into two main parts:
1. How to define the color
2. How the rule processing works

Ad1) You most probably already heard of hexadecimal representation of a color (you can play around with it here: https://www.w3schools.com/colors/colors_hexadecimal.asp). Basically each color composes from its red part, green part and blue part, each part is represented as hexadecimal number from 00 (0) to FF (255). Hexadecimal representation of whole color looks like #RRGGBB. In D2kEditor's tileset ini file colors are reprsented a little differently, the blue and red parts are swapped, so it's like $BBGGRR. So when you for example want to use color #b370c4, in ini file you need to write it like $c470b3.

If it's hard to find the exact value of color you want to use, I use this trick to get it easily. I use IrfanView for this. Here are the steps:
- Open the tileset image (or map image) in IrfanView.
- You can double or quadruple the size of image so that you can more easily pick the pixel from a tile, whose color you want to use. When resizing, use "Resize" option instead of "Resample", which would screw up the colors.
- Click with mouse on the pixel you want. In the window title, hexadecimal value of color will show up.
image.png.25d2673cd289ed896ac2e7a380495861.png

- In tileset .ini file, write the value as $733900 for the color from above example.

Ad2) Let's use this example:

[Minimap_Color_Rules]
;Snow
$A59494=$8000
;Pieces
$5A4A31=$40006000
;Dark snow
$9C8484=$6000
;Thin ice
$8C4A10=$80004000
;Thick ice
$8C5218=$4000
;Deep water
$733100=$8
;Water
$733900=$0

Each rule is written on one line. Ignore the lines starting with ; as these lines are only comments, used for human's better readability and understandability.
A rule consists of two parts: the color (on left side of = sign) and Tile attribute value (on right side of = sign).
Rules are processed from top to bottom (from the first specified to the last specified) and in case a rule is matched, then its color is used, otherwise it continues with next rule. If no rule is matched on the way, then color of the very last rule is used.
The attribute value contains attributes, which a tile must have in order to match the rule.

Look at the first rule: $A59494=$8000
If you put the value 8000 into "Tile attribute value filed" in TileAtrEditor and click OK button, you will see that only "Buildings can be placed" attribute is selected.
Which means: Tile must have "Buildings can be placed" attribute to match the rule. Other attributes do not matter at all.

You must write "most specific" rules first, and "least specific" rules later. This can be seen on "Pieces" and "Dark snow" rule.
Pieces rule have "Vehicles can pass", "Infantry can pass" and "Dunes" attribute, which is value 40006000.
Dark snow rule have only "Vehicles can pass" and "Infantry can pass" atrribute, which is value 00006000.
So "Pieces" rule is more specific than "Dark snow" rule, because "Dark snow" rule matches both dark snow and pieces, but "Pieces" rule matches only pieces. That's why you must specify "Pieces" rule first.

The last rule ("Water") does not have any demands for attributes, so it simply matches every tile. This is why you must specify it very last.

Fill area rules are very similar. The left side of rule is not a color, but it is group number. Each tile belongs to specific group according to the rule, and "Fill area" function will flood-fill area consisting only of tiles from same group.

Link to comment
Share on other sites

Thanks for the info.
Alright, I think I get part of the point, but I don't get the rules to use one of another.

So, based on the values you wrote there for the .ini, these are the meaning the tileattribute program show me:
*Snow = "Buildings can be placed".
*Pieces = "Vehicles - infantry - Dunes".
*Dark snow = "Vehicle - infantry".
*Thin Ice = "Infantry - Rough".
*Thick Ice = "Infantry".
*deep Water = "Paint Type 4".
*Water = nothing.

I don't get why in Snow you write the value only for "buildings" and no any of the other 3 or any combination of them, while for pieces it make use of the 3 attributes together (assuming that my list it's correct).

If for Snow instead 8000 I write "2000E002" that would be correct too or would interfere with the others? (4 attributes + 1 paint type editor attribute). 
I may get that Snow it's the only tile that is buildable, so with that "alone" it's enough, and maybe because of that Pieces go first because require 3 while dark snow only 2 that's why goes later (adding "rock" would affect anything? I mean, 20006001 which it's vehicle - infantry - Rock - paint type 1).

And another question. Pieces go first because it has 3 attributes, Dark snow has 2, Thick ice has only 1.
what if I swap Dark snow and Thin Ice position= both have 2 , but I guess dark snow shares 2 attributes with "pieces" while Thin only 1, so that is why the order.

or... maybe I just made up everything.

Link to comment
Share on other sites

6 hours ago, Cm_blast said:

If for Snow instead 8000 I write "2000E002" that would be correct too or would interfere with the others? (4 attributes + 1 paint type editor attribute). 
I may get that Snow it's the only tile that is buildable, so with that "alone" it's enough

Well, I was thinking this way: The only buildable tiles are snow tiles. Therefore, I can write just simple rule "All what is buildable uses snow color".
All buildable tiles always have "Vehicles can pass" and "Infantry can pass" attribute. So I could even make rule $E000 (which is buildable + vehicles + infantry), and it would work exactly the same way. I just wanted to make things as simple as possible.
However, in fact, there are a few buildable tiles in tileset, that are not clear snow. These are some decorative tiles to not make snow look so plain, which you place here and there.
Clear snow tiles have attribute "patint type 2", while those decorative tiles do not have it.
So in case you would want to use different color for clear snow and decorative buildable tiles, you would use two rules in this order:
$8002 (buildable + patint type 2) = clear snow
$8000 (buildable) = decorative buildable tile

7 hours ago, Cm_blast said:

And another question. Pieces go first because it has 3 attributes, Dark snow has 2, Thick ice has only 1.
what if I swap Dark snow and Thin Ice position= both have 2 , but I guess dark snow shares 2 attributes with "pieces" while Thin only 1, so that is why the order.

Well, as I already mentioned, you specify rules from most specific to least specific. In this case, you can probably swap order of Dark Snow and Thin Ice without changing the behavior. Also, "Rough" rule would be probably enough for thin ice, granted that no other tiles in your tileset than thin ice use "Rough" attribute.

Generally, there are more possible ways to specify rules for your tileset. You must just think logically a bit more. If that's a problem, you might just use trial and error and see what happens.

Link to comment
Share on other sites

oooh, I got it.
Buildable will be everysingle buildable tile, not just the ones that you can click+drag (which are only 3-4 different tiles) but by marking "buildable" this sill consider the tile with grass, tile with the red thing and so on, so the rule it's less detailed.

I guess the spice cannot be recolored.

You are alright. I know Fey did some recolor to his tileset by trial and error, so I am going to try to do the minimap color for my retro Dune 2 tileset, and if I have any doub I will come back to ask you.

Just confirm me something; vanilla .inis have this:

;Rough rocks (Infantry-only)
$375582=$6000;$4000
The template sais is "color=and_value;check_value"

I guess this means that will search for any tile that have "infantry can pass" but also the ones with "vehicle can pass AND infantry can pass" to use the same color to two different tiles, right?

Link to comment
Share on other sites

1 hour ago, Cm_blast said:

I guess the spice cannot be recolored.

Spice can be recolored on minimap. In ini there's Spice_Settings section or something like that, where is property something like ThinSpice_Color and ThickSpice_Color.

1 hour ago, Cm_blast said:

;Rough rocks (Infantry-only)
$375582=$6000;$4000
The template sais is "color=and_value;check_value"

Well, this is something different than you think, I did not mention that to keep things simple.

The first value ($6000) means: "Look at vehicle can pass and infantry can pass atribute", the second value ($4000) means "Only infantry can pass attribute must be set". In other words, all the rule means "The tile must have infantry can pass AND must NOT have vehicle can pass attribute", in other words, this matches infantry-only tiles.

But as I said, it is very confusing and not very well designed, I did not use it in the example not to confuse you even more.

Link to comment
Share on other sites

45 minutes ago, Klofkac said:

pice can be recolored on minimap. In ini there's Spice_Settings section or something like that, where is property something like ThinSpice_Color and ThickSpice_Color.

Oh, right; I was looking at the file and didn't see it, I am dumb.

45 minutes ago, Klofkac said:

The first value ($6000) means: "Look at vehicle can pass and infantry can pass atribute", the second value ($4000) means "Only infantry can pass attribute must be set". In other words, all the rule means "The tile must have infantry can pass AND must NOT have vehicle can pass attribute", in other words, this matches infantry-only tiles.

So it's like exclusion.
I guess in some moments, if I set only $4000 will affect a group of tiles I want to color but others I don't want too, while making the 2 times rules will affect less specific tiles.

45 minutes ago, Klofkac said:

But as I said, it is very confusing and not very well designed, I did not use it in the example not to confuse you even more.

Alright; I will just use normal rules or combining attributes then; I'll work on my stuff and see if I can do it; thanks for the info. I may add this post into the main index to find easily this tutorial/manual.

Edited by Cm_blast
Link to comment
Share on other sites

  • 11 months later...

Hello, gentlemen. I would like to change some colors on minimap (f.e. to make green color of Ordos more bright). I thought I should edit this tileset.ini file that you were discussing here. But I cannot understand - where to get this file and where to put it after edition??? Or maybe to change colors of minimap I need completely other tools? Can you help me?

Link to comment
Share on other sites

6 hours ago, DiamondJack said:

minimap

This is related to Klofkac's editor in particular, and changing specific terrain colors in the editor only. In-game, the terrain colors haven't ever been changed, though it's possible we haven't found a way to change them yet or no one has bothered looking. If you want to change the faction colors, that has to do with colours.bin, which is unrelated to map editing.

Link to comment
Share on other sites

7 hours ago, DiamondJack said:

Hello, gentlemen. I would like to change some colors on minimap (f.e. to make green color of Ordos more bright). I thought I should edit this tileset.ini file that you were discussing here. But I cannot understand - where to get this file and where to put it after edition??? Or maybe to change colors of minimap I need completely other tools? Can you help me?

To alter on the editor, you need klof's help, if you mean just in game, you only need to open a file called "colour.bin". There is a easy to use tool made by Funky here:

it is really easy to use but also a bit limited, but still, altering the color of the Ordos fora brigher green it's enough to change how they looks on the minimap (ingame).

Link to comment
Share on other sites

5 minutes ago, Cm_blast said:

change

I believe color square number nine (from the left to the right) is the one that controls minimap color, but that's also a color that appears on units. So, you can't totally change it or it'll stick out like a sore thumb on the faction's units and structures.

  • Like 1
Link to comment
Share on other sites

Thank's a lot! And if I would like to change the color of spice in minimap - does it mean that I should completely change probably grey gradient or  something like this? (cannot check it right now)

 

UPD: Now I can see - there are only colors of houses in that tool. Still it is great. Same question - how can I edit the color of spice on minimap?

 

PS: Yes, yes, I am blind driver.

Edited by DiamondJack
Link to comment
Share on other sites

8 hours ago, DiamondJack said:

Thank's a lot! And if I would like to change the color of spice in minimap - does it mean that I should completely change probably grey gradient or  something like this? (cannot check it right now)

 

UPD: Now I can see - there are only colors of houses in that tool. Still it is great. Same question - how can I edit the color of spice on minimap?

 

PS: Yes, yes, I am blind driver.

Yes, the tool I show you it's only about changing the color of the 8 sides.

There is certain files that contain graphics of the game, maybe it is possible to export those graphics, alter the colors and import it into the game, but I don't know if the minimap will be affected as well of that info is stored on other place.

Edited by Cm_blast
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...