Modding the game

The modding support for House Dominae is feature complete! That begs the question though: why did I even make a modding system? Couldn’t it had waited until after release? Well, maybe, but not really. Custom content has been a high priority item since the day I started working on this game. One of my original design pillars, that’s guided the development so far, is to support any and every character – within reason.

To make that a reality I could do either of two choices: I could come up with and implement every characteristic of every popular character archetype players would ever need… or I could come up with a handful of those and let players fill in the missing pieces themselves. I chose to do the latter.

What’s a mod?

So what do I mean by mod? The word ‘mod’ often refers to some kind of homemade add-on that modifies aspects of a game, usually by loading some kind of code or custom binary. That’s not what I’m talking about here. Because almost all of House Dominae’s content is defined as XML, a mod can be something as simple as a snippet of additional XML that gets loaded by the game alongside everything else.

At first it was just going to be a folder where you would drop xml-files, but now there’s a formalized file format (it’s just a zip file) where you can add some more information about the mod (and its author) and make it a bit more functional and easier to share with other players.

The final piece of the puzzle, that I just got working, was to allow snippets of xml to be attached to character files. That will enable you to create characters with custom traits that are unique to those characters, with custom behavior, without having distribute them as separate mods.

Example: Vampire trait

1. Defining a new trait:

To give an example, I’m going to make a new trait that turns a character into a vampire, capable of drinking someone else’s blood. The first step is to define the trait itself:

<Trait id="vampire" type="bad">
    <Strings>
        <String id="label">Vampire</String>
        <String id="info">[Name] is a vampire!</String>
    </Strings>
</Trait>

Note that the trait doesn’t have any logic or modifiers in it. Rather, the mere presence of the trait on a character allows for things to happen. As you can see, what we’ve mostly done here is to give the UI some text to display.

The vampire trait, associated with a character.

2. Setting some rules:

This step isn’t strictly necessary, but you can and I recommend defining conditional expressions as individual, named rules. This way, should the behavior need to change in the future (for instance, by other mods), it only needs to change in one place. We define a rule stating vampires can suck blood and another rule for potential victims. We make the distinction that vampires can’t suck the blood of other vampires nor animals.

<Rule id="can-suck-blood">vampire</Rule>
<Rule id="has-tasty-blood">not (vampire or animal)</Rule>

3. Adding a new activity:

Next, we create a new activity for sucking blood, because this is how I’ve chosen to express this particular trait. First we need to inform the game when sucking blood is an appropriate action. In this case we want two characters to be in the same room, with one of them being a vampire and the other having ‘tasty blood’, as defined above.

When the activity executes, we raise the vampire’s health by 50 and remove 50 health from the victim. We could choose to do something more involved here using a LUA script but that’d be beyond the scope of this simple example.

Finally, we specify an image query, which is used to find an appropriate image to display. Here we make up a new tag called ‘suck-blood’. (An image with this tag would also need to be added to the vampire’s character file for this to work.) We also add some texts for the UI and the activity output.

<Activity id="suck-blood">
    <Assignment>Any, Any</Assignment>
    <Rule>1:can-suck-blood and 2:has-tasty-blood</Rule>

    <Action subject="1">modify: health, +50</Action>
    <Action subject="2">modify: health, -50</Action>

    <Image>suck-blood</Image>

    <Strings>
        <String id="label">Suck [other:Name's] blood</String>
        <String id="verb">Suck blood</String>
        <String id="output">
            [1:Name] sucked [2:Name's] blood! (It was very refreshing.)
        </String>
    </Strings>
</Activity>
The activity becomes available when its requirements are met.
What a shocking turn of events!

Of course, you can do much more than this with a mod. Everything from items to random events, relationships and sex is described in the same way. I hope I’ve at least demonstrated that adding interesting characteristics and interactions to the game doesn’t require a degree in computer science. Just a basic understanding of XML and plenty of documentation (that I haven’t written yet).

If you have any questions regarding mods, you can ask them on the Discord.