How To Implement Choice in Videogames?

In my last post, I discussed the purpose of narrative in games (to enhance game play). Now I’m going to get a bit more technical and discuss the purpose of choice in video games. How to implement choice in Videogames?

How to implement choice in Videogames?

First, what is the purpose of choice? The purpose of choice is to give the player control over the story. Unlike in a book or movie, in a video game a player can directly affect the narrative.  That’s pretty cool! Choice exists in a narrative game to enhance the story.

So do games need choice? No. They do not. A number of (good) narrative games have limited to no choice.  A kinetic novel is one example. In this, the player merely clicks through a number of screens, enjoying the story and art. It’s essentially a comic book on a computer. (And, I suppose, one could argue whether it’s truly a game for this reason…)

Other narrative games with no real choices include some point and click adventures. For instance, while the player can choose what to click on in Gone Home or What Became of Edith Finch, there are no narrative changes that are dependent upon these mouse clicks. Different things are revealed (and some are needed to progress the game), but the player cannot change the story in any meaningful way.

But generally narrative games do include choices. I’m going to go into some options for choices (I’m sure more exist), as well as explain when I think these types of choices are best used.

How to implement choice in Videogames? Mario

Plot Changing Choices

Let’s start with the Plot Changing Choices. These are choices that make the plot completely diverge.  An example of this might be in Knights of the Old Republic. In it, the protagonist must either choose to defeat the Sith or to usurp control from them and become the next Lord of the Sith. After this choice has been made, the game irrevocably changes.

Another Big Choice might be killing the arch demon with your player character in Dragon Age: Origins versus letting someone else die (or letting the Old God Baby be conceived). If you die, the ending is your funeral where you are given a eulogy. If you don’t die, you end up in a throne room discussing the past events with your companions. Again, the game is irrevocably altered and additional events are completely different depending on the choice.

In either case, the game takes you somewhere in which Everything is Different. In Ren’Py (used because the code is very readable even to non-programmers), the code for the KOTOR choice would look something like this:

<code>menu:

“Do you want to kill the Sith or conquer the Sith?”

“Kill the Sith”:

jump Republic_Path

“Conquer the Sith”:

jump Sith_Path</code>

In this example, both paths are completely separate from here on out. Neither path merges with the other, meaning most assets created for one choice are completely separate from those used on the other path.

Big Choices

The good thing about Big Choices is that they’re significant and can add a lot to replay value. (Especially if they are only made possible by other, smaller choices made earlier in the game – e.g. maybe you don’t let a player make the Bad choice unless they’ve accumulated enough evil  points.) The bad thing is that they can require a lot of additional writing/coding/art and, if taken too far, can potentially make it seem like you’re playing two completely different games.

Take a very silly hypothetical example. Let’s pretend that, after a brief opening crawl, you’re asked whether you want to save the princess by exploring a dungeon or hopping on blocks. After this, you’re taken to either The Legend of Zelda or Super Mario Brothers. You have made a Plot Changing Choice (the game is completely different either way), but as there’s nothing in common with either game, you might as well have purchased two different games.

Major choices also can get out of control very quickly. Assume each choice is binary (e.g. you chose one of two options vs. one of four). If you allow the player to make 10 choices, you have 2^10 endings or 1024 endings. That’s with…only 10 choices. (That’s not very many!) Clearly these need to be used sparingly.

It’s also generally best to position these towards the end of a story, to reduce the amount of additional work that’s needed after making one of these choices regarding writing, art, coding, etc.

How to implement choice in Videogames? Zelda

Major Choices

Below Plot Changing choices in impact are Major Choices. These are choices that seem major (and may even take a fair amount of additional asset creation), but can be integrated without completely changing the plot.

A common Major Choice in a game is which character you romance. You might romance Alicia or Bethany, but the game progresses more or less the same no matter which one you romanced, just with periodic reminders that Alicia loves you while Bethany feels rather insulted that you weren’t sufficiently enamored of her many charms.

Whether a party member joins your party or is left behind is also a fairly easy to implement Major Choice. Either they’re there (and you can interact with them) or they’re not (and you can’t). Either way, the overall plot arc doesn’t change. Either you defeat the Big Bad with them or without them. (You still have to defeat the Big Bad.)

These choices can be easy to program in or difficult, depending on how often they’re called upon. (For instance, you might have massive numbers of quests that are dependent upon a character. These quests will then vanish from the story if the character they’re tied to is not invited to your party.  This is why a number of games make certain non-player characters mandatory – they’re too important to the plot to get rid of, so the narrative finds clever reasons why they have to remain with your player character.)

Most of these choices are called up in specific lines of code to add flavor. Think, for instance, of an example where you have the choice to adopt a dog early on in the game. Later in the game you might see something like:

<code>if dog == True:

N “Dog barks ferociously when you walk by a tree.”</code>

Or alternately, if you had the choice of having a dog or a cat or not having a pet:

<code>if dog == True:

N “Dog barks ferociously when you walk by a tree.”

elif cat == True:

N “Cat circles the ground, hissing.”

else:

N “You walk past a tree.”</code>

Another, with romance, might be:

<code>Narrator “You see the demon and pick up your flaming sword…”

 

if Alice_Romance == True:

Alice “Before we fight the demon, I want you to know I love you.”

elif Beth_Romance == True:

Beth “I know it’s going to be tough, but you’ve got this and I’ll be with you all the way!”

else:

You “Let’s fight the demon!”

 

Narrator “You charge the demon.”</code>

How to implement choice in Videogames? Knights

