OpenXcom Forum

Modding => Work In Progress => Topic started by: Mono on March 09, 2015, 12:53:49 am

Title: how gender/race sprites works? [Explained]
Post by: Mono on March 09, 2015, 12:53:49 am
are the 8 head sprite the only difference between male and female?
how different race colors are made?
Is possible to have different sprite for male and female?

I ask this because of a very silly reason: I'm trying to accomplish something like pic related
(blu camo for boys and pink for girl  ;D)

Edit: changes have been introduced with openxcom_git_master_2015_03_13_0759.zip
so ignore the next Dioxine answer nr. 2 if you are using recent nightly.
Title: Re: how gender/race sprites works?
Post by: Dioxine on March 09, 2015, 01:01:31 am
1. Yes, xcom soldier sprite has 2 torso versions, for male & female. Normal enemy sprite can also have the second "female" set of torsos but they won't be used (but they could - I'm pretty sure the female civilian now uses the second set of torsos, if it has the "0" full sprite type.
2. By a palette conversion built-in into OXcom. You cannot influence it manually by modding.
3. No.
Title: Re: how gender/race sprites works?
Post by: Yankes on March 09, 2015, 01:16:40 am
Race recoloring its my hack :)
Right now is done only based on race. Its compute new colors and after that it's search for some pixel color groups in sprite. If it find proper pixel it replace with new one.
Every thing is hardcoded and can't be change (only turn off).

I made patch that relaxes it a bit (this is require by TFTD, not jet included to OXC) and colors can be changes freely for any combinations of gender and race, but you would need sacrifice change of hair or face color to archive your effect.

If my patch pass, I could add in my extended version option for third color to replace, that would allow you to archive your needs.
Title: Re: how gender/race sprites works?
Post by: kikimoristan on March 09, 2015, 01:25:18 am
that race recolouring is fantastically awesome hack i love it.
Title: Re: how gender/race sprites works?
Post by: Mono on March 09, 2015, 01:26:31 am
Wow Yankes, you made my day today!
I will wait for your OXE.

And thank you Dioxine for making me save time in trying!
If DIOXINE can't do it, I certainly cannot  ;)

my B plan is not needed anymore... pic related  ;D
Title: Re: how gender/race sprites works?
Post by: Arthanor on March 09, 2015, 03:00:06 am
Alternatively (and a bit more cumbersome), you could write a mod that has "female personal armor" and "male personal armor", one is pink, one is blue. And the same for the other armors, you just have to produce the right one and equip soldiers properly.
Title: Re: how gender/race sprites works?
Post by: Mono on March 09, 2015, 04:31:17 am
thank Arthanor,
but then I will be able to wear a pink armor even to male soldiers. 
A politically correct thing. Not what I want for my mod!  >:(

(I just like to roleplay in a fascist way)
Title: Re: how gender/race sprites works?
Post by: Arthanor on March 09, 2015, 04:29:54 pm
Well, just like there's nothing preventing you from wearing a dress IRL, you just chose not to (presumably :P).

All you have to do as a player is outfit your soldiers properly (granted, some of the names can be a bit unclear if you are not familiar with them). Just presenting an easier alternative than asking the developers to code more ;)
Title: Re: how gender/race sprites works?
Post by: Mono on March 15, 2015, 01:15:59 am
I have just take a look at the pedia.
Under armor I can now change the palette. Thank Yankes!!
A third palette on OXE?! Yeah!!!! This would be super!!!!!

Code: [Select]
armors:
  - type: STR_POWER_SUIT_UC
    spriteFaceGroup: 5
    spriteFaceColor:
      - 112
      - 176
      - 112
      - 176
      - 112
      - 176
      - 112
      - 176
  - type: STR_FLYING_SUIT_UC
    spriteFaceGroup: 2
    spriteFaceColor:
      - 112
      - 176
      - 112
      - 176
      - 112
      - 176
      - 112
      - 176   
All boys sport a blue power suit, all girls a pink one. Look awful but work. Time to hack some sprite.

I will post my work when done, but don't keep your breath, i'm not a talented graphic  :P

Thank you guys ;D

below are what you get with the example ruleset
Title: Re: how gender/race sprites works?
Post by: Mono on March 15, 2015, 02:57:57 am
Just for fun...
Hybrids and mutants. Additional sprites are not needed anymore!  :)
Thanks again Yankes!!!

Edit:
Now If we can have alien with races and genders, we can also play with them. Change color by rank...
Sorry, I'm too greedy  ::)
Not asking for it.

Solved!
Title: Re: how gender/race sprites works?
Post by: kikimoristan on March 15, 2015, 03:04:52 am
NICE  : ) looks good i wanna . link?
Title: Re: how gender/race sprites works?
Post by: Mono on March 15, 2015, 03:12:19 am
Is a new rule added to the nightly, under armors.
Just download the latest openxcom_git_master_2015_03_13_0759.zip
Title: Re: how gender/race sprites works?
Post by: kikimoristan on March 15, 2015, 03:14:31 am
i know i have. i  wanna have what you doing  . how do you recolour the armour?
Title: Re: how gender/race sprites works?
Post by: Mono on March 15, 2015, 03:25:20 am
I have added the code in my post above.
Just use it with a vanilla installation, if you use a mod that change the basic armors, my example code don't work unless the modded armor use the same palette of the vanilla one (at least I think)  :P

Edit: sorry, you mean as a file? here it is
Title: Re: how gender/race sprites works?
Post by: kikimoristan on March 15, 2015, 03:46:02 am
NICE . pink and blue for power armor. is only gender based i assume. what is colgroup?
Title: Re: how gender/race sprites works?
Post by: kikimoristan on March 15, 2015, 03:54:23 am
how do you get the mutants?
Title: Re: how gender/race sprites works?
Post by: Mono on March 15, 2015, 04:01:33 am
https://openxcom.org/forum/index.php/topic,1557.0.html (https://openxcom.org/forum/index.php/topic,1557.0.html)
It's easy: each row of the palette is a colorGroup, starting by 0 (0-15)
color is the color number in the given palette, also starting by 0 (0-255)
first colorGroup (nr. zero) is reserved for background and shades (not really sure)

for the mutant I just monkey typed some random color, see attachment  ;)
Title: Re: how gender/race sprites works?
Post by: kikimoristan on March 15, 2015, 04:16:28 am
thanks Mono. this means you can also change the alien 's looks based on their ranks or stuff like that.
Title: Re: how gender/race sprites works?
Post by: Mono on March 15, 2015, 04:27:28 am
Testing right now but: apparently not :(
only XCom soldier have color changes based on race and gender.
Rank do not qualify as race. If I find a workaround I will post.

Edit:
Quote
NICE . pink and blue for power armor. is only gender based i assume.
You can have different armors color based also on race, but this will not make much sense IMO. It will be better if we can have armor color based on rank (rookies, squaddie etc) but is not the case.

Re-Edit:
Silly me, I was spraying wrong infos   ::)
Yes it work for alien too... Hurra!
In a hurry to respond to tollworkout I have made some errors in my rule  :-[

You can change 2 palette from any alien but the result is a little weird.
Will test more next days...
Title: Re: how gender/race sprites works?
Post by: kikimoristan on March 15, 2015, 07:17:46 am
Testing right now but: apparently not :(
only XCom soldier have color changes based on race and gender.
Rank do not qualify as race. If I find a workaround I will post.

Edit:You can have different armors color based also on race, but this will not make much sense IMO. It will be better if we can have armor color based on rank (rookies, squaddie etc) but is not the case.


i wonder if yankes can make a version that can somehow link up with statstings that way you can have different guys color their armor in a different way 
Title: Re: how gender/race sprites works?
Post by: Mono on March 15, 2015, 08:10:52 am
Hey tollworkout, we must stop writing at the same time.  :P
I already corrected my last post.

As a side note: No more need for different sprite for the muton commander  ;D

both changes applied whit no weardiness. Pink skin, green glassess
weird thing appear if the colors numbers in the arrays are not the same.
need some sleep, too many errors I made :-[
Title: Re: how gender/race sprites works?
Post by: kikimoristan on March 15, 2015, 08:37:14 am
that's cause colors are additive as in pink + gray/green/purple = orange.
Title: Re: how gender/race sprites works?
Post by: kikimoristan on March 15, 2015, 08:39:25 am
hey mono. can i see the ruleset ? you should make am mod where each rank is identifiable by their tint. could be useful.  good job. :3
Title: Re: how gender/race sprites works?
Post by: Mono on March 15, 2015, 09:14:46 am
I have no ruleset for now. Only a scratch test file.
I use the sectoid with glass cause it has 2 color to play with.
(I may have used a regular floater, but I have the sectoid at hand).

Just comment spriteFaceGroup, spriteFaceColor, spriteHairGroup, spriteHairColor and you have the original sprite (with glass).
The rule apply to all sectoids (armor is the same for all).
If you want colored ranked alien, you must give a different armor to each rank, but the sprite could remain the same.
TODO: how things change when the colors from the 2 arrays have different values.

For the mod: I will do it, but need more time  :)
Oh, and for the good job: Thank but all the credit is for Yankes!
Title: Re: how gender/race sprites works?
Post by: Yankes on March 15, 2015, 04:48:30 pm
https://openxcom.org/forum/index.php/topic,1557.0.html (https://openxcom.org/forum/index.php/topic,1557.0.html)
It's easy: each row of the palette is a colorGroup, starting by 0 (0-15)
color is the color number in the given palette, also starting by 0 (0-255)
first colorGroup (nr. zero) is reserved for background and shades (not really sure)

for the mutant I just monkey typed some random color, see attachment  ;)
Exacly.
I forbid colorGroup 0 to prevent problems with transparent index 0. I could do work around but because it's very easy avoidable I didn't do it.

And for color based on rank, I can do it but I need ask permission form Warboy if I want add this to official version.
Title: Re: how gender/race sprites works?
Post by: Mono on March 16, 2015, 10:42:36 pm
And for color based on rank, I can do it but I need ask permission form Warboy if I want add this to official version.

Thank you Yankes. Indeed a third palette for soldier rank will be relevant to my interests :)
Adding a badge to the soldier chest or a colored stripe over a shoulder armor indicating the soldier rank are the kind of attention to details that make a game great. Like your original race recoloring hack ("Enhanced Soldier Sprite", under option). I can't think of anyone playing with this option disabled  ;D

