Ludeon Forums

RimWorld => Mods => Help => Topic started by: joaonunes on May 23, 2016, 05:44:46 PM

Title: HeadDefs or anything similar exist?
Post by: joaonunes on May 23, 2016, 05:44:46 PM
Hello!

Recently someone created a request for a mod that adds mustaches to RimWorld, and I decided to give it a try, even though I never had any previous experience and have no idea on how RimWorld's modding works (although I am familiar with XML and c#, avoiding the latter). I am off to a great start xD

The problem is while there are Defs that allow adding hair to the game the same does not happen to faces, or does it?

Can anyone help me out on this one? Is there any way to add faces to the game or am I only allowed to edit the already existing ones? (editing texture files works, I tested it :P)

I thank you in advance for any attention given to this thread.

EDIT:
UNLESS... I use the already existing HairsDefs and extend the png to also have a mustache, plus I could couple hair types with the different mustaches :D

EDIT2:
Nope... that would mean that when a pawn equipped a hat the mustache would also disappear...
Title: Re: HeadDefs or anything similar exist?
Post by: joaonunes on May 24, 2016, 08:13:19 AM
I guess it would be safe for me to assume that there is no way to ADD new heads to the game...
Title: Re: HeadDefs or anything similar exist?
Post by: 1000101 on May 24, 2016, 12:30:36 PM
I don't know specifically how heads are stored and referenced, but you could look at EdB's Prepare Carefully.  PC has the option of changing the pawns head so, you could look at that and from there see how to inject new heads.
Title: Re: HeadDefs or anything similar exist?
Post by: joaonunes on May 24, 2016, 12:38:06 PM
Quote from: 1000101 on May 24, 2016, 12:30:36 PM
I don't know specifically how heads are stored and referenced, but you could look at EdB's Prepare Carefully.  PC has the option of changing the pawns head so, you could look at that and from there see how to inject new heads.

You are a genius, why didn't I think of that xD Will check it right away!! (when I get home, I am at school atm)
Title: Re: HeadDefs or anything similar exist?
Post by: Fluffy (l2032) on May 24, 2016, 12:41:24 PM
heads are a tricky case - they're loaded from the correct folders, but are by default not moddable. The methods that look for head graphics only look in the bundled .asset files - so only vanilla assets. I've made a minimod for Simon's mod variety pack in the past, odds are that still (mostly) works. There should be an "AllowModdedHeads" dll somewhere in MVP, you could try if it still works, or if it doesn't see what needs to be done to make it work.

(Or you could wait for me to do it, but htat might be a while :P)
Title: Re: HeadDefs or anything similar exist?
Post by: joaonunes on May 24, 2016, 12:55:53 PM
Quote from: Fluffy (l2032) on May 24, 2016, 12:41:24 PM
heads are a tricky case - they're loaded from the correct folders, but are by default not moddable. The methods that look for head graphics only look in the bundled .asset files - so only vanilla assets. I've made a minimod for Simon's mod variety pack in the past, odds are that still (mostly) works. There should be an "AllowModdedHeads" dll somewhere in MVP, you could try if it still works, or if it doesn't see what needs to be done to make it work.

(Or you could wait for me to do it, but htat might be a while :P)

The image I am currently using on my profile was taken from a screenshot, and the screenshot was taken after replacing the vanilla textures with textures that also contain a mustache, just like what was done in this mod:
https://ludeon.com/forums/index.php?topic=9505.0 <--this mod edited the eyes, I added a mustache.

Will look at that mod and see what I can figure out from that.

EDIT: That mod DID add beards and mustaches. Cool :D now I must find out how
Title: Re: HeadDefs or anything similar exist?
Post by: joaonunes on May 24, 2016, 01:35:27 PM
The .dll is not working, and I can't see what needs to be done by looking at it's code... Unfortunately I don't know much about the code used by this game, the reason I tried to stay away from c# in the first place...

I'll try to see if I can do something at all, but if you can I would deeply appreciate your help Fluffy :)

And thanks to everyone for helping me out!

EDIT: Been a while since the last time I touched c#, but visual studio is already throwing some errors :P Will try to fix them as best as I can
Title: Re: HeadDefs or anything similar exist?
Post by: joaonunes on May 24, 2016, 02:47:57 PM
Holy shit, it is working!!! The dll is working :D:D:D
The error was easily corrected and finished crafting some mustaches, the mod is ready for release.
All I need now is permission from Simon to use his dll, already sent him a PM :D
Title: Re: HeadDefs or anything similar exist?
Post by: joaonunes on May 24, 2016, 08:57:54 PM
Quote from: Fluffy (l2032) on May 24, 2016, 12:41:24 PM
heads are a tricky case - they're loaded from the correct folders, but are by default not moddable. The methods that look for head graphics only look in the bundled .asset files - so only vanilla assets. I've made a minimod for Simon's mod variety pack in the past, odds are that still (mostly) works. There should be an "AllowModdedHeads" dll somewhere in MVP, you could try if it still works, or if it doesn't see what needs to be done to make it work.

