This post first appeared on Reddit, in the /r/roguelikedev sub-reddit. You may find the original post here.

Settlers now have attributes, that affect their daily lives.

Settlers now have attributes, that affect their daily lives.

Settler outfit composition.

Settler outfit composition.

As usual, my github can be found here: https://github.com/thebracket/bgame

It’s been a pretty productice week, despite traveling for the holidays.

Major items from the changelog:

  • There’s a new item_component type, all items have one. It includes variable data relating to any item. For now, that’s color tint – but it will eventually include quality, material details, etc. Various bits of code were updated to use it.
  • The master inventory list now only updates when something changes (via a message). This wasn’t a performance problem yet, but could very easily become one as I added items/depth to the game – so I took care of it now. (There’s premature optimization, and then there’s incredibly sub-optimal code; this was in the latter!)
  • The “jobs” board properly serializes now, so the settlers keep track of what they were doing – and what needed to be done – correctly between saves/loads.
  • The entire eat/drink/sleep code has been replaced with using the jobs system. A settler whose needs (clocks) are low will be assigned an appropriate eat/drink/sleep code. If the need can’t be met, the settler complains about it (which will grow into consequences later).
  • The “build here” panel now shows the right icon for things you can build. Oops!
  • Settlers embark with a fake campfire kit. It’s powered by a tiny nuclear battery, and can produce tiny marshmallows. It started out as a test item; testing the ability to construct a building, and then have that building fulfill a need, and that need drain power. I liked it, and it seemed like exactly the sort of semi-useless item that a group of settlers might have – so I kept it.
  • A fire axe is now part of the starting equipment line-up. This will very soon be useful for chopping down trees (and killing things, when there’s something to kill!).
  • Settler differentiation – see below.
  • Implemented functions for handling skill checks, and building a tent now requires a skill roll (failure means the settler tries again – so building up skill means faster construction).

Settler Differentiation

This was the bulk of the focus for the week. I consider it pretty important; your settlers need to be more than happy @ symbols if the player is to feel any sort of attachment to them, and also if the B-movie feel of the game is to come to fruition. So, I spent a LOT of time on this one. The first step was ensuring that each settler had differentiating features: age, gender, sexual preference, height, weight, ethnicity, hair color and style, a “profession” (from the useless startig professions list), a name (drawn from a US census list), and appropriate starting equipment for their profession. I also wanted this to be flexible, so not a lot of it is hard-coded (and the parts that are will be less hard-coded soon!).

Behind the scenes, attributes are your basic 3d6 roll (as in the d20 system). I added the ability to put modifiers into the raws. For example, [MODIFIER:Charisma:2] grants a +2 to starting Charisma. I then spent a bunch of time encoding starting outfits for the settlers. For example, the following tag [CLOTHING:Torso:Bathrobe] gives the settler a bath-robe on their torso. There’s gender-specific options, so you can specify CLOTHING_MALE or female to have different clothes by gender. I didn’t want every bathrobe to be the same, so I included a list of colors in the bathrobe definition – along with description and other component tags to make it a real item:

[ITEM]
[ITEM_TYPE:CLOTHING]
[CLOTHING_SLOT:Torso]
[CLOTHING_COLOR:Red:Blue:Yellow]
[NAME:Bathrobe]
[DESCRIPTION:A comfortable, silk bath-robe. Ideal for running a sleazy mansion, pretending to be a wizard, or taking a bath.]
[RENDER]
[RENDER_GLYPH:SHIRT]
[RENDER_COLOR:RED:BLACK]
[RENDER_TILE:SHIRT_MASK]
[RENDER_LAYER:TOP]
[/RENDER]
[/ITEM]

This provides ASCII and graphical rendering information, a color range (for tinting), the clothes slot, a description, and the layer on which it is rendered (important so that it doesn’t take out the floor, or obliterate a structure). Putting all of this together, and you have starting professions listing a full set of clothes, and attribute modifiers. Combined with hair color/style, ethnicity and the rest you have a lot of potential combinations.

The final part was rendering. In ASCII mode, the settler is still an @ – but the information window gives you a rendering of the settler (they are always rendered graphically in tile mode). I created a “composite” rendering system that starts by copying a settler of the appropriate gender, in their underwear (color tinted by ethnicity). Hair is then copied (with a color tint applied), and then clothes for each slot (with torso last, so it can go over other items – such as the bathrobe). The result is a nice variety of settlers! I also tidied up the info window a bit, although it is still a long way from finalized.

Screenshots: