ttyborg / unflobtactical

Automatically exported from code.google.com/p/unflobtactical
0 stars 0 forks source link

Faces: not hardcoding number of items in image #77

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I've been looking through the code, mainly in order to play around with the 
face generator. As far as I can see, the number of items in each source image 
(e.g. hairs_64b.png) is hardcoded in game.cpp (e.g. as faceGen.nHairs = 17).

It would be a lot more flexible to have this number as a field in the mod XML 
input, e.g.:

<image assetName="faceHairs" filename="hairs_64b.png" number="17" 
dither="false"/>

The builder might even check that the file height is actually evenly divisible 
by the number.

Is there a reason not to change these numbers, e.g. for saved game 
compatibility or whatever? If the soldier faces are just kept in a FaceParam, I 
think it should not matter if the number of elements increases, as long as the 
original images stay in the same order, right? The new images would only be 
used in the randomizer, to make new soldiers with extra variation...

Original issue reported on code.google.com by johan.fo...@gmail.com on 23 Oct 2011 at 4:05

GoogleCodeExporter commented 9 years ago
Save file compatibility is the big issue. Every unit has a seed/body that is a 
31 bit random number, that determines name & appearance. However, I made a very 
silly mistake, and didn't zero-out the unused bits. :( To add extended range, 
takes a version check.

For better or worse, there is a solution to the code. Check for 'version' and 
LAST_NAME_EXT. When version >= 1, it uses the LAST_NAME_EXT bit which double 
the # of potential last names.

You would have to use the same trick to add more face parts.

Which is also why this stuff isn't in the XML - it takes logic to make it work. 
(The zero thing really was a stupid mistake. Oh well.) 

Original comment by leethoma...@gmail.com on 24 Oct 2011 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by leethoma...@gmail.com on 31 Oct 2011 at 11:35

GoogleCodeExporter commented 9 years ago

Original comment by leethoma...@gmail.com on 27 Jul 2012 at 12:01