Best Practices: Gender Swap Variables

I know there’s some information out there: blog posts and templates. I’ve been kind of failing forward, writing gender-swappable player-sexual romantic options for my game. I thought I’d try to one-source questions and findings to make it easier for anyone who wants to give it a try.


A) It takes much longer to write.

Doing all pronouns for all characters slows me down quite a bit, especially in intensive passages. Having done it for more than 350k words now–so, I’m faster than I was–I can say a typical passage can take me half again as long. My editing time is easily doubled, since I tend to have to do a pass solely for this. This, for me, means I can write 1,500 words in the time I usually could write 2,000; I can edit 1,000 words in the time I can usually edit 2,000. Taken over hundreds of thousands of words and months, it can really add up.

B) It takes more words to go the same distance, plot-wise.

This is because of parallel events or descriptions. e.g. I often have to write both male and female outfit descriptions. Also, one word can end up being a fly in the ointment for a male versus female description. Is their chest hard of soft against you? Believe it or not, it can throw off how and whether someone is attracted to a character. And vary by gender. So you end up coding swaps for adjectives, or I did anyway.

C) Gender extends to MUCH more than pronouns.

This is eye-opening and insidious. But names for common objects sometimes have gender, enough to break immersion with misuse. e.g. perfume versus cologne. Clothing is especially rough. You’ll want to pay special attention to this. It makes me wonder if gender swap is even possible in a language like Spanish where objects have gender attribution. In addition, sexist or not, some actions don’t read the same having a man and woman do it. Societally either. E.g. two men boxing behind a bar in medieval times might be treated differently by the magistrate or passersby than a man and woman boxing. Or what people find attractive.

D) You'll save thousands of keystrokes with gender-neutral names.

I have some characters, like Saz, whose name stays the same whether they’re male or female. Trudy, however, becomes Rudi if you designate that the character should be male. The additional key strokes across the breadth of my work is enough for me to wish I’d chosen all gender-neutral names.

E) If you do it, it's easier to do it from the beginning.

I’ve coded gender swap both progressively and retroactively now. It’s easier to do it right in the first place. It took me almost 2 weeks of 2-5hrs/day to retrofit 250,000 words. It’s tedious enough that I almost quit because of it. Not so bad when you spread it out.

F) Some pronouns are trickier than others.

EX: Male possessive is “his,” female “her.” Male object pronoun is “him,” female “her.” A sentence like: “he took his coat upon him” can play wrong easily. Or if you use it at then end. “The coat was his” works, but not “the coat was her.”

G) Mass replace can save time but is dangerous.

H) Contractions don't need dedicated designations.

${bob_he}'ll works for male or female, resulting in “he’ll” or “she’ll.” ${bob_he}'s works too: “he’s” or “she’s.” Contraction, not possessive.


1) What do I do about clunky prose when I have two characters in a scene and either character may be either gender?

The problem, here, is that even if I code the swap for gender pronouns, “she” will refer to both characters 25% of the time. What I end up doing is using full names for clarity which becomes belabored. The time-consuming and accurate thing seems to be elaborate *if (characterA_gender = “male”) AND (characterB_gender = “male”) Excessive use of this will push me past the ideal playthrough length to word count length ratio.

2) Are there trade secrets about sexual descriptions when NPC and PC genders are both interchangeable?

I’m guessing intimate generalization is the way to go for streamlining, focusing on recap or emotion rather than precise physical description? Is this considered lazy writing? More often, I have written 2-4 scenarios. 2 when the NPC gender doesn’t come to bear, and 4 when it does.

I hope this helps someone. I can make this page a wiki if enough people have things they want to add. Cheers!


Reading points B and C makes me realise just how much work is ahead of me, just in that department alone!

On point D, I might be misunderstanding something, but are you using multireplace to insert the characters name depending on their gender?
If you have a variable for the characters name (e.g. ‘Baker_name’), then you can just set that to ‘Trudy’ or ‘Rudy’ depending on the gender choice; then just call ${Baker_name} whenever you need to.

On point F, I think you might just be missing some pronoun combinations. This is what I currently have (I might simplify the variable names when it comes to having to write them out so much).

*if Gender = 1
    *set AcademicGender "Male"
    *set A_HisHers "his"
    *set A_HisHer "his"
    *set A_HeShe "he"
    *set A_HimHer "him"
    *set AcademicName "Hamish"
*if Gender = 2
    *set AcademicGender "Female"
    *set A_HisHers "hers"
    *set A_HisHer "her"
    *set A_HeShe "she"
    *set A_HimHer "her"
    *set AcademicName "Bonnie"