Game Changing Choices

The game does change based on the choice you made earlier, and the change is meaningful to the player, but it’s far easier to implement than completely branching storylines because the main arc of the story doesn’t change, meaning that the choice only needs to be implemented in select places before the story continues onward as though the choice was never was made.

With that said, every one of these choices does need to be tracked, which can become laborious. And players will notice if you gave them the option of, say, choosing a dog versus a cat, but then either act as though the choice never occurred (or more annoyingly, insists that the player chose the cat when they’d actually picked the dog).

Another type of choice that gives a sense of freedom, but ultimately doesn’t change the plot (or add much coding), is an Order Choice. In this case, a player may need to do four things, but can do them in any order. This gives a number of “choices” (e.g. you can do them as 1, 2, 3, 4 or 4, 3, 2, 1 or 2, 3, 4, 1 or…it goes on), but requires relatively little coding. (All you have to do is switch them to a “done” status once they’re completed). There’s no narrative difference in the order you make the choices in (although you can add dependencies), but it gives the player a sense of freedom.

You could also implement an Order Choice by allowing a player to complete a certain number of events. (e.g. the player has to go to any three of five worlds, but can ignore the other two. Or a player has to do one of two scenarios.) This, again, allows freedom without greatly expanding the assets required. And while there is some effort in tracking the order visited (or the completion order), it’s fairly minimal.

 

Code for an Order Choice might look like this.

<code># At the beginning of the game

 

$ quest1 = False

 

# When you speak to a villager

 

if quest1 == False:

Villager “There is a dragon menacing our village! Please save us, great hero!”

else:

Villager “Thank you so much for saving the dragon!”

 

# Then when you battle the dragon

 

if quest1 == False:

 

Narrator “You face a fearsome dragon. It swipes a mighty claw at you, but you dodge and raise your flaming spear. A minute later, you hurl it at the dragon. It strikes the dragon through the eye and the beast screams in pain before collapsing to the ground minutes later.”

 

$ quest1 = True

else:

Narrator “You see a dead dragon.”</code>

 

The quest1 flag allows the player to return to the village and talk to the villager again and again, with the dialogue only changing after you battle the dragon. (It also allows the dragon battle to take place no more than one time.)

Then there are Point Accumulation Choices. An obvious version of this is how affection points are handled in a number of games with romance side-plots. When you say something a character likes, you gain affection. If they dislike it, you lose affection.  If affection is sufficient, certain things happen. The nice thing about this is that it can be incorporated into almost any other choice (including completely non-meaningful choices) to give consequences for literally everything.

 

An example of this might be a conversation along these lines:

 

<code>Narrator “Alicia comes in wearing a new hat.”

 

menu:

“What do you say?”

“I really like your new hat”:

Alicia “Thanks! I do too!”

$ Alicia_Affection = Alicia_Affection + 1

“You look ugly in that hat”:

Alicia “I wasn’t asking for your opinion!”

$ Alicia_Affection = Alicia_Affection – 1

“Nothing”:

Narrator “You say nothing.”</code>

 

Then when you have enough affection, you get something like:

 

<code>if Alicia_Affection > 9:

Alicia “You’ve been really kind to me of late. I wanted to tell you how much it means to me…”</code>

 

Affection is a great way of making minor conversation choices matter without you having to track each one individually. (You could also use other points for this. For instance, you could track how often a character lies, how much money they have, how badly injured they are, whether they’re becoming good or evil, more conservative or more liberal, smarter or stronger, etc. etc.) It gives a sense that characters are “remembering” (Alicia will only romance you if you say consistently say nice things to her) without the code required to track the response of every single conversation the way you would for a more major choice.

How to implement choice in Videogames? Monster

Inconsequential Choices

Finally there are choices that don’t matter whatsoever. These choices can add color to the game, but in no way affect a narrative. Think about whether you’re nice to an NPC shop keeper or rude. You can allow a character to be either (which can be fun for the player of the game and give a sense that they’re role playing vs. being forced to use a pre-set protagonist), but it doesn’t take any programming beyond entering a dialogue tree then, once the dialogue is over, continuing on as though the dialogue had never happened.

 

In a novel, you might see text like this.

“You come upon a shop keeper and ask to see his wares. He shows them to you. You buy nothing then depart.”

While in a game it might look more like this.

<code>Narrator “You come upon a shop keeper.”

 

menu:

“What do you do?”

“Ask to see his wares”:

Shop “I’d be delighted to show what I have to offer you.”

Narrator “You look at his wears and buy nothing.”

“Ask about a recent rumor”:

Shop “Alas, I am but a humble shopkeeper and know nothing.”

“Tell him his mother smells of elderberries”:

Shop “I’m offended!”

“Do nothing”:

 

Narrator “With your shopping done, you continue along your way.”</code>

Certainly the game example felt like you had more control over the character! But it is important to remember that these kinds of choices can easily become excessive. At some point, a player wants to get on with the game, not endlessly talk to random NPCs for no good reason. Also, sometimes players worry that all dialogue choices might have implications, which can make this kind of chatter distract from the plot.

How to implement choice in Videogames?

No matter how choice is implemented in a game, it gives players a sense of freedom. While it can dramatically expand the plot, used judiciously, choice enhances video games without requiring a massive expansion of existing assets. With that said, when handled poorly, choice can become impossible to handle from a programming perspective and can even irritate or confuse the player.

Thanks for reading our feature on How to implement choice in Videogames? For more Indie Games features visit the Into Indie Games features section

This Article was written by: mutive

Leave a Reply