Author Topic: spriteFaceColor, etc..  (Read 3675 times)

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
spriteFaceColor, etc..
« on: December 29, 2017, 04:19:35 pm »
As far as I understand "spriteFaceColor" is assigned a list of colors to be used to recolor the unit's sprite. The order of the values assigned seems to be: M0, F0, M1, F1, M2, F2, and so on.
But the number of male paperdolls I have is not equal to the number of females (which makes sense, since the ratio for the soldiers is not equal).
Do I just need to add values as placeholders for the missing females? For example:
[96, 96, 160, 160, 96, 999, 163, 999]
where "999" would be placeholder for the non-existing F2 and F3.
Or do I strictly need to have an equal amount of paperdolls?



« Last Edit: December 29, 2017, 08:50:40 pm by robin »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: spriteFaceColor, etc..
« Reply #1 on: December 29, 2017, 08:41:58 pm »
you need F3 other wise it will assign armor without "F" for some looks.
this mean 8 first sprites and values in color arrays are needed.

If you have more than 8 values and sprites then:

Definition:
Code: [Select]
spriteFaceColor: [
  96, 96, 160, 160, 96, 96, 163, 163]
and
Code: [Select]
spriteFaceColor: [
  96, 96, 160, 160, 96, 96, 163, 163,
  96, 96, 160, 160, 96, 96, 163, 163]
will give same result. This is because each unit have random look value in range from 0 to 127 (1*gender + 2*race + 8*radom(0, 15)). Engine is try finding biggest position in that array that match this look value and if it do not exists then reduce this value by biggest power of two number and check again.

If you have 16 unique sprites for man but not woman then array should look like:

Code: [Select]
spriteFaceColor: [
  96, 96, 160, 160, 96, 96, 163, 163,
  11, 96, 123, 160, 111, 96, 88, 163,
  12, 96, 123, 160, 222, 96, 11, 163,
  13, 96, 123, 160, 111, 96, 99, 163]
values for male armors are changed but for female we have only 4 unique values.

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: spriteFaceColor, etc..
« Reply #2 on: December 30, 2017, 10:27:19 am »
you need F3 other wise it will assign armor without "F" for some looks.
Sorry, I used very poor wording in my first post.
I have only one spritesheet for the unit (think of the jumpsuit from the vanilla game); but I have 30+ female paperdolls and 50+ male paperdolls. I'd like the look (skin, hair) of the soldier's sprite to match that of the paperdoll.
So if I understood correctly: with 55 male plus 35 female paperdolls, I have to put 110 values in that array, as if I had 55 females too. Right?

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: spriteFaceColor, etc..
« Reply #3 on: December 30, 2017, 02:25:42 pm »
Yes, you need 55 female too, overall this work best if number of sprites is power of two (e.g. 8, 16, 32, ...) because then every sprite have same chance of appearing. If you skip some then distribution will not be unify.
In your case we start from 64 total.

If you define 64 then:
0-63 will have 1/64 chance of appearing

If you define 55 then:
0-23 and 32-54 will have 1/64 chance of appearing
24-31 will have 1/32 chance of appearing (because they are used by 55-63 range too)

If you define 35 then:
0-3 and 32-34 will have 1/64 chance of appearing
4-31 will have 1/32 chance of appearing

If you define 32 then:
0-31 will have 1/32 chance of appearing

To made it work correctly in your case, you need set correct values for female first 0-34 values and repeat 4-23 vales in range 35-54 (because they will share look)

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: spriteFaceColor, etc..
« Reply #4 on: December 30, 2017, 07:10:43 pm »
I see, thanks. I guess I'll draw more paperdolls until I reach 64+64.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: spriteFaceColor, etc..
« Reply #5 on: December 30, 2017, 07:28:33 pm »
64 is "best" not "required", overall probably 64+32 would work fine too (with exception that you will need repeat 32 values for females).