A Code Analysis Postmortem


Last November, I published an article analyzing gender, romance and sexuality in the indie game RimWorld. In it, I decompiled the game, following instructions in the game’s readme and fan-maintained Wiki page in order to look at how the code of the game defined in-game behaviours relating to romance. Hopefully, this postmortem will go over some of the guiding questions that I had, patterns of responses, the current state of RimWorld with respect to the issues I raised, and possible alternatives for the game and for this method. If you haven’t read it yet, I highly suggest that you do, since this will not make much sense without that context.

Queer analyses of video games often centers around analysis of individual characters. That is to say, we tend to try and analyze romance, sexuality, queerness and gender by what we can see on-screen. While useful, this method has various limitations, one of which is its inability to helpfully critique procedurally-generated games that feature romance.

In a procedurally-generated game such as RimWorld, individual characters are not hand-crafted by the developers. Instead, the game generates them and assigns them different qualities based on some set of rules, which are written by the developer. If we were to try and analyze a procedurally-generated game’s cast of characters based solely on what we could see, we would be hampered by a simple fact: it is impossible to be sure if what we see, in this one instance, is what the developer had created or if it was simply a quirk of the (virtual) dice.

For example, if my RimWorld game gave me a colony entirely made up of gay men, that says little about the game, other than that gay men exist, and that I got lucky with the dice-rolling. Because of this, it is very hard to grasp how queerness, romance, and sexuality is being modelled with what we see alone.

Enter critical code analysis. As argued and performed by others like Robert Yang and Mark L. Sample, the code of a game is part of its text. When we critique games, we should not limit ourselves merely to what we see on-screen. Code is intertwined with culture, and reflects the programmer who writes it, so why not criticize that as well?

On top of that, I hoped that publishing the article on a widely-read games journalism website would allow that criticism to reach a wider audience, not to mention the developers as well. However, the responses that the piece stirred up were generally unfriendly. We could broadly generalize these responses to my criticism as follows:

  • The game is unfinished, and therefore, not a valid object of criticism.
  • The game is unfinished, therefore this code is simply a placeholder written without much thought, and not a valid object of criticism.
  • This code accurately reflects how gender and romance functions in reality, in accordance with the developer’s research, so your criticisms are invalid.
  • This code is just a placeholder for how it will be in the future, so the proper target for your analysis is what the developers say the game will be in the future.
  • Because you did not reproduce the code exactly, you’ve made up all of the code, and the entire article is deceptive.
  • Ad hominem attacks.

Nevertheless, none of these criticisms grapple with the substance of my critiques, namely that the code of the game reproduces severely imbalanced sexist understandings of sexuality and gender, particularly queer sexuality.

Nonetheless, it was clear that the developer understood that this exposure warranted some form of response. He publicly claimed that

I just wanted to dispel these false memes here in a centralized place… It’s true there’s an issue in the game where this behavior [bisexuality in men] won’t appear. It’ll be fixed in the next release… A player who sees a female character who never interacts romantically with another female character will interpret that character as straight, and this interpretation forms the only truth of the game.

The implication that code analysis is an illegitimate method of analysis is clear, as is the fact that taking this position absolves him of any responsibility for coding the game with these sets of possibilities. Nonetheless, since my article, there has been one update, and another in the works. So what has changed in the latest unstable version?

In the latest publicly-available testing version, 0.16.6198.16597, I looked in the same areas as I did for my article. I also looked at InteractionWorker_MarriageProposal, which I had not previously; in the previous version, it included this line:

  if (initiator.gender == Gender.Female) { num *= 0.2f; }

A few things have changed: most notably, the sections that I wrote about have become much harder to parse, even though the consequences of the code are practically unchanged. However, the line from InteractionWorker_MarriageProposal is untouched. The sections that I talked about in my original article have been rewritten. For comparison, here is alpha 15’s line regarding likelihood of a pawn initiating romance:

float num4 = (initiator.gender != Gender.Female) ? 1f : 0.125f;

And here is the exact same line in alpha 16 unstable:

 float num4 = (!initiator.story.traits.HasTrait(TraitDefOf.Gay)) ? ((initiator.gender != Gender.Female) ? 1f : 0.15f) : 1f;

