Author Topic: Additional soldier sprites  (Read 66255 times)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Additional soldier sprites
« Reply #30 on: January 03, 2013, 10:42:16 pm »
Quote
Step three: Ethnicities. Essentially I'm going to index-shift the palettes of all of the arm graphics to a new pallete with darker skin colours, then match it back. The advantage is that the extra work only has to be done once per skin colour, then after that I just need to do faces for one or two hair colours per ethnicity. I'm thinking there will probably be three or four given the palette range I have, and as ethnicity covers only "skin colour" and not detailed facial appearance.
I once done something similar: https://openxcom.org/forum/index.php/topic,267.msg1983.html#msg1983

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Additional soldier sprites
« Reply #31 on: January 03, 2013, 11:35:56 pm »
Moriarty ... I finally understand what your Avatar is.  ;D

Those are awesome. When the game is finished, I'll use these mods, if it is possible. These suits are amazing, I hated that stupid  :o visor of the power suit.

you don't even have to wait until the game is finished. you can use them right now. you could even put them in the original game - the modified files are right there to download.

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: Additional soldier sprites
« Reply #32 on: January 04, 2013, 12:49:36 am »
Yanks , is your code "Usable "? It may be quicker to team up with 54X and work towards a mix of both techniques ( several new sprites designs plus colour shifting for Race by your code)

Offline 54x

  • Colonel
  • ****
  • Posts: 208
    • View Profile
Re: Additional soldier sprites
« Reply #33 on: January 04, 2013, 04:10:44 am »
Yanks , is your code "Usable "? It may be quicker to team up with 54X and work towards a mix of both techniques ( several new sprites designs plus colour shifting for Race by your code)

My approach essentially puts all the burden on the image creator, and if properly coded we could simply have the customisation part of the engine read the relevant directory to ensure it contains all necessary images using the naming format, a paletted PNG and of a 32x40 size. All the programmer will have to do is re-code the battlescape to automatically load up a bunch of PNGs, and allow it to load unlimited haircuts with distinct names for each ethnicity, and then it will never require any coding work ever again. (Well, I suppose we might have to add those soldier variables to the save files too, and if we're wanting to be really thorough we'll change the name generation at some point to have ethnic lists that correspond with those variables. But adding a new haircut never has to break a save, just have it add a higher number to the haircut variable and then sort them alphabetically in the loading code, so all you have to do is not delete haircuts without replacing them)

I've got a standard filename template for each one, too, in the format of:

f eu ponytail re north

[f/f1/m/m1]  = Gender/armour combination. *1 is personal armour, no number is unarmoured, but if it helps I can change that to *0.
eu = ethnicity. I was thinking something like Af, (African) As, (Asian) and La (Latin) for remaining skin tones.
ponytail = short name for haircut. Currently ponytail and Flattop, next I'll add the male "short" that moriarty did, and then probably go to work on creating a female "long"
re = hair colour. I'm using bl, br, and bk for the other three colours.
north = this is a name for the sprite that will reference which part of the sprite sheet we're drawing instead of. So full names for each of the eight directions in XCOM, plus death1-3 for the dying animation, and "dead" for the corpse floor object.

(I have to find the portrait in the inventory screen at some point too and see how that chops up, because we'll need arm and head graphics for that, too.) And yes, that means I've found the corpse graphic.

Publishing the offset palettes and then getting the artist to save multiple images that way will allow us to add some haircuts to some ethnicities only. I was considering that given that european soldiers get hair colours, they might only need a few haircuts to be distributed with the game to come up with a good customisation spread, say 3, which gives you twelve options- considering you've got three other ethnicities and a max of 26 soldiers in the base game, that's halfway to allowing all soldiers to be unique right off the bat, and then hopefully I can do another three that fit each ethnicity.

If we want to use Yanks' code, that will save me a lot of image-saving, but we will probably then need to accept that every hair style will be available for every ethnicity. I'll continue on with european hair for the moment while that's settled, as his code would effectively eliminate the need for me to save additional images for ethnicity. As power armour only differs by hair cut, I'll also make different female haircuts to male ones if that's okay, and assume all Moriarty's ones are for men.

I've also found the corpse inventory graphic and unfortunately that may be a bit too detailed for me to edit convincingly, so I hope people don't mind dealing with male flat-top corpses in blonde or brown hair (depending on armour) any time they want to drag their buddies home for a decent burial. I could probably do this for some of the easier hairstyle changes, but making the unarmoured one look convincingly female and still ragdoll-dead was a bit beyond my skillset, and it just seems weird to have different male haircuts and haircolours for corpses, but not to have any female corpses at all.

What I might do is make a variant without blood to use for unconscious soldiers at the very least.

By the by, completing hair colours for the default colours has a snag. The default hair is blonde for no armour. but brown for personal armour- when this gets patched in the code is going to need an exception for male hair colours of the default flat-top haircut so that personal armour uses new graphics for blonde men, and unarmoured men use new graphics for brown hair, but not vice-versa. edit: I suppose I could always just copy in the full spritesets and the default male sprites can get overidden with this change.

Oh, and because I've got all the female haircolours finished, here's a preview...
« Last Edit: January 04, 2013, 05:04:17 am by 54x »

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Additional soldier sprites
« Reply #34 on: January 04, 2013, 12:29:50 pm »
I think at this point we really have to think about how to organize these files.

with the current engine, we need separate image files for each hairstyle, skin color, gender and armor, which translates to a whole lot of files, each containing the full image (or rather, a whole lot of pck files each containing all the sprites).

since the game engine don't support more soldiers at this point anyway (unless I'm mistaken), perhaps we should go ahead and break the sprites up into "head", "hair", "arms with exposed skin" and "armor"? the game could surely be adapted to re-combine them again, perhaps after re-coloring them separately.

this way we could easily skip all the multiple-file issues:

the game simply
1) chooses the head and arms according to "gender" flag
2) colorizes head and arms according to a "skin color" flag
3) chooses hair according to "hairstyle" flag
4) colorizes hair according to "hair color" flag
5) chooses armor according to "armor" flag
6) colorizes armor according to "armor color" flag
7) simply draws them in the right order: probably "arms, head, hair, armor" (armor needs to be drawn last to make sure that power armor and flying armor are drawn over the arms - we don't want them sticking out :)

does anybody see any problems with this?

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Additional soldier sprites
« Reply #35 on: January 04, 2013, 08:01:16 pm »
Yanks , is your code "Usable "? It may be quicker to team up with 54X and work towards a mix of both techniques ( several new sprites designs plus colour shifting for Race by your code)
Right now no, It worked with .3 or .4 After that was made some rearrangements in classes that broke my code. Its fixable but I didnt do it yet because I was fighting with globe shading :)

54x if you want use my idea of recoloring on the fly you only need create couple graphic that have unique shape, if you use colors in spacial way you could change color of every body part (trousers, sleeves, hairs, skin, boots, etc.) without problems using my code.

[ps]
I think blood can be separate graphic, draw on top of blood less solder. but this will need some work to do it.
« Last Edit: January 04, 2013, 09:28:01 pm by Yankes »

Offline 54x

  • Colonel
  • ****
  • Posts: 208
    • View Profile
Re: Additional soldier sprites
« Reply #36 on: January 05, 2013, 02:32:50 am »
Right now no, It worked with .3 or .4 After that was made some rearrangements in classes that broke my code. Its fixable but I didnt do it yet because I was fighting with globe shading :)

54x if you want use my idea of recoloring on the fly you only need create couple graphic that have unique shape, if you use colors in spacial way you could change color of every body part (trousers, sleeves, hairs, skin, boots, etc.) without problems using my code.

[ps]
I think blood can be separate graphic, draw on top of blood less solder. but this will need some work to do it.

Yep I've been concentrating on blonde european men and women ever since, and now I'm providing paperdolls (ie. for the inventory screen) for them. You obviously coded several skintones in via palette shifting, and I can give you colours for hair tones if we're restricted to using the default battlescape colours. If we're not, I'd actually like to make some adjustments to the black colours, assuming you don't already have a palette for that.

It would greatly simplify things if I just had to make a blonde haircut for each one and you could just index-shift colours from index 144 to 153 to change hair colours. I forget exactly the skintone range but paperdolls use colours ranging from indexes 19-30 and 96-101 for skintones.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Additional soldier sprites
« Reply #37 on: January 05, 2013, 03:13:57 am »
I didnt change palette, I only replace colors. Something similar to what you said:
every pixel of graphic written in hex as 0xFF (value of index) I split in two parts.
0xF0 is colors of pixel
0x0F is shade of pixel
after that I tested first part that is color I looking for. If is, I replace it with new value e.g. 0x60
Result of this is pixel with value 0x6F

I prefer working with whole colors ranges, but if its needed is easy to pick some range of values and shift it.

I will try made my code work again with current OX version.

 

Offline 54x

  • Colonel
  • ****
  • Posts: 208
    • View Profile
