[A15] [A16] Humanoid Alien Races v0.9 (01.01.2017)

Started by Cpt.Ohu, August 16, 2016, 05:30:01 PM

Previous topic - Next topic

Cpt.Ohu

Humanoid Alien Races



Description:

This mod contains a DLL which allows for creating humanoid alien races with unique graphics. Current features include:

             Features in 0.5
             - Custom head textures
             - Custom body textures
             - Custom skin colors
             - Custom hair colors
             - Custom gender distribution
             - Use of pawn-specific backstories

             New in 0.7
             - Forced Race traits
             - Race Restricted Apparel
             - Custom Backstories

             New in 0.8
             - Patch for Prepare Carefully

I tried to make it as modular as possible. Every part of the graphic set is defined in a Race ThingDef. Every entry that's left empy results in the use of vanilla assets.

For now, this is not a content mod and more of a framework to do your own modding. I have defined one example race, the reddish, horned Devilmen, just to show how the code is to be used (Look for the Devilman-Drifter in the console). Descriptions of each new ThingDef entry are included.

As of this version you can define colonists of your alien race that may be part of your starting party. It's based on a new PawnKindDef, an example is included in the mod.

The rest is up to your creativity: Fantasy races like Elves, Dwarves and Orks; Sci-Fi races like Asari, Klingons, Gungans ( :P ); eldritch beings like Deep Ones; or greenskinned and leaf-sporting mutants.

Just remember that this is for graphics only!

New Features

Race-restricted apparel:
A simple ThingComp that allows you to assign this piece of clothing to a specific race. Other race-members won't be able to equip it. This enables the creation of body- and head-types that can stray as far as you want from the vanilla shapes.

Race specific traits: You can define traits that EVERY member of this race WILL spawn with. This isn't ideal as it takes up a trait-slot, but since most traits that go in here will probably be rather powerful, I'd call the tradeoff acceptable.

Modified version of Prepare Carefully:
The patch I included is actually a standalone-version specifically for my framework, and only ONE version should be active at any time. It is near impossible to create a real patch, since the original code is focussed entirely on humans and defines a lot of stuff globally that had to be broken down to individual pawn level if anything other than humans are to be included.
DISCLAIMER: This also means that this version of Prepare Carefully is NOT compatible with presets of other versions. Your colonists won't be loaded in properly.

How it works
I'm detouring the GenSpawn spawn methods, which is the point where pawns are placed on the map. After a pawn is randomly generated by the game, my custom spawn method converts it into a subclass that updates the graphics according to the new entries in the race ThingDef. This has to be done because the base game locks certain pawn characteristics like skin color. These are still stored on the pawn, just not displayed.

As of 0.7, there are 2 new detours I had to include in order to keep everything working. First one is FloatMenuMakerMap.AddHumanlikeOrders, which enables race-restricted apparel. Second is InteractionWorker_RecruitAttempt.DoRecruit because the base code overrides any race-definition when a pawn is recruited, due to it being converted to the BasicMemberKind of the player faction.

Author/Mod Team
Cpt.Ohu

Downloads
Release 0.8 [A15]


Release 0.9 [A16]


Prepare Carefully Patch [A15]

No longer requires CCL:
The Detour-Code as well as the ability to add custom backstories is now part of the mod. Credits go to the creators of CCL and 1000101 in particular.

How to install:
- Unzip the contents and place them in your RimWorld/Mods folder.
- Activate the mod in the mod menu in the game.

Acknowledgements
Killface, joaonunes and Fluffy: Without looking into their injection code and approach to detouring, this mod would never have come to be (Mustaches are awesome)
Haplo: The framework for my custom pawn class is inspired by the MAI pawn and robots.
Erdelf: He was the one who started updating the mod for A16 before me and helped me in progressing.

EdB: Prepare Carefully is a gamechanger and in my view should really be included in the main game.

There may be snippets in the code that I haven't credited here because I can't remember whether they are from another mod, so please notify me if you find anything that needs to be mentioned.

Limitations / Things to do
I have no prior experience with C#; back when I learned programming, it was on Turbo Pascal. Because of that, the code is probably far from ideal. Some things have to be considered when creating custom graphics:

- Any base apparel in the game was designed for the vanilla body/head textures. So if you design a head or body that strays too far from the human form, you have to create new clothing for your pawns, otherwise there will be clipping.

Licence

