OpenXcom Forum

Modding => Work In Progress => Topic started by: moriarty on July 16, 2012, 06:23:40 pm

Title: Additional soldier sprites
Post by: moriarty on July 16, 2012, 06:23:40 pm
quick question to the battlescape gurus, while you're obviously looking here right this moment: if I wanted to provide additional soldier sprites (you know the problem about having only one male and one female battlescape sprite), how difficult would it be at the moment to include them in the game?
would it be a lot of work for you to:
- include a check for the soldier type in the battlescape sprite selection
- make the game search for a sprite file that actually fits the inventory image (idk, maybe xcom_0ma.pck/.tab, xcom_0mb.pck/.tab... and xcom_0fa.pck/.tab, xcom_0fb.pck/.tab... and so on)
- if it doesn't find one, just use the "default" sprite
?
because that would allow us to add more sprites one at a time, just throw them in when they're finished, and still be able to play in the meantime without having to worry about crashing the game...
Title: Re: Additional soldier sprites
Post by: michal on July 17, 2012, 12:54:37 pm
I've moved this topic out of "Battlescape development" thread as it was probably lost there.
Title: Re: Additional soldier sprites
Post by: moriarty on July 18, 2012, 12:52:18 pm
thank you :)


I've already started splitting the male and female xcom_0 sprites (that's the "basic coverall" type), giving the girls their own death animation. next thing I will try is implementing some different hair styles/colors and then I'll try doing some skin colors... :)

so it would be really nice if someone with programming skills would implement some easy way of including these in the game. as suggested above, perhaps :)
Title: Re: Additional soldier sprites
Post by: luke83 on July 18, 2012, 02:36:36 pm
I subscribe to the attitude that " IF you build it they will come".

As for the Skin colours , i too had this desire but i was holding off to see if Yanks got his skin changing code working :P

 Dont forget the Inventory Pics on any new Hair styles, i have seen some of the STYLES getting around these days, some are Bizarre so could be good for in game.
Title: Re: Additional soldier sprites
Post by: Daiky on July 18, 2012, 04:00:08 pm
Currently all the filenames of the resources (graphics etc) are hardcoded and there is no such mechanic that says: if a certain file doesn't exist, just give me another. It has very little to do with the battlescape itself. It's the engine that does a "static" loading of all resources at game starting, if a file is missing, the game doesn't start.
I'm not sure what the plans are, but I think there will be more flexibility in the future.
For the battlescape itself it doesn't change a lot, after all it's all the same routines etc, it's more a matter of resource management.
Title: Re: Additional soldier sprites
Post by: moriarty on July 18, 2012, 04:37:14 pm
Dont forget the Inventory Pics on any new Hair styles, i have seen some of the STYLES getting around these days, some are Bizarre so could be good for in game.
LOL at weird hair styles... he reminds me of Chun-Li, for some reason...
actually, my first step would be the other way around: I'll try to make battlescape sprites for the existing inventory images :)

Quote from: Daiky
Currently all the filenames of the resources (graphics etc) are hardcoded

but... but... that's terrible!  :P
okay, I understand that for now it is the easiest way. I'll place my hopes on future versions, then... just for the record: it would probably also make sense to split the xcom_2.pck in two files, one for the "power armour" and one for the "flying suit". because later somebody might be tempted to make helmetless versions of those, and that won't work if it's in one file. :)
Title: Re: Additional soldier sprites
Post by: moriarty on July 18, 2012, 09:23:02 pm
based on the existing inventory image, this is xcom_0f1:
Title: Re: Additional soldier sprites
Post by: Zharik1999 on July 18, 2012, 09:27:12 pm
This one looks good, and the whole idea is really great, moriarty! :D
Title: Re: Additional soldier sprites
Post by: moriarty on July 18, 2012, 10:20:45 pm
Thank you, Zharik1999!