As a friend puts it, this is a structural change to the code that results in a logically more complex path to functionally the same result.

There are no longer any bisexual women; that is, if a pawn is straight, they will only be attracted to those of a different gender, and if pawns are gay, they will only be attracted to those of the same gender. Straight women are now 15% less likely to hit on others, as opposed to the 12.5% chance they previously had. There is also an early implementation of some code that changes the likelihood that Pawn A will hit on Pawn B, depending on their genders and if they have the trait “gay” or not. I believe that this is an attempt to create a “gaydar”, where same-gender pawns that have the trait “Gay” will be more likely to hit on each other, and less likely to hit on pawns without this trait.1

Pawns now receive a -3 penalty to mood for having to rebuff a romantic attempt; however, being rebuffed gives a -5 penalty to mood. Coupled with the increased chance for men to initiate romance, the overall effect is still that you deal with more rejected men than the people they hit on.

Age-based attractiveness has had some limited tweaks. However, if we compare diagrams, we can see that how this attractiveness value is determined is practically identical to how it was two versions ago.

What is more important is what has not changed. Penalties for physical attractiveness and ability still exist. The gender-differentiated skewed attractions based on age are still there—men will still overwhelmingly find younger partners attractive, while women still overwhelmingly prefer older partners. The “Gay” trait also eats up a character trait slot (one of three), meaning that gay pawns are potentially less useful or simply less interesting, in gameplay terms, than their straight counterparts. Perhaps what is most damning is that, instead of making substantive changes to RimWorld‘s romance model, the developer has instead chosen to tweak some numbers here and there, while ensuring all this code leads to the same or extremely similar outcomes.

So what alternatives might there be? Two that spring to mind come from The Sims, Maxis’ long-running franchise, and Dwarf Fortress, one of the inspirations for RimWorld. In Dwarf Fortress, each dwarf gets a one-time check based on its species’ [ORIENTATION] tag, which can be changed. By default, it favors heterosexuality. It works as follows:

  • Given a male partner, will this dwarf be interested in being his lover?
  • Given a male partner, will this dwarf be interested in being his spouse?
  • Given a female partner, will this dwarf be interested in being her lover?
  • Given a female partner, will this dwarf be interested in being her spouse?

Thus, a single dwarf has the potential to be heterosexual, homosexual, bisexual, or asexual, and committed to marriage or not for each possible sexuality. This tag takes four arguments, or the likelihood that the answer to each question is “yes”. Fans have calculated that the default values work out to make “71.2% of dwarves strictly heterosexual, 23.8% bisexual, 3.8% aromantic/asexual, and 1.2% strictly homosexual, though this includes preferences that do not lead to marriage.”

In The Sims, from Sims 2 onward there have been some implicitly homosexual characters, and all Sims games have allowed for same-sex romance options. This may well be the most coding-light option, since the game simply makes no checks on recipient gender, or initiator gender at all.

Given just two other alternative romance models, the question is, why is RimWorld coded the way it is? In other words, what does your code allow, imply, anticipate, react to, and lead to in terms of gameplay scenarios? And, on a cultural note, how did the state of popular games criticism get here—to wit, lacking the desire to engage with criticisms of games especially around issues of sex, gender, and queerness?


  1. Although rebuffing (and being rebuffed) gives opinion penalties, this is not itself sufficient to stop continuous unwanted advances. The minimum opinion necessary for romance attempts is 5. The penalty for being rebuffed is -10 to opinion, which stacks up to 5 times, for a maximum penalty of -50. However, a trait such as "Beautiful" gives a flat +40 opinion from everyone else; the thought "Crashed Together" gives +25. The basic social interaction "Chitchat" gives +0.66, and "Had deep talk" gives +15, both of which can stack up to 10 times. So, if a gay female pawn is "Beautiful" and has had a single positive "deep talk" with a male pawn (a total of +55 opinion), so long as the positive talk keeps happening, the male pawn will never stop being able to hit on her.  

Leave a Reply

Your email address will not be published. Required fields are marked *