Re: Additional soldier sprites
« Reply #38 on: January 05, 2013, 05:34:05 am »
I didnt change palette, I only replace colors. Something similar to what you said:
every pixel of graphic written in hex as 0xFF (value of index) I split in two parts.
0xF0 is colors of pixel
0x0F is shade of pixel
after that I tested first part that is color I looking for. If is, I replace it with new value e.g. 0x60
Result of this is pixel with value 0x6F

I prefer working with whole colors ranges, but if its needed is easy to pick some range of values and shift it.

I will try made my code work again with current OX version.

Oh, that's interesting. I figured you were just searching the palette index and substituting colours that way instead of doing a search by colour! What do you do for colours that have multiple indexes on some of the palettes? Or has that situation never come up?

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Additional soldier sprites
« Reply #39 on: January 05, 2013, 04:21:05 pm »
Oh, that's interesting. I figured you were just searching the palette index and substituting colours that way instead of doing a search by colour! What do you do for colours that have multiple indexes on some of the palettes? Or has that situation never come up?
You mean that two index have exactly same RGB value in one palette? For my code that are two different colors.
Overall you can say that my approach is colorblind :) Only thing it know about palette its have colors grouped in 16 element sequences, order by brightness (this isnt true for whole palette).

Offline 54x

  • Colonel
  • ****
  • Posts: 208
    • View Profile
Re: Additional soldier sprites
« Reply #40 on: January 05, 2013, 06:30:46 pm »
You mean that two index have exactly same RGB value in one palette? For my code that are two different colors.
Overall you can say that my approach is colorblind :) Only thing it know about palette its have colors grouped in 16 element sequences, order by brightness (this isnt true for whole palette).

Ah, it does sound like you're doing palette substitution then. Very cool. How many different hair colours and skin tones did you manage to make initially out of the xcom palette? I can see an argument for say, 5-6 distinct skintones if we can manage it, (pale european, dark european/latin american, pale asian, dark asian, polynesian/pale african, and dark african) but I suspect the battlescape palette is only designed for the three skintones the game ships with on the inventory paperdoll.

As for the sprites, I've re-implemented all of Moriarty's sprites, but with custom death animations and personal armour sprites for each one, using the same default european/blonde tinting the other sprites used, and also with an accompanying paperdoll. Next I need to make blonde european images for the other two default paperdolls. (which are currently one each african and asian for each gender, with brown and black hair respectively) I got a bit side-tracked making character screen suggestions for a while so that slowed down my progress.

From there I'll have to choose between optional visible heads for power and flying armour, (I'm thinking some sort of glass dome for power armour, and a cool one-eye visor for flying armour) or additional hair styles.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Additional soldier sprites
« Reply #41 on: January 05, 2013, 07:41:31 pm »
Ah, it does sound like you're doing palette substitution then. Very cool. How many different hair colours and skin tones did you manage to make initially out of the xcom palette?
I only did original one (2 european, 1 asian and 1 african)

Offline 54x

  • Colonel
  • ****
  • Posts: 208
    • View Profile
Re: Additional soldier sprites
« Reply #42 on: January 06, 2013, 02:32:26 am »
I only did original one (2 european, 1 asian and 1 african)

Sweet, those colour replacements will be a great place to start until we can support mixing different palettes on one screen. Do you want my palette offsets for hair colours too, if you were only implementing shading based on the default paperdolls? Using the battlescape palette, I'm using 144-152 for blonde, (so you should search for those colours) 26-28 then 39-44 for red hair (I use two ranges to make it mix between auburn-coloured red-brown and the cherry red of the darker red palette), 151-159 for brown, and 247-254 for black hair.

Then we'll just need to co-ordinate recolouring paperdolls the same way, and we're golden for customisation. :D

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Additional soldier sprites
« Reply #43 on: January 16, 2013, 12:30:52 am »
I make my old code run again in new OX.

Offline 54x

  • Colonel
  • ****
  • Posts: 208
    • View Profile
Re: Additional soldier sprites
« Reply #44 on: January 16, 2013, 06:17:09 am »
Sweet. Being back at work is kicking my ass but I'll attempt to get you the blonde european versions of all the other characters soon- then it's a matter of coding in the PNG loading and frame replacement necessary to have multiple character graphics as well as recolour the original two.

(I have another 4 graphics still to implement that correspond with the default asian and african portraits from each gender, and then I need to re-colour those portraits to look european and blonde so they can be recoloured to any hair/ethnicity combo from there)