here's the first new male sprite, xcom_0m1:
Title: Re: Additional soldier sprites
Post by: Zharik1999 on July 19, 2012, 08:19:49 am
You should definitely go on, moriarty :)
Title: Re: Additional soldier sprites
Post by: hsbckb on July 19, 2012, 10:21:21 am
Excellent pixel work. Yes, please go on.
Title: Re: Additional soldier sprites
Post by: moriarty on July 23, 2012, 04:42:13 pm
(busy with RL at the moment... next update hopefully around July 30th, I'll have a bit of time then - 24h on-call shift, lots of time in between actually being called, perfect for pixel work)
Title: Re: Additional soldier sprites
Post by: moriarty on July 31, 2012, 12:35:13 am
this one is new: basic soldier with short-cropped hair. he's not perfect, but right now I can't improve anything without mangling him. do you have suggestions?

the head with very short hair is a real problem (I am trying to make a completely bald guy next) - with a width of four pixels, he's too slim. with six pixels,he's too wide. and with five, he's off-center. I still used five - we'll have to see if it looks weird in-game, I guess.


I have yet to make an inventory picture for him.
Title: Re: Additional soldier sprites
Post by: Templayer on October 12, 2012, 07:41:53 pm
YAY !

Please, continue your work !
Title: Re: Additional soldier sprites
Post by: moriarty on October 12, 2012, 10:41:59 pm
thanks for the bump :)

I'll see when I can find some more time for this. ;)
Title: Re: Additional soldier sprites
Post by: Volutar on October 13, 2012, 09:23:58 am
Last sprite weirdly looks when turned left/right, like it being looking downwards (both eyes are visible, when they shouldn't).
Title: Re: Additional soldier sprites
Post by: Warboy1982 on October 29, 2012, 05:43:31 pm
i would like to include these, (and much of your work) in my mod.
from what i have seen and done so far, getting these in game will be simplistic.
i already have 4 types of cops (2 male and 2 female, blondes and brunettes) as a proof of concept
if you could make me head sprites for all 8 soldier variants i can get them working, and it's a feature i'd REALLY like
i've already included your knife and alternate flying/power armour, i hope that's ok.
as a side note, the knife was my jumping off point for the whole dual wielding thing, i REALLY wanted to see my knife/pistol combination on troops running round the field. if i think about it hard enough, i'd probably say your knife was the jumping off point for my entire mod!

here's a little something for you:
Title: Re: Additional soldier sprites
Post by: 54x on January 03, 2013, 12:21:02 pm
If there's still interest in additional sprites (haircuts, ethnicities, armour customisation, etc... and eventually when people are modding the game once it's feature-complete) I'd be happy to help too, although likely there's some coding involved as well for this I'm sure. (especially given the weird format UFO uses that seems to rely on the engine to recolour things- would be cool to have it simply accept a normal png or something instead, might even save on resources)

I also don't mind doing any missing battlescape items, or possibly re-doing ones that don't actually look like the item itself.
Title: Re: Additional soldier sprites
Post by: luke83 on January 03, 2013, 12:31:31 pm
Hey 54X , there always room for more mods, i am unsure if more solider images are supported yet within Openxcom buts its definitely something we all want, if you have the talent and the time to create some, someone will add the code to handle them.

 As for the UFO file formats , Head on over to the MOD site and have a quick read through the How to guides , everything you need to know is there, if you have any questions feel free to PM me directly, Also when your ready to share your work , i will set you up a Page also.

 My time has been taken up with Family and study currently so i havnt done any mods recently , but i have enough time to help you out answer any questions you may have.

Title: Re: Additional soldier sprites
Post by: moriarty on January 03, 2013, 01:40:42 pm
you are absolutely welcome to go ahead and create additional sprites and stuff! I'd like to do more myself, but I've got next to no time at the moment... RL is keeping me busy :)

as for "weird format", it's actually not that bad, all you have to do is use only colors that are in the palette. most graphics programs support this in one way or the other ("indexed palette" is what it's called in The Gimp).

so if you want to just quickly edit a sprite, all you have to do is use a "dropper" tool to pick colors from the image itself (or other original images used in the same context, i.e. battlescape sprites) to use. don't try to use other colors from the graphics program, just pick from the image(s) and use, that way it's always safe :)
Title: Re: Additional soldier sprites
Post by: luke83 on January 03, 2013, 02:08:54 pm
I like Gimps "colour Exchange" option , it makes colour changes really easier , what i normally do is just open up in Gimp the UFO colour pallet beside the sprite set i want to mod, that way i can pick the colour each time i want from the pallet and replace all of the Pixels with the same colour in about 3 steps.
Title: Re: Additional soldier sprites
Post by: 54x on January 03, 2013, 02:21:45 pm
Oh I don't mean I think it's weird using an indexed palette to recolour an image, that's pretty standard! The weird format dig was about keeping files in proprietary formats, which to be fair was just how things were always done back in the day. What I do think is weird however is recolouring via the engine when the image is only coloured the one time in the actual game- perhaps there was some intention to use recoloured sprites in the original game but it just had to ship before those features made it in- hence the whole red muton thing! It always weirds me out working on images where I can't "see" what I'm doing though, so that's gonna be interesting. ;)