A few tips for speed to people starting out doing this:

  • Use short variable names. For example, for my most common gender swap (Ortega), I simply use ${he}, for my next one (Mortum) I use ${mhe} and so on with ${che}, ${hghe}, ${hhe} with the short prefix identifying who it is. This makes it really fast to type, there’s not much difference in typing speed for me at this point. It also makes it easy to read the code.

  • Gender neutral names really do help. I do have Julia and Ricardo Ortega, but since they use the last name most of the time, it matters.

  • The little details do matter, but if you have a writing style that relies on a lot of physical descriptors and gender variables, it will help a lot if you add a shorthand label for that. For example, I have variable henchmen (Rosie and Bo) who are different people but fulfill the same role, thus they often get a different text. Instead of having to type *if hench_name = "Rosie", I have a variable called “rosie” set to true if she’s the recruited person. Thus I can write *if rosie instead and save a lot of time.


+2, using a Boolean is also much less prone to error. You can’t accidentally type if hench_name = "Rosi" and get odd issues that can be hard to debug.


Another fun, exciting reason to use singular they for your variable names: the object and possessive forms are totally distinct (example sentence taken from the pronoun dressing room):

That smile of theirs really makes me happy. I could talk to them all day although they don’t talk about themself much. I wonder if their day has been wonderful. I hope so!


That smile of hers really makes me happy. I could talk to her all day although she doesn’t talk about herself much. I wonder if her day has been wonderful. I hope so!

Or the masculine:

That smile of his really makes me happy. I could talk to him all day although he doesn’t talk about himself much. I wonder if his day has been wonderful. I hope so!

My pronoun initiation code block in my WIP looks like this:

Block of code ~10 lines
*create they     "he"
*create their    "his"
*create them     "him"
*create theirs   "his"
*create themself "himself"
*create theyre   "he's"
*create are      "is"
*create were     "was"
*create theyve   "he's"
*create have     "has"
*create plural   false

The boolean flag is what I use for multireplace for verb forms, when distinguishing between plural verbs for singular they and the more usual singular verbs.

Surely you want to know who ${h_they} @{h_plural meet|meets} with.


Yes! I always advocate for this as well.

And I usually show it like this, when trying to convince people:

They — He — She
Them – Him - Her
Their — His – Her
Theirs - His – Hers


Seconding the gender neutral names comment and I think next time I’m making something I will use “they” as the default - currently I use “he” because the “hers”/“theirs” pronoun doesn’t come up very often but as @Hazel says, it’s easier not to have to think about it at all.

I would suggest having a look at Werewolves: Haven Rising or Heart of the House as they have pretty spicy content for variably-gendered PCs and NPCs.

For me in general, I tend to elide over an abundance of physical detail and focus on emotions or how the NPC or PC are behaving/expressing whatever they’re feeling (caveat - none of my CoG projects are particularly explicit, certainly not as much as either of the ones mentioned above). I do think there’s a lot of room for spicy content without (with apologies to Terry Pratchett, which was where I read this expression first) going straight for “insert tab A into slot B”.


Absolutely. There’s clearly a certain element of personal coding preference to this, but if I had to type or cut-paste “breden_herhim” or the equivalent every time I was writing about a genderflipped character, I’d never have finished. And Notepad++ can only hold so many macros as shortcuts for typing out common variables.

I wish I’d done this. :slight_smile: Like Malin I based mine on ${he} with single-letter variations for different characters. I initially tried to write without using “his/hers/theirs” at all for the genderflippers, but failed and finally added ${hers} as the base pronoun there. If I were coming to it fresh, I would totally use ${they}.

Having a Boolean also makes it easy to use multireplace. If you’ve got a person-of-hench who could be either Rosie or Bo, @{rosie Rosie's text | Bo's text} does the same thing as

*if rosie
  Rosie's test
*if bo
  Bo's text

in a more compact way.

Some writers will still find the latter easier to read/check, so I’d caution against an efficiency-above-all approach here. I find a multireplace with lots of numeric options can be a headache to parse and thus risks generating errors; I’m sure some authors will have the same reaction to multireplace in general. But speaking personally, multireplace with Booleans has made my life substantially easier – especially once I added a macro to spit out the @{ | } so I don’t have to slow down to type the less common/familiar* keyboard characters every time.

