My First Patch - Face Customizer

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
BoominGranny
Engineer
Engineer
Posts: 85
Joined: 18 Apr 2006 02:16
Location: Wellington, New Zealand
Contact:

My First Patch - Face Customizer

Post by BoominGranny »

Hi Everyone,

This is my first - and im sure far from perfect patch.
This allows you to customize your face (ie change your eyes, chin, gender all seperate from one another)
Let me know what you think.

7/may/06:
Added Set Default button - that saves the current face as your default for new games
Moved Randomize Face - you now randomize your face by clicking on the picture!

10/may/06:
belugas kindly adopted my patch to meet the OTTD coding convention! thx
Attachments
faceselection.png
faceselection.png (4.95 KiB) Viewed 12377 times
face_customizer_4749.diff
(8.75 KiB) Downloaded 566 times
Last edited by BoominGranny on 10 May 2006 06:15, edited 3 times in total.
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Looks promising. However I miss the "Generate face" randomizer button
User avatar
BoominGranny
Engineer
Engineer
Posts: 85
Joined: 18 Apr 2006 02:16
Location: Wellington, New Zealand
Contact:

Post by BoominGranny »

True! I kinda ran outa room for more buttons...
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

yeah looks quite cool :)
BoominGranny wrote:True! I kinda ran outa room for more buttons...
Then make room for them :)
User avatar
jez
Traffic Manager
Traffic Manager
Posts: 158
Joined: 23 Aug 2003 21:24

Post by jez »

Looks great :-) The 2 things I'd say are, as before, the random generator button should stay in the same way that it works now, and a Save/Load face would be great.
=== Jez ===
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

BoominGranny wrote:True! I kinda ran outa room for more buttons...
then make the window bigger :wink:
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7595
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

A button the width of the window beneath the face may be just fine.
Image
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

actually I'm not sure I like your window (now is the time to speak your mind :wink: )
I think it would be better if it could move though the list of stuff using the same style as in the news settings window. Also, as mentioned before, the old random face is missing. To make the arrow buttons and stuff, you need to make the window larger, which is ok.

I think it's a nice window for a first try. The window stuff in OpenTTD is not the nicest you can find. I can remember when I made my first window. It took days, but that was also because it was the autoreplace window, so I had to add support for two vertical scrollbars and some stuff regarding the pulldown menu. (tip: always start with something simpler than that)
User avatar
BoominGranny
Engineer
Engineer
Posts: 85
Joined: 18 Apr 2006 02:16
Location: Wellington, New Zealand
Contact:

Post by BoominGranny »

Good points Bjarni, i've since added the Randomizer back into the window.
I know what you mean by in the message window - thouse left/right buttons? <= => they would work well. At least now you have some control over your face. The problem i have is that the face structure is all over the place so to implement buttons at all i had to set some bits randomly (thats what i did for the eyes) and to set the skin colour i just toggle 3 bits between 0 and 1 to get the skin colour to change, but without the exact structure of how the face works this is the best i (As a rookie C developer) can come up with.

structure as ive figured so far:
32 bits

123=don't seem to do anything
45=chin
6789=eyes/eye brows
10,11,12,13,14,15=mouth/nose
16,17,18,19=hair (also effects skin sometimes!)
20,21,22=clothes/eye colour
23,24,25,26,27=clothes (also effects skin sometimes!)
28,29,30=glasses
31=gender
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

tie is counted seperate from jacket, you have eyes, and eye colour(remap), i think you also have hair colour(remap)
i can't remember everything, and i can't check because i am at work, and everything i used to make my avatar(which gave me a really good look at the faces sprites) is at home.

basicly saying make the eyes and the eye colour, and the hair and hair colour seperate, also, if possable, things like the hair, it kinda looks stupid to have some parts 1 colour, and other parts another, any chance on getting it to make all hair the same colour?
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
User avatar
PouncingAnt
Transport Coordinator
Transport Coordinator
Posts: 357
Joined: 09 Nov 2004 22:33

Post by PouncingAnt »

Your work seems very promising so far!

Ganbatte! (go for it)
NB: the below challenges are still open for submission, so feel free to perform necromancy on them!
Try the PouncingAnt National Monopoly Challenge
Or even better, the PouncingAnt National Monopoly Challenge 2
Or better still, the PouncingAnt National Monopoly Challenge 3
Or, the PouncingAnt National Monopoly Challenge 4

Or try my scenario instead!

-(A lazy) OpenTTD Japanese Translator-
-(A lazy) PNGcodec user-
"You get what you pay for, so pay attention!"

Patches:
Company Station Stats
Archonix
Chief Executive
Chief Executive
Posts: 733
Joined: 01 May 2003 17:29
Location: Manchester, UK
Contact:

Post by Archonix »