When modding support for images is being developed, it would definitely make sense to simply move to using full colours (and ideally, partial transparency) and masks for any recolouring. (For instance, you could have customisable hair colours, either by supporting images with alpha channels and simply saving the area of the hair to the alpha channel, or you could use a maskfile in shades of grey with white areas to be recoloured by the engine, and grey areas to be partially recoloured) You could also use this to customise armour colours, especially for sprites that don't show soldier skin or hair.

I've done a fair bit of pixel pushing over the years so I'd be quite willing to put in some spare hours to the project for this or any other areas that are lacking graphics and I should hopefully be able to fit the aesthetic. I'm better at re-arranging details once I already have a base shape, but I should be able to get back into practice doing pixel art from scratch that can fit in with the aesthetic, so filling in all the battlescape images so that you can see the different ethnicities and hair styles etc... that already exist in game, and eventually new ones, would definitely be a great place to start.

This is all, of course, so that we can make it even more traumatic when all of your renamed and customised soldiers die, LOL.

And yeah, I hear you about being busy with RL- my free time is all on my weekends nowadays. Thus is the downside of responsibility at work.

edit: Yeah, the issue I'm having is that I've actually got the relevant files extracted now to work on, but BB's tool didn't attach the original palette to them, so I need to either find another way to convert the PCK files, or grab image(s) off someone with the relevant colour pallete(s) attached. ><
Title: Re: Additional soldier sprites
Post by: moriarty on January 03, 2013, 02:33:04 pm
https://www.ufopaedia.org/index.php?title=PALETTES.DAT (https://www.ufopaedia.org/index.php?title=PALETTES.DAT)

especially https://www.ufopaedia.org/index.php?title=File:5_BattleScapePal.Png (https://www.ufopaedia.org/index.php?title=File:5_BattleScapePal.Png) should be what you're looking for


 :)
Title: Re: Additional soldier sprites
Post by: 54x on January 03, 2013, 02:53:39 pm
That's really awesome. I had stumbled upon a file containing the relevant palette browsing Luke's site, so that helped, but your link will be excellent if I need to play around with other images. Of course now it's clear that the images aren't recoloured, just the tool I'm extracting with doesn't play nice with palettes like it ought to. ;)

Ideally I'd like to add some interface images too, like an icon that indicates that you can click to rename things. (eg. for soldier names, base names, craft names, etc... as appropriate)

So yeah, at the very least I can do some more battlescape hairstyle images that can be swapped out so that it doesn't look like all the men are from streetfighter. :) (although the short hair image posted earlier is really good, and I think the decision to go with 4 pixels is correct in the context of this sort of low-res environment)
Title: Re: Additional soldier sprites
Post by: 54x on January 03, 2013, 03:30:00 pm
So, step one:

Basic female death animation consistent with the default blonde ponytail head. Each new head graphic will require a new death animation too, so might as well practice and eliminate plasma-induced transgenderism at the same time. :) This way I will also have a template that I can simply paste new female heads onto to fit with the existing death animation, and then adjust similarly for each skin tone from there.

edit: OK, done with that, and also got the correct head on the power armour death animation. I'm moving on to additional stuff now, but I need to know where to find:


Ideally we should have sprites for all three of those for customisation purposes, although I'm open to the argument that just adding an armoured and unarmoured female corpse item would be enough.
Title: Re: Additional soldier sprites
Post by: Nickolaidas on January 03, 2013, 06:49:04 pm
That's awesome! I hope guys can make these multiple sprites idea work. I hated how *everybody* looked the same in the game.

Now, if we could also change that stupid helmet of the power suit and make it look like ... I don't know, a Cylon's helmet from battlestar galactica ... then I'm SOLD!
Title: Re: Additional soldier sprites
Post by: 54x on January 03, 2013, 07:36:51 pm
That's awesome! I hope guys can make these multiple sprites idea work. I hated how *everybody* looked the same in the game.

Now, if we could also change that stupid helmet of the power suit and make it look like ... I don't know, a Cylon's helmet from battlestar galactica ... then I'm SOLD!

That's step five or six in terms of what I'm going to draw. I'm going to operate on the theory that if you build resources for it, someone will eventually get interested and code it. No point waiting!