On the other hand, this new feature will go unnoticed for some time, requiring modification to all the original soldiers sprites, and will not improve the gameplay in any way. So, is up to you, your time and interests. For my side is a yes, I want badly  :P

Thanks for your works Yankes, I love it!

A call to for a poll: any modders/players are interested in this feature? Just me?  :(
Title: Re: how gender/race sprites works?
Post by: Hobbes on March 17, 2015, 04:40:41 am
A call to for a poll: any modders/players are interested in this feature? Just me?  :(

I am very interested to add this to enemy human factions, but it isn't possible yet.
Title: Re: how gender/race sprites works? [Explained]
Post by: Dioxine on March 17, 2015, 09:05:33 am
What do you say it's impossible, I've done that already in Piratez 0.89 :) All you need is to use either hair or face option to recolor uniform. Naturally, this requires a different design of the enemy (ex. if you want their skin AND hair to differ too, you either need to use the same colour for hair as for the skin (just a darker shade), or hide their hair beneath a helmet, OR make them all uniform-haired :)

I disagree with disabling of group 0 (and 15 as far as I can tell - or am I just seeing things?), though. Your defense of modders is commendable, Yankes, but I really don't like when people try to save me from myself. Avoiding problems with colors #0 & #15 requires some agility, but I'd rather deal with minor problems than have an option blocked by a divine decree.
Title: Re: how gender/race sprites works? [Explained]
Post by: kikimoristan on March 17, 2015, 12:49:44 pm
sorry everyone been away for abit

i think yankes did a lot already and disabling 0 was a wise choice making his life easier. is not necessary. is just gray really.  use last group  (15) is also gray.
Title: Re: how gender/race sprites works? [Explained]
Post by: Yankes on March 17, 2015, 08:57:02 pm
I disagree with disabling of group 0 (and 15 as far as I can tell - or am I just seeing things?), though. Your defense of modders is commendable, Yankes, but I really don't like when people try to save me from myself. Avoiding problems with colors #0 & #15 requires some agility, but I'd rather deal with minor problems than have an option blocked by a divine decree.
15 should work. Problem with group 0 is that it contains index 0, using naive way it would RECOLOR all empty space. I need some way to handle it, one is test for index 0 even if you don't use it or ban it. I choose banning it. Is this that problematic? If is then I could alter handling of it.

BTW do you have problems with shade "overflow"? If you encounter this many times I could add protection for this too (it will clip to index 15).
Title: Re: how gender/race sprites works? [Explained]
Post by: Dioxine on March 18, 2015, 06:55:48 am
Don't worry it was rather a philosophical thing; it's not really a practical problem (one can always modify the sprite).
Title: Re: how gender/race sprites works? [Explained]
Post by: shadics on February 01, 2017, 11:28:08 pm
But that works for bigsprite recoloring?  :)