bobingabout wrote: basicly saying make the eyes and the eye colour, and the hair and hair colour seperate, also, if possable, things like the hair, it kinda looks stupid to have some parts 1 colour, and other parts another, any chance on getting it to make all hair the same colour?
It's realistic though. I have ruddy hair and yet a blonde beard*. My dad had black hair and a ginger mustache. Genetics... fun. :)

*Actually it's more complicated than that. I have a blond streak that runs across the top of my scalp, which splits in two and runs down both sides of my mouth. If I had hair over my entire face it'd run down to around the bridge of my nose and then split there, as far as I can tell.
Brignell’s law of consensus: At times of high scientific controversy, the consensus is always wrong.
User avatar
scrooge
Engineer
Engineer
Posts: 51
Joined: 13 Jun 2004 12:06
Location: Iceland
Contact:

Post by scrooge »

Hehe, this is the first thing I remember thinking should be fixed, some seven years ago :)
Great work :D
User avatar
BoominGranny
Engineer
Engineer
Posts: 85
Joined: 18 Apr 2006 02:16
Location: Wellington, New Zealand
Contact:

Post by BoominGranny »

jez wrote:Looks great The 2 things I'd say are, as before, the random generator button should stay in the same way that it works now, and a Save/Load face would be great.
done! :wink:
bobingabout wrote:tie is counted seperate from jacket, you have eyes, and eye colour(remap), i think you also have hair colour(remap)
i can't remember everything, and i can't check because i am at work, and everything i used to make my avatar(which gave me a really good look at the faces sprites) is at home.
are you able to find this out for me when you get a chance and post it here? would be very helpful!
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

what i found out was simply by looking at the grf file decoded by GRFCodec. you'll probably be able to find out more by reading the code, but the only problem there is if its not well documented, knowing exactly what it does.

next time i'm on my laptop, I'll try and get a copy of the faces section uploaded for you to look at.

reason i know eyes and hair are remapable is, all eyes are (remap) blue, and all hair is black(IIRC). therefore, it shouldn't be too hard to make sure when it creates hair, eyebrows and facial hair, that it creates them all of the same colour.

also, you should be able to fudge in more tie colours by using the blue tie(like in my avatar) as a remapable version.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

BoominGranny, I noticed your changes just because now there is a green background behind the face, but please write a post about that so everyone may notice it easily
User avatar
BoominGranny
Engineer
Engineer
Posts: 85
Joined: 18 Apr 2006 02:16
Location: Wellington, New Zealand
Contact:

Post by BoominGranny »

Changes:
7/may/06:
Added Set Default button - that saves the current face as your default for new games
Moved Randomize Face - you now randomize your face by clicking on the picture!
(please use the diff on my first post - it has been updated with these changes)


MeusH - sure thing :) i'll remember for next time! i just didn't want to "SPAM" people about my patch...

bobingabout - when im at home i will try and have a look at how this colour mapping works in the file that draws the face... it was really confusing code the first time i looked at it... then i can perhaps redo the face drawing code and then have the face number so it includes the colours of face objects and makes a bit more sence (i will make the skin tone have its own bit - infact maybe i will make it 3 or 4 bits so there can be a few skin tones in there....)
User avatar
jez
Traffic Manager
Traffic Manager
Posts: 158
Joined: 23 Aug 2003 21:24

Post by jez »

BoominGranny: The set default thing is good, but even better would be a dialog letting you save to a certain filename and load from a certain filename, much like the save/load game dialogs. Would it be possible to do that?
=== Jez ===
User avatar
BoominGranny
Engineer
Engineer
Posts: 85
Joined: 18 Apr 2006 02:16
Location: Wellington, New Zealand
Contact:

Post by BoominGranny »

if you want to be able to save it for good:

open your openttd.cfg (after you've hit set with my patch)

look at the line near the very top under [misc]:

player_face = 594158407

copy the number and that is your players unique face value.

Perhaps i could make the screen so it shows it to you and allows you to enter it? It would be overkill imo to make a save/load just for a one number - its already saved in the savegame...
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

well, the save/load i would want is press save, and it brings up a save face window, then you can enter a name, like for me Tash, then when i play again, instead of creating a new face, just press load and load the face Tash...

however, the unique number thing isn't too hard to do either.

about the face, it'll probably be easier for you to extract the files yourself, download GRFCodec
http://www.ttdpatch.net/grfcodec/
follow the instructions and use the command grfcodec -e trg1.grf, It'll create a PCX and somwhere in there will be the faces, just look for them. Problem is windows XP doesn't open PCX files by default, so, you might want to convert them using infanview. you should be able to come up with something good,

and maybe with the help of peter, or, someone else, add a NewGRF support for new face features? also, the ability to load a PNG file for the face is a good idea, you could have your freaky avatar ingame :P
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 13 guests