Step two: Hair colours. I have already started this for the default haircuts, which multiplies the amount of work by up to four for the later steps, as I'm assuming hair is either blonde, brown, red, or black. I'm operating under the assumption that hair will be painted blonde and european first and can then be palette-shifted to get the other colours. This involves loading a palette three times onto the image and then resaving it, but that's not a huge problem as I only need to do eleven images for a hair-colour-hair-cut combination. Really the hardest part of this is choosing the right part of the palette for each colour, but it looks like there will be appropriate battlescape colours available.

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.

Once I've done that, I'll have an extra three to four palettes to apply to every haircut. (I'm assuming that one of these skintones will have brown and black hair, and the other one or two will just have black hair all the time, but may have additional haircuts)

Step four: Actually spriting new haircuts as above. Original artwork, yay! But then I have to go back to steps two and three up to eighty-eight times for each one, LOL. I'll see if I can fill out the other hair colours and ethnicities for Moriarty's sprites.

Step five (or six): Power armour customisation, which involves a lot of new drawing repeating several times. The tricky thing here is that if anything touches the arms or legs it has to be done a LOT, so I may cheat and give you a lot of breastplate artwork and helmet options to cut down on repetitive spritework.

Step six (or five): If I'm still not tired of it, I start working in sprites for power armour and flying armour that leave your head visible through some sort of cool safety glass, forcefield, or tinted material that lets us see something of your haircut and skin shade of your face. In a way that may be BETTER than step five from a coding perspective, as you'd already have to do all the work for steps one-through-four. If someone's really keen to get this feature in and not just sprited before I hit step five, this may jump up a step, as step five would require some sort of per-soldier armour customisation interface to be worthwhile implementing.

Then I can move onto spriting any extra interface buttons, UFO parts, new items, or new facilities people might want. :)
Title: Re: Additional soldier sprites
Post by: Nickolaidas on January 03, 2013, 07:40:50 pm
Awesome!
Title: Re: Additional soldier sprites
Post by: moriarty on January 03, 2013, 09:26:09 pm
That's awesome! I hope guys can make these multiple sprites idea work. I hated how *everybody* looked the same in the game.

Now, if we could also change that stupid helmet of the power suit and make it look like ... I don't know, a Cylon's helmet from battlestar galactica ... then I'm SOLD!

Hmmm... it's not as sophisticated as 54x's plans, but for now you might want to take a look at openxcommods.weebly.com and navigate to my section for my version of the power armor and flying suit ;)
Title: Re: Additional soldier sprites
Post by: Nickolaidas on January 03, 2013, 10:27:44 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.
Title: Re: Additional soldier sprites
Post by: Yankes 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
Title: Re: Additional soldier sprites
Post by: moriarty 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.
Title: Re: Additional soldier sprites
Post by: luke83 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)
Title: Re: Additional soldier sprites
Post by: 54x 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...
Title: Re: Additional soldier sprites
Post by: moriarty 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?
Title: Re: Additional soldier sprites
Post by: Yankes 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.
Title: Re: Additional soldier sprites
Post by: 54x 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.
Title: Re: Additional soldier sprites
Post by: Yankes 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.

 
Title: Re: Additional soldier sprites
Post by: 54x 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?
Title: Re: Additional soldier sprites
Post by: Yankes 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).
Title: Re: Additional soldier sprites
Post by: 54x 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.
Title: Re: Additional soldier sprites
Post by: Yankes 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)
Title: Re: Additional soldier sprites
Post by: 54x 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
Title: Re: Additional soldier sprites
Post by: Yankes on January 16, 2013, 12:30:52 am
I make my old code run again in new OX.
Title: Re: Additional soldier sprites
Post by: 54x 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)
Title: Re: Additional soldier sprites
Post by: Yankes on January 18, 2013, 01:21:47 am
I made some tweaks to coloring, previous one was a bit odd :)
Another thing I find is that is possible to store optional blood/wound in sprite, but this will require some hex magic.
It will be possible to draw unit that have fatal wounds with red parts. Only drawback is that you will louse some possible colors.
Title: Re: Additional soldier sprites
Post by: anonilsus on January 28, 2013, 03:32:23 pm
I think this is a really good idea and should be even implement without the need for having a mod activated. This is one of the cases where it only adds to the game and nothing is lost, neither balance nor "feeling".