(Or you could wait for me to do it, but htat might be a while :P)

So who made the dll? You or simon?
Title: Re: HeadDefs or anything similar exist?
Post by: Fluffy (l2032) on May 25, 2016, 01:46:54 AM
that'd be me. Feel free to use it ;) (Also, can you send me a copy of the (updated) source code? I'll put it back in my minor mods thread, with credits to you + a link to your version with the new mustaches etc.)
Title: Re: HeadDefs or anything similar exist?
Post by: joaonunes on May 25, 2016, 02:47:15 AM
Quote from: Fluffy (l2032) on May 25, 2016, 01:46:54 AM
that'd be me. Feel free to use it ;) (Also, can you send me a copy of the (updated) source code? I'll put it back in my minor mods thread, with credits to you + a link to your version with the new mustaches etc.)

Of course ;D and thanks!
Title: Re: HeadDefs or anything similar exist?
Post by: joaonunes on May 25, 2016, 03:43:01 AM
Mod released:
https://ludeon.com/forums/index.php?topic=20408.0

Once again, I thank you both for helping me achieve this goal :D
Title: Re: HeadDefs or anything similar exist?
Post by: 1000101 on May 25, 2016, 04:29:45 AM
Have you considered a slight change in your method of handling facial hair?  Instead of replacing the entire head, add two additional layers (moustache and beard).  This will allow more flexibility in the combinations although it will add some complexity to the code.

Anyway, nice mod, I'm glad my meager input could be helpful (although I suspect that fluffy was far more help in this matter ;) ).
Title: Re: HeadDefs or anything similar exist?
Post by: joaonunes on May 25, 2016, 04:45:48 AM
Quote from: 1000101 on May 25, 2016, 04:29:45 AM
Have you considered a slight change in your method of handling facial hair?  Instead of replacing the entire head, add two additional layers (moustache and beard).  This will allow more flexibility in the combinations although it will add some complexity to the code.

Anyway, nice mod, I'm glad my meager input could be helpful (although I suspect that fluffy was far more help in this matter ;) ).

That is actually a great idea, but it would be only be useful to add more diversity. I tried to match each mustache type with a head that "fits" it.

And yes, you were helpful. While not as helpful as Fluffy (which provided me the assembly) you pointed me to a good idea and scavenging EdB's code did help me remember my c# classes :P


That is a great idea though!! I will see if I can do something about it, but it'll take much longer than it took me to create this mod :P
It should require me to have mustaches with the same size (in pixels) as the heads, and be placed in the correct position to be ready for the merge. Then the mod would load all the heads and mustaches and for each head it would create multiple copies, each with it's own mustache, merging the images so they would look like separate heads and then load them all to the game.
The only problem I can think of is that the game could slow down a bit on startup to create all the heads, and for that objective it would be easier for me to create all the heads from the start.
This idea would work perfectly if the game already had a layer similar to the hair called "facials" or "menhair"...

That reminds me... did vanilla have only one layer of clothing? because I think apparello added more layers, and looking at it's code could help me achieve that :D
Title: Re: HeadDefs or anything similar exist?
Post by: 1000101 on May 25, 2016, 04:53:51 AM
Quote from: joaonunesThat is a great idea though!! I will see if I can do something about it, but it'll take much longer than it took me to create this mod :P

That's software development.  You get the basic implementation and then some arsehole comes along and says, "you know..."  ;)

But now you have a skeleton to build on.  That is always the most important part.  Skeleton first, then meat.
Title: Re: HeadDefs or anything similar exist?
Post by: joaonunes on May 25, 2016, 05:48:45 AM
Quote from: 1000101 on May 25, 2016, 04:53:51 AM
Quote from: joaonunesThat is a great idea though!! I will see if I can do something about it, but it'll take much longer than it took me to create this mod :P

That's software development.  You get the basic implementation and then some arsehole comes along and says, "you know..."  ;)

But now you have a skeleton to build on.  That is always the most important part.  Skeleton first, then meat.

except I'm trying to add a new limb and not just flesh xD We'll see how this goes. In the next two weeks though I'll be filled with school work so I won't be able to develop much...