How to add/mod a race?


Questions, Explanations, Howtos

Temple Termagant

Posts: 7

Joined: Saturday, 3rd December 2016, 21:43

Post Saturday, 3rd December 2016, 22:23

How to add/mod a race?

I doubt it's very practical, but I was wondering how hard it would be to either add a new race, or customize an existing one? How much coding knowledge would be required? The race(s) I have in mind would require several changes, but wouldn't have any traits that aren't possessed by an existing race. Specifically, I was thinking to make a sphinx race using the felid as a base, increasing hp, str, and some magical aptitudes (perhaps helmet-wearing ability?) in exchange for dex, stealth, fangs, and extra lives. How feasible is this?

Crypt Cleanser

Posts: 714

Joined: Friday, 6th September 2013, 09:17

Post Monday, 5th December 2016, 10:39

Re: How to add/mod a race?

It would probably be easier to modify any other race, due to extra lives gimmick. Just change the numerical data/mutations in crawl-ref/source/species-data.h file and equipment restrictions in can_wear_armour() function of crawl-ref/source/item_use.cc. Not much coding knowledge should be needed, just English reading comprehension.

Temple Termagant

Posts: 8

Joined: Wednesday, 19th October 2016, 19:28

Post Monday, 5th December 2016, 20:03

Re: How to add/mod a race?

stickyfingers is right that adding a felid style race is harder, but it's mainly because the equipment restriction code is scattered around. I think I found all the relevant places.

The commit [1] has all the simple stuff to add a new species, and [2] has the extra stuff to prevent armor/weapon usage. This species actually can still wear hats, but if you look at the beginning of can_wear armour you'll see what happens with felids. There was still some minor issue (I think rods on the floor didn't show up gray despite being unusable) but otherwise it was fine.

[1] https://github.com/kovach/crawl/commit/ ... 5e5b5248a8
[2] https://github.com/kovach/crawl/commit/ ... bb930b348b

Temple Termagant

Posts: 7

Joined: Saturday, 3rd December 2016, 21:43

Post Monday, 5th December 2016, 22:35

Re: How to add/mod a race?

Huuh. That all still looks pretty complicated. I barely even know how to compile.

So, I should probably base it off a simple race that still has race muts, like...minotaur or such?

Anyway, for a start...what all do I need to do to create an extra race to be modded? (Also, what's that chimera race? Sounds interesting.)

Temple Termagant

Posts: 8

Joined: Wednesday, 19th October 2016, 19:28

Post Tuesday, 6th December 2016, 00:09

Re: How to add/mod a race?

look through species-data.h, and start by copying one of the blocks. look at vine stalker if you're confused about the mutation syntax. species_def has a comment for each of the fields. the first commit I linked has all the files (you can skip tilepick) you need to modify.

chimera is basically troll+mummy+monstrous demonspawn+slow

Temple Termagant

Posts: 7

Joined: Saturday, 3rd December 2016, 21:43

Post Saturday, 17th December 2016, 17:03

Re: How to add/mod a race?

In the line below SPF_FOO and above MONS_FOO of species-data.h, there's a line of four numbers. It's 1, 0, 0, 3 for human. What's that?

Dungeon Dilettante

Posts: 2

Joined: Saturday, 17th December 2016, 14:27

Post Saturday, 17th December 2016, 17:30

Re: How to add/mod a race?

Shin Majin wrote:In the line below SPF_FOO and above MONS_FOO of species-data.h, there's a line of four numbers. It's 1, 0, 0, 3 for human. What's that?


If you look in https://github.com/crawl/crawl/blob/mas ... data.h#L27, you can see the definitions. If i'm reading it correctly the four numbers are:

int xp_mod; ///< Experience level modifier
int hp_mod; ///< HP modifier (in tenths)
int mp_mod; ///< MP modifier
int mr_mod; ///< MR modifier (multiplied by XL for base MR)

Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.