I remember clearly that I was confused when I first played xcom that the soldiers look different but in the battlescape they are all part of the "Arian Army"
Title: Re: Additional soldier sprites
Post by: Yankes on January 29, 2013, 11:04:34 pm
I will try made "full" version that can be merge with master branch.
Title: Re: Additional soldier sprites
Post by: SupSuper on January 30, 2013, 04:56:45 am
I always worry about the kind of crazy tricks Yankes pulls and how long they will work for :P but different soldier appearence is useful, if he sends a pull request I'll put it in.
Title: Re: Additional soldier sprites
Post by: 54x on January 30, 2013, 07:20:40 am
I need to arrange with one of you guys to transfer the images I have that should be easily shiftable to extend the other hairstyles to the battlescape as well, but that might require some additional code to sub in these extra sprites.
Title: Re: Additional soldier sprites
Post by: Volutar on January 30, 2013, 07:32:13 am
So it will be extra additional "race/skin color" values? It will be relatively simple to add ragdoll images, but as for battlescape randering... alot of things are hardcoded, and it will require for some brainwork - how to add some extra sprites without touching original. Either it be "copy" of original (like it's additional armor type), or totally new pck having extra torso sprites only.
Title: Re: Additional soldier sprites
Post by: 54x on January 30, 2013, 09:11:55 am
So it will be extra additional "race/skin color" values? It will be relatively simple to add ragdoll images, but as for battlescape randering... alot of things are hardcoded, and it will require for some brainwork - how to add some extra sprites without touching original. Either it be "copy" of original (like it's additional armor type), or totally new pck having extra torso sprites only.

What Yankes has coded will add the extra skin tones and hair colours. I have blonde european hairstyles for both genders that can then be recoloured if someone wants to code loading the PNGs into the game based on some gender/hairstyle data- essentially you have to swap out the "chest" part of the sprite sheet, and also the corpse 1-3 frames. (Plus the inventory screen paperdoll, which may need the recolouring extended to it) I haven't quite finished them all but I've heard back about my promotion now so I might be able to put aside some time this weekend to finish off adapting the remaining basic hairstyles. :)

And yes, you could just make these into two giant PCKs, one that holds the extra chest/corpse frames and one that holds the paperdolls. (Although why do that when it's probably going to be only moderately easier than just coding in reading a good sprite format like PNG?)
Title: Re: Additional soldier sprites
Post by: Volutar on January 30, 2013, 09:24:18 am
PNG sprites aren't implemented. Plus I guess it will be kind of a problem to use 8bit paletted PNGs.
Title: Re: Additional soldier sprites
Post by: 54x on January 31, 2013, 11:05:23 am
PNG sprites aren't implemented. Plus I guess it will be kind of a problem to use 8bit paletted PNGs.

A paletted PNG isn't really any different than a paletted gif.

Loading PNGs is in the library the game uses to render. It's not going to be that much faster to code in a whole new PCK than it is to just code in a method for loading new resources from external files, and the only reason it would be faster is because you can copy-paste a bit.
Title: Re: Additional soldier sprites
Post by: moriarty on January 31, 2013, 11:11:23 am
Allow me to chime in: loading of external png files would make modding a lot easier. Just saying. ;)
Title: Re: Additional soldier sprites
Post by: Warboy1982 on January 31, 2013, 11:11:27 pm
loading of external PNGs (and many other common image formats) is theoretically already supported, using the SDL_Image library, using the same method we use for loading the game over (LBM) screens.
Title: Re: Additional soldier sprites
Post by: Yankes on February 01, 2013, 01:17:32 am
half work done :) only thing to do left is corpse on ground and copse in trunk :>

[ps]
 https://github.com/Yankes/OpenXcom/tree/SoldersColors is last version of this
Title: Re: Additional soldier sprites
Post by: Yankes on March 02, 2013, 05:47:47 pm
https://github.com/Yankes/OpenXcom/tree/SoldersColors
I can say that solder sprite is now 100% converted (at least is he still alive :) corpse stay unchanged)
Tomorrow I will send pull request to master branch.

I made too small hack to slow down game while debugging. right now you can only change speed using debugger,
stop execution of xcom and change `slownes` to something bigger than 1.
it should be transparent for rest of game except game run couple times slower.
Title: Re: Additional soldier sprites
Post by: 54x on March 02, 2013, 11:25:49 pm
https://github.com/Yankes/OpenXcom/tree/SoldersColors
I can say that solder sprite is now 100% converted (at least is he still alive :) corpse stay unchanged)
Tomorrow I will send pull request to master branch.