As this is basically a helper-dll, you are heavily encouraged to use it for whatever ideas you're working on. Just mention that you've used this framework as a basis.

The source files are included, and you are free to edit whatever you like about them, especially if you want your custom pawns to have unique gameplay features.

kaptain_kavern

Quite promising! Thanks I will definitively dig into this  :D

Diana Winters

#2
Well, I tried to use this for my Orassan mod; couldn't get it to work properly :/

Edit: I was able to coerce it into working after restarting 3+ times >_>

Question: how would I package this with my mod?

Cpt.Ohu

Well, just distribute both your tail-assembly and the alien race assembly. Alternatively link this mod as a perequisite, though I would recommend against it.

Sorry to hear it took so long to get it working. May I know where you had problems? If it's got something to do with the code itself and not the XML editing, I'll have to look into it.

Helixien

Couldnt you have released that a bit sooner? I bothered mrofa on the slack the whole weekend for my Asaris xD
Nice work however!


AtomicRavioli

I managed to get it up and working for my (wip) Crystalloids after messing around a little.


Diana Winters

#6
Quote from: Cpt.Ohu on August 17, 2016, 03:54:34 AM
Well, just distribute both your tail-assembly and the alien race assembly. Alternatively link this mod as a perequisite, though I would recommend against it.

Sorry to hear it took so long to get it working. May I know where you had problems? If it's got something to do with the code itself and not the XML editing, I'll have to look into it.


Just putting your assembly in my mod's assembly folder doesn't seem to work, unfortunately

Cpt.Ohu

Quote from: Diana Winters on August 17, 2016, 02:48:17 PM
Just putting your assembly in my mod's assembly folder doesn't seem to work, unfortunately

Hmm, that's odd. Normally any dll placed in the assembly folder should be read. Could you by any chance let me take a look at your WIP? If so, send me a PM. It's difficult doing troubleshooting with so little information.

Dryerlint


Cpt.Ohu

#9
Once again, this escalated quickly ^^

The social component should be working and at least via console you can set an alien and a human as lovers. Captain Kirk would be proud. However I'm not sure whether this relation can develop naturally, I haven't played with alien colonists for long enough.


And a small oversight on my part: For repackaging the assembly with your own mod, you also need to include the Initializer from the ThingDef folder, otherwise the detours aren't initiated.

Dragoon

Quote from: Dryerlint on August 18, 2016, 04:52:15 AM
So are they bangable or what?

Hey hes just asking what we are all thinking. In all seriousness thanks for making this mod!
Quote from: faltonico
I truly can't understand that sense of balancing a LOT of modders have, pouring more resources on something doesn't make it more difficult, but more annoying. It is not engaging, even if i'm swimming in silver at late game ¿why to bother?, why all the effort to get there?.

Diana Winters


Diana Winters

Quote from: Cpt.Ohu on August 16, 2016, 05:30:01 PM

- For now, the method for drawing custom alien head textures does not differentiate between male/female. I will probably improve this within the next week.


Are you still working on that?

SpaceDorf

Quote from: Diana Winters on September 01, 2016, 05:55:06 PM
Quote from: Cpt.Ohu on August 16, 2016, 05:30:01 PM

- For now, the method for drawing custom alien head textures does not differentiate between male/female. I will probably improve this within the next week.


Good Question, Maybe he is waiting on CCL like everybody else.

Are you still working on that?
Maxim 1   : Pillage, then burn
Maxim 37 : There is no overkill. There is only open fire and reload.
Rule 34 of Rimworld :There is a mod for that.
Avatar Made by Chickenplucker

Onion

I've been working on creating new races with this (amazing) mod and I don't think the male/female issue is a problem, at least for me.  You can set gender distribution to 1.0 in the ThingDef and create two 'races' per species, one male and one female, and have the AlienPartGenerator use either the male or female head types.  Then you just have to copy and paste your PawnKindDefs and make half have the race '---Male' and the other '---Female'.  You can copy the label and description so they appear as the same race in game. 

I could see how this could be a hassle for some but I definitely prefer it this way - it allows me to give different stats to either gender if I want and it lets me add extra gender-specific descriptions to the stats page.  That might not be important for humans but when making alien races it gives me an extra opportunity to try and put in a little lore.

I messaged Cpt. Ohu to ask about his plans in continuing this mod and he told me that the eventual A15 release will have the ability to make traits race-specific, which I'm super excited about.  If anybody hasn't been paying attention to this mod they should really take a look at it!  :)