Help for indexing color units

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.
Post Reply
User avatar
Mistreated
Posts: 16
Joined: Tue Oct 23, 2012 4:32 pm

Help for indexing color units

Post by Mistreated »

I need a tutorial to assign color index for units, this is one of the issues that cost me a lot., Would appreciate some tutorial if possible for Gimp which is the program that I occupy and still not be good all the device's features.
I thank you beforehand any help on this, no matter if another program will serve well to get an idea about it.
greetings bye :idea:
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Help for indexing color units

Post by b_o »

I understand how it worked in Warcraft 2, but not exactly how it works in stratagus. I would add to the tutorial request by saying that an explanation of the palette system would be good as well. I noticed 256 color unit PNG's, but their palettes didn't seem to have much organization or very decent colors. Is 256 colors the limit for each unit, or for the entire game?
User avatar
Mistreated
Posts: 16
Joined: Tue Oct 23, 2012 4:32 pm

Re: Help for indexing color units

Post by Mistreated »

b_o wrote:I understand how it worked in Warcraft 2, but not exactly how it works in stratagus. I would add to the tutorial request by saying that an explanation of the palette system would be good as well. I noticed 256 color unit PNG's, but their palettes didn't seem to have much organization or very decent colors. Is 256 colors the limit for each unit, or for the entire game?
It is quite a problem, I'll have to do my project without using colors for different teams players.

Thank you.
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Help for indexing color units

Post by b_o »

You could try looking at aleona's tales, and see how the team colors are done there...
User avatar
Mistreated
Posts: 16
Joined: Tue Oct 23, 2012 4:32 pm

Re: Help for indexing color units

Post by Mistreated »

b_o wrote:You could try looking at aleona's tales, and see how the team colors are done there...
Check the post of graphical aleona's tales, but found nothing of what I'm looking for, what I want is if someone can explain how income will the engine color identifies the player and changes according to each unit.

Sample this:

Image

thanks.
User avatar
jarod42
Posts: 101
Joined: Fri Jan 20, 2012 7:43 pm

Re: Help for indexing color units

Post by jarod42 »

in stratagus.lua

you have

Code: Select all

DefinePlayerColorIndex(208, 4)
which tell to the engine that index 208, 209, 210, 211 in the palette are 'playerColor'.

Code: Select all

DefinePlayerColors({
  "red", {{164, 0, 0}, {124, 0, 0}, {92, 4, 0}, {68, 4, 0}},
  "blue", {{12, 72, 204}, {4, 40, 160}, {0, 20, 116}, {0, 4, 76}},
  "green", {{44, 180, 148}, {20, 132, 92}, {4, 84, 44}, {0, 40, 12}},
  "violet", {{152, 72, 176}, {116, 44, 132}, {80, 24, 88}, {44, 8, 44}},
  "orange", {{248, 140, 20}, {200, 96, 16}, {152, 60, 16}, {108, 32, 12}},
  "black", {{40, 40, 60}, {28, 28, 44}, {20, 20, 32}, {12, 12, 20}},
  "white", {{224, 224, 224}, {152, 152, 180}, {84, 84, 128}, {36, 40, 76}},
  "yellow", {{252, 252, 72}, {228, 204, 40}, {204, 160, 16}, {180, 116, 0}},
  "red", {{164, 0, 0}, {124, 0, 0}, {92, 4, 0}, {68, 4, 0}},
  "blue", {{12, 72, 204}, {4, 40, 160}, {0, 20, 116}, {0, 4, 76}},
  "green", {{44, 180, 148}, {20, 132, 92}, {4, 84, 44}, {0, 40, 12}},
  "violet", {{152, 72, 176}, {116, 44, 132}, {80, 24, 88}, {44, 8, 44}},
  "orange", {{248, 140, 20}, {200, 96, 16}, {152, 60, 16}, {108, 32, 12}},
  "black", {{40, 40, 60}, {28, 28, 44}, {20, 20, 32}, {12, 12, 20}},
  "white", {{224, 224, 224}, {152, 152, 180}, {84, 84, 128}, {36, 40, 76}},
  "yellow", {{252, 252, 72}, {228, 204, 40}, {204, 160, 16}, {180, 116, 0}},
})
define the colour (with rgb values) by player.

Note also that in the palette,
an other trick is use for a kind of animation: the 'Color-Cycle'
Currently, it is used for the water.

Code: Select all

--  If color-cycle-all is off (#f) only the tileset palette is color cycled.
-- Otherwise (#t) all palettes are color cycled.
SetColorCycleAll(true)
ClearAllColorCyclingRange()
AddColorCyclingRange(38, 47) -- water
AddColorCyclingRange(205, 207) -- building
AddColorCyclingRange(240, 244) -- icon
Each few cycles, each colour in each range is cycled.
What I mean by cycled:

Code: Select all

 # | 38 39 40 41 42 43 44 45 46 47
 1 | A  B  C  D  E  F  G  H  I  J
 2 | B  C  D  E  F  G  H  I  J  A
 3 | C  D  E  F  G  H  I  J  A  B
 4 | D  E  F  G  H  I  J  A  B  C
 5 | E  F  G  H  I  J  A  B  C  D
 6 | F  G  H  I  J  A  B  C  D  E
...
Where A, B, C, .. J are colours, and (38, 47) is a color cyle range.
And 1, 6... are the 'game cycle'
User avatar
Mistreated
Posts: 16
Joined: Tue Oct 23, 2012 4:32 pm

Re: Help for indexing color units

Post by Mistreated »

Thank you very much for the info, but a little video tutorial on youtube would not be wrong about this, would be very useful.
Post Reply