I made too small hack to slow down game while debugging. right now you can only change speed using debugger,
stop execution of xcom and change `slownes` to something bigger than 1.
it should be transparent for rest of game except game run couple times slower.

Can we make this work for corpses on the battlescape too at some point? I've been including new hair for corpses. (I haven't been updating the inventory pic though, so we can leave that as is for unconscious or dead soldiers)
Title: Re: Additional soldier sprites
Post by: Yankes on March 03, 2013, 01:48:31 am
this depend on this if I can access solder data from its corpse. I didnt check this yet.
Title: Re: Additional soldier sprites
Post by: luke83 on March 03, 2013, 03:16:29 am
It would be nice Long term if we could....Clone Tanks anyone?
Title: Re: Additional soldier sprites
Post by: 54x on March 03, 2013, 04:00:48 am
this depend on this if I can access solder data from its corpse. I didnt check this yet.

Alternatively we can prerender the corpses and just have it spit out a different one at time of death.
Title: Re: Additional soldier sprites
Post by: moriarty on May 09, 2013, 03:02:45 pm
Yankes, do you have a list or table or any kind of overview exactly which colors of the palette are the "hair" colors that your code modifies?

because I noticed that some of my earlier weapon mods apparently use colors that are usually hair color shades, and now change on soldiers with changed hair. which looks kind of weird :P so I'd like to re-do those weapons - unless your code can be modified to ignore the weapon sprites...?
Title: Re: Additional soldier sprites
Post by: Warboy1982 on May 09, 2013, 07:53:37 pm
here you go. (https://github.com/SupSuper/OpenXcom/commit/23a2e04b43b193062e06b8eec672b7e882baf68b)

i'd prefer to make the adjustments at load time, but i couldn't figure it out, this method, however, worked.
Title: Re: Additional soldier sprites
Post by: moriarty on May 09, 2013, 07:59:10 pm
thank you!

hmmm... does that mean that with a little extra code (mostly copy-paste, probably) we could also have custom color-changed weapons? like, for example, different kinds of grenades for a mod that adds, say, apocalypse's alien gas grenades?
Title: Re: Additional soldier sprites
Post by: Warboy1982 on May 09, 2013, 08:01:18 pm
rather easily, i would imagine. Although if you're modding, it might just be easier to do the palette swap manually.
Title: Re: Additional soldier sprites
Post by: Yankes on May 09, 2013, 09:58:16 pm
Hard to admit but my code isnt mod friendly because its depends on original data. Right now if you change "xcom_1.pck" you could end up with strange colors. I change some pixel form 0x6 color group (face color or male hair color in "xcom_1.pck") to 0x9 color group (male hair color in "xcom_0.pck").

After that when Unit is drawn I replace every pixel from 0x6 to correct face color and 0x9 to correct hair color.

I think I should add two options for moders that turn off my hack.
One options will turn off changing "xcom_1.pck" and second will turn off national look (its separate for moders that want use it).
Title: Re: Additional soldier sprites
Post by: 54x on May 25, 2013, 03:21:01 am
What would actually be ideal is an external file where we can set recolour data for the battlescape and have the game go from there. So we could set it for all of the soldier sprites, and have a seperate flag for the male unarmoured sprite as it recolours without being blonde. We could possibly move this into the ruleset?

Then the next step is to also recolour the paperdolls in the inventory screen so we can re-use the different haircuts as any of the three races.
Title: Re: Additional soldier sprites
Post by: Warboy1982 on May 27, 2013, 10:46:34 am
so uuuuh... this should be easier now... and stuff... i'd definitely like to see this implemented. recolouration is great, don't get me wrong, but if we could actually have the right hairstyles to go with them, and get rid of the "mod unfriendly*" sprite recolouring technique... that'd be nice.



* it's not THAT unfriendly, the combat armour recolours nicely, although i understand where the problems would arise.
Title: Re: Additional soldier sprites
Post by: 54x on June 08, 2013, 04:36:42 pm
So, apparently I hadn't posted any new sprite graphics here yet... here's  few views of what I have so far:
Title: Re: Additional soldier sprites
Post by: 54x on June 09, 2013, 05:55:02 am
I've done the unarmoured version of the asian paperdoll. (in blonde european form, to be friendly for recolouring) This leaves me the personal armour version of that look, and both the unarmoured and personal armour version of the male african look to sprite before I've done all the base looks.

I've also based a long-haired non-ponytail look off the original prototype XCOM sprites, which I've drafted in the south-facing direction. (I've altered it slightly because it wasn't using anwhere near enough of the pallete compared to the ponytail sprite) There's previews for that and the male parting look below.

After that I'll move on to trying to come up with a good helmetless look for Power Armour.
Title: Re: Additional soldier sprites
Post by: 54x on June 16, 2013, 02:19:01 pm
I finished up the first stage of spriting today. (like, right now)

I've got battlescape sprites for ALL default looks in european skintone and blonde hair, and one extra look for both male and female. (Moriarty's short-haired male sprite, with a new paperdoll and accompanying death and personal armour sprites, and a new long-haired female sprite based on the Gollop concept art) The new female sprite still lacks a paperdoll but is otherwise ready to roll.