`* for non-programmers like me!


I use Cntrl+F to edit passes on just gender-swap pronouns. This allows me to jump between all instances of each methodically with an eye dedicated to it. Plus, when editing, I need to change the way I read just to see things sometimes–I become blind to my own errors. Then, I do a regular read for prose edit.

I definitely am. I just listed the one I get wrong the most. I wouldn’t say often. But 2-3x/30-40k words I’ll have a “him” where I should have a “his.” People come up with their own short hand, but I use ${bob_pos} in place of “hisher” to save on keystrokes. “Pos” is short for “possessive.” I also use the default gender for each of my characters as the base code. i.e. “saz_he” but “trudy_she.” These are the genders the characters default to if the player doesn’t set them all to one gender or the other. Though not the most consistent, it helps me as a writer hold onto my primary notion of the character. I do a few other suboptimal coding things for this reason.

I underestimated a few things wrt parallel passages. I didn’t do a great job listing them. There’s bodies and outfits. Some things don’t swap out, so you need booleans, i.e. make-up or facial hair. I found some things don’t read well with a pure swap. For instance, I have a character who makes flirtsy ridiculous threats which read funny and cute as a female but domestic violence-y as a male. I have a different character who is a widow/widower. And another who is intermittently possessed by the spirit of their dead wife. Because all of my ROs are player-sexual it alters the perception of those NPCs to have set genders for ex-spouses. And changes the dynamic–e.g. who carried the child. Or did they have to adopt. Biologically speaking. So that changes character history. I still feel like I’m not getting it all, but this is some more of it.

Thanks! I’ve read the latter. I was really impressed, actually, with Nissa’s mastery of language in general, but also the way she used those generalities and emotional recapitulations to navigate those situations. Bold captain in choppy waters. I’ll have to check out the former. Hear it’s more overtly erotic.

I agree completely. I think readers tend to be more empathetic. People looking for tabs and slots probably gravitate toward more visual mediums. I was impressed with how you handled gender swap in CdlC. A setting with so much etiquette seems like it would compound gender-swap difficulties well beyond pronoun replacement. Social expectation and what not.

So many tactical hacks shared. I really appreciate it.

I would have saved myself a lot of heartache if I had things like this ironed out early. Unfortunately, I’m the type (pantser, not plotter) to figure out things as I go. And I get stuck with some suboptimal solutions I winged in the moment. I wonder if gender-swap isn’t easier to approach systematically if you’re a more forward thinker.


Thank you, everyone who contributed here.

When I have variable swaps for pronouns, my script is a tangled mess in one project, while much better in the other.

Using @Hazel 's suggestion, I think a review pass will be necessary for my project with the tangled mess.

Both @malinryden’s and @Havenstone’s suggestions are practices I am using and abusing. I second what each says enthusiastically. I can not imagine the following without using shorthand labels and multireplace:


“Er—” Shaking @{companionmr her|their|his} body, like a dog exiting a pond, $!{companion} rolls @{companionmr her|their|his} eyes at you. “I will not let that happen $!{pcname}.”

“We should have enough supplies to throw a shindig on our arrival in Independence.” Understanding that times for celebration will be few and far between in the year ahead, $!{companion} wants to take every chance @{companionmr she|they|he} can get to throw a party.


I actually don’t have a variable for hers/theirs in my gender swap code. Forgot about it at the start, and since I have used it maybe 6 times in 1,3 million words I don’t mind doing longform code then.


Jumping on the bandwagon to support this, but I also have a warning to offer! I make an inordinate number of conjugation mistakes because when I see ${b_they} my jerk reaction is ${b_they} verb instead of ${b_they} verbS which means I get a lot of “he say” or “she smile” in the final product that I have to go back and correct.

Still recommend gender neutral they variables 100%, but if you’re going to use them, be on the lookout for those pesky conjugation errors.


Since I’m not writing contemporary or historical, I luckily can set my own world’s gender norms to “legislate out” this problem, as it were, and then paper over it with a fashion-conscious agender royal consort. Which is even better, because they ended up being one of my favorite NPCs.

Oof, that’s a more tangled problem to deal with, and I sympathize.

The way that Sunless Sea handled this was popular with players, but that was for the player character’s child, so it may not help you much. Basically, they directly ask the player whether they carried the child, their lover carried the child, or the child was adopted. Without getting into the gory anatomical details. Which seems fair to me, unless pregnancy and childbirth themselves feature heavily in your story.


I actually set up dedicated ${s} and ${z} variables to handle this for the common regular verb conjugation (he breaks, they break) and pluralization (one friend, two friends) suffixes, respectively. Plus ${es} and ${ez} to handle the next most common forms (they box, she boxes; one fox, two foxes).

I use a variable for variable names, and set it at the beginning. Typing that is just as fast as typing either name, and it covers all bases (including if someone’s name might change during play, for whatever reason). And then there’s no chance you’ll accidentally use Rudi instead of Trudy.

1 Like

That works well for characters who can actually have singular-they pronouns (I do the same for PC pronoun variables), but it’s not much use if the character in question can only be he or she. I mess up with the conjugations because there are never any “theys” for the characters in question, but ${g_they} is still what I see when I’m writing even though the reader will only ever see he or she in that space

On the subject of names, I try to give my flippable characters a gender neutral nickname (Frankie for Frances/Francis) and then make a variable for their full name that I can recall whenever


Sure. Sometimes I write text which can describe individuals or groups, depending on if there’s one or more characters in the scene. It’s rare, but it’s helpful in those cases to have some flexibility.

1 Like