For spriting the next steps are helmetless sprites for power and flying armour, and porting the TFTD looks into the UFO armour sets.
Title: To Warboy with love ;)
Post by: 54x on June 22, 2013, 10:39:52 am
Vanilla sprites, one more time... :)
Title: Re: Additional soldier sprites
Post by: Mr. Quiet on June 22, 2013, 11:15:35 am
Nice! Great job 54x!
Title: Re: Additional soldier sprites
Post by: mercy on June 22, 2013, 11:50:15 am
Wow, very nice work!! Especially like the flat-top haircut realized!
Title: Re: Additional soldier sprites
Post by: 54x on June 22, 2013, 12:30:06 pm
Wow, very nice work!! Especially like the flat-top haircut realized!

We're moving to a model where we don't recolour the sprites in-engine. (for those of you with old laptops, this will save you processing power, at the cost of slightly more RAM) The reason there's flat-top graphics in there this time is that the default graphic has his haircut go brown when he equips personal armour, which isn't consistent with his paperdoll on the inventory screen.

And you may see a hint of power armour without helmets in there ;) It's one of a couple of things I'm working on.
Title: Re: Additional soldier sprites
Post by: Yankes on December 17, 2013, 01:27:14 am
I get back to doing something constructive in OpenXcom :)
Right now corpse items and inventory items stay in original version, its time to fix that :)
side effects? 90% work to recolor aliens on the fly is done :)

Future goals:
hack original sprites to remove blood on stunned units
Red Muton commander
Fashion capes for Ethereals and Floaters
More random civilians?

[ps]
current state (with small changes to text draw):
https://github.com/Yankes/OpenXcom/tree/SoldersColors
Title: Re: Additional soldier sprites
Post by: Hythlodaeus on December 17, 2013, 03:27:49 pm
I get back to doing something constructive in OpenXcom :)
Right now corpse items and inventory items stay in original version, its time to fix that :)
side effects? 90% work to recolor aliens on the fly is done :)

Future goals:
hack original sprites to remove blood on stunned units
Red Muton commander
Fashion capes for Ethereals and Floaters
More random civilians?

[ps]
current state (with small changes to text draw):
https://github.com/Yankes/OpenXcom/tree/SoldersColors

Very nice. I'd say this is worth merging with the main repo.
Title: Re: Additional soldier sprites
Post by: Yankes on January 26, 2014, 04:26:41 pm
Some test of recoloring aliens. This effect is created by replacing original cape color by color: `1 + unit_id%6`.
I think about solution that allow moders for creating custom recolors using only rule set file.
Something like that:
Code: [Select]
- color:
    1: "(1 + unit_id%6)*16" #ETHEREAL cape
or in case of humans:
Code: [Select]
- color:
    6: "face_color" #correct color of skin
    9: "hair_color" #correct color of hair
Or for muton:
Code: [Select]
- color:
    3: "commander ? 2 : 3" #red muton commander
    4: "commander ? 2 : 4" #red muton commander
Title: Re: Additional soldier sprites
Post by: xracer on January 26, 2014, 08:23:41 pm
Looks really nice.

It will be a nice way to adjust thing without coding
Title: Re: Additional soldier sprites
Post by: Yankes on February 13, 2014, 11:23:49 pm
small update on progress. Half of complex work is done, core is done. now only left to do is parser (sometimes it can be most complex thing, I hope it wont be) and adding this to OXC.

Syntax will shift form that I planed first, forget C like syntax and start learn assembler :)
I except example code will look like that:

simple function that multiple argument by 13
Code: [Select]
set r0 in;
mul r0 13;
ret r0;

muton recolor function:
Code: [Select]
test commander 1;
ret_neq in; https:// if(commander != 1) return in;
set r0 in;
getcolor r1 r0;
test r1 3;
ret_lt in; https:// if(r1 < 3) return in;
test r1 4;
ret_gt in; https:// if(r1 > 4) return in;
setcolor r0 2; https://changing green '3' and '4' to red '2'
ret r0;

This code is lot of more ugly than previous version but is lot of faster. I archive 50x time speed up compared to previous version with nice syntax.
Now in rough test I archive 4 times slower time than equivalent C++ function. This allow to blit graphic using user defined code.

If someone is interesting in it, and want know what dark magic I used to made it work, this is my test ground in attachment.

ps. is possible to have nice syntax and fast runtime but this will require compiler and I dont want write it :)
Title: Re: Additional soldier sprites
Post by: Aldorn on February 18, 2014, 04:07:13 pm
I am very interested in this functionality, as it would be an easy way to create new alien races without having to create all bitmaps

A quick way to create evolved aliens would be a very nice contribution !
Title: Re: Additional soldier sprites
Post by: Yankes on April 12, 2014, 01:24:08 pm
My mod is near finishing, only left is integrate it with OpenXcom.
This is minimal version, I have lot of ideas of expanding it, but because of time constraint I scrap or dont do most of it.
If people find my mod useful I will add allot of new stuff to improve it functionality.
Title: Re: Additional soldier sprites
Post by: Solarius Scorch on April 12, 2014, 04:57:04 pm
I hope this won't automatically indicate alien ranks, it would make the game much easier :P
Title: Re: Additional soldier sprites
Post by: Yankes on April 12, 2014, 08:06:56 pm
Its up to you :) Another thing that my mod will allow is have blood on unit when is wounded, but this will require some hack to graphics.
Title: Re: Additional soldier sprites
Post by: Ran on April 13, 2014, 09:37:45 pm
Looks really great!

One question - is it now possible to have completely different sprites for each of the 8 soldier types?
The recoloring code is awesome but doesn't work for each mod.
Title: Re: Additional soldier sprites
Post by: Fox105iwsp on April 14, 2014, 08:33:24 am
Question over here >_<
....is there a mod for the Red Muton Commander/Elite units, ready over here?
Title: Re: Additional soldier sprites
Post by: Yankes on April 15, 2014, 01:59:45 am
Not jet :)

I finished first step of integration with OpenXcom :)
Hello word of recoloring:
Code: [Select]
    #YAML code form `- type: STR_NONE_UC`
    recolorScript: >
      set_color in 3;
      ret in;
I need do some additional work to made it usefu.
Title: Re: Additional soldier sprites
Post by: Yankes on April 16, 2014, 01:11:08 am
version 1.0 is ready: https://github.com/Yankes/OpenXcom/tree/ColorScript

My next target will be create some way to inform user about available data for script.
Right now you can use:

Code: [Select]
health
health_max
energy
energy_max
stun
stun_max https:// == health
morale
morale_max https:// == 100

fatalwounds https:// sum of fatalwounds_*
fatalwounds_head
fatalwounds_torso
fatalwounds_leftarm
fatalwounds_rightarm
fatalwounds_leftleg
fatalwounds_rightleg

armor_front
armor_left
armor_right
armor_rear
armor_under

unit_id
unit_rank
unit_float
unit_kneel

soldier_hair https:// color with shade based on soldier_look
soldier_face https:// color with shade based on soldier_look
color_hair https:// == 9
color_face https:// == 6

soldier_look
soldier_look_blonde
soldier_look_brownhair
soldier_look_oriental
soldier_look_african

soldier_grender
soldier_grender_male
soldier_grender_female
Title: Re: Additional soldier sprites
Post by: redv on April 19, 2014, 11:25:30 am
Yankes, is it possible use your code without redesign for flashing/blinking units (in real time) into red and back?
For example, for units in blast radius: https://openxcom.org/forum/index.php?topic=1532.msg19483#msg19483 (https://openxcom.org/forum/index.php?topic=1532.msg19483#msg19483)
Title: Re: Additional soldier sprites
Post by: Yankes on April 19, 2014, 12:23:45 pm
Mod have access only to unit data and result is cached (sometimes my mod will be bit buged if some unit property is changed and cache not refreshed). Because of this its impossible without code change. A lot of simpler would be ignore my mod and hardcode flashing into game, that will be easier and faster.

BTW I think better will be if affected unit will not turn red but became brighter in colors.