This is Part 2 of a series of articles on Strand Games' IF authoring technology called Strand. Strand is a domain specific IF language and runtime.

Last time, we saw how Terms and Flow can generate random stories. Now we'll see how the same mechanism builds choices.

Strand Games Technology

Remasters & Sequels


Choices

The difference between a player choice and a generator is whether the choice is made by the player or by the machine.

When you want to make a player choice, you use the exact same syntax but mark the term as a choice using the indicator ?.

Here's a new story to illustrate:

STORY
Once upon a time there were three bears.

What's your name? NAME
Ok NAME, here's the deal, the three bears have just gone out for a walk.
ROBTHEM That's the end of the game.

NAME?!
* Goldilocks
* Mousilocks
* Dreadlocks

ROBTHEM?
Do you want to rob their place?
* yes
BREAKIN
* no
Well then!

BREAKIN
You horrible person! Well ok then since that's the plot.
You break into their house like a pro.

Whoa! Lookee here; on the table are three bowls of porridge. LIKEPORRIDGE

VANDAL
You
* set the place on fire and leave.
* smash the place up. That will show 'em.
* throw the porridge all over the walls, about all it's good for really.

LIKEPORRIDGE?
Do you like porridge?
* Hell yes!
Right on! WHICHBOWL
* A bit
WHICHBOWL
* No, it's awful!
Oh well, not much else here then. VANDAL Bears suck anyway!

WHICHBOWL
There are three bowls; a large one, a medium one and a small one. BOWL

BOWL?
Which do you want to try NAME?
* the biggest of course!
Eww! It's cold and lumpy! BOWL
* the medium sized one
Eww! It's way too sweet! BOWL
* the smallest one
This one's not too bad. A bit small though, so you eat the lot!
Suddenly the door slams open and three angry bears are glaring right at you! WHATNOW

WHATNOW?
What now?
* Run like hell!
Nice try, but they swiftly block your exit. MAULED
* Climb a tree.
Be serious, there are no trees in here! WHATNOW
* Put your hands up and plead innocent.
Sorry, the cute routine doesn't work with bears! MAULED
* Say; NAME went that-a-way, and point out the window!
It worked! The bears all rush out to find the culprit.
Quickly, you exit the shack and run away as fast as you can. That was close! MORAL
* Fight!
You rush them, kicking and screaming like a banshee, perhaps they'll run off? MAULED

YOUDIE
They
* leave you to die slowly and painfully,
* watch you die slowly, your blood squirting out in slow motion,
* laugh as you die screaming in agony,

  while they eat their porridge!

VICIOUSLY
* viciously
* ferociously
* mercilessly
* easily

MAULED
The bears grab you and VICIOUSLY tear all your arms and legs off! Bears are _that_ strong you know. YOUDIE MORAL

MORAL
Perhaps you won't mess with bears next time!

Before we cover how this works, you might want to play it.

How does it work?

Let's see how this plays and explain the details:

Once upon a time there were three bears.

What's your name?
(1) Goldilocks
(2) Mousilocks
(3) Dreadlocks 2

Ok Mousilocks, here's the deal, the three bears have just gone out for a walk. Do you want to rob their place?
(1) yes
(2) no
2

Well then! That's the end of the game.

The flow taken by this short playthrough is illustrated here;

Here's another, slightly longer play;

Once upon a time there were three bears.

What's your name?
(1) Goldilocks
(2) Mousilocks
(3) Dreadlocks
1

Ok Goldilocks, here's the deal, the three bears have just gone out for a walk. Do you want to rob their place?
(1) yes
(2) no
1

You horrible person! Well ok then since that's the plot. You break into their house like a pro.

Whoa! Lookee here; on the table are three bowls of porridge. Do you like porridge?
(1) Hell yes!
(2) A bit
(3) No, it's awful!
3

Oh well, not much else here then. You throw the porridge all over the walls, about all it's good for really. Bears suck anyway! That's the end of the game.

Here's the flow this time;

You can see from these flow diagrams that flow enters terms and continues to flow into subterms until there is nowhere for it to go, at which point, it returns to the original flow and continues. When the flow finally stops, the game is over.

Finally, here is a longer play;

Once upon a time there were three bears.

What's your name?
(1) Goldilocks
(2) Mousilocks
(3) Dreadlocks
1

Ok Goldilocks, here's the deal, the three bears have just gone out for a walk. Do you want to rob their place?
(1) yes
(2) no
1

You horrible person! Well ok then since that's the plot. You break into their house like a pro.

Whoa! Lookee here; on the table are three bowls of porridge. Do you like porridge?
(1) Hell yes!
(2) A bit
(3) No, it's awful!
1

Right on! There are three bowls; a large one, a medium one and a small one. Which do you want to try Goldilocks?
(1) the biggest of course!
(2) the medium sized one
(3) the smallest one
1

Eww! It's cold and lumpy!
Which do you want to try Goldilocks?
(1) the medium sized one
(2) the smallest one
2

This one's not too bad. A bit small though, so you eat the lot! Suddenly the door slams open and three angry bears are glaring right at you! What now?
(1) Run like hell!
(2) Climb a tree.
(3) Put your hands up and plead innocent.
(4) Say; Goldilocks went that-a-way, and point out the window!
(5) Fight!
2

Be serious, there are no trees in here!
What now?
(1) Run like hell!
(2) Put your hands up and plead innocent.
(3) Say; Goldilocks went that-a-way, and point out the window!
(4) Fight!
1

Nice try, but they swiftly block your exit. The bears grab you and viciously tear all your arms and legs off! Bears are that strong you know. They leave you to die slowly and painfully, while they eat their porridge! Perhaps you won't mess with bears next time! That's the end of the game.

It should now be clear how the flow works in this playthrough, but let's look at choice terms in a detail;

LIKEPORRIDGE?
Do you like porridge?
* Hell yes!
Right on! WHICHBOWL
* A bit
WHICHBOWL
* No, it's awful!
Oh well, not much else here then. VANDAL Bears suck anyway!

LIKEPORRIDGE is a choice term as indicated by ?. It has an (optional) initial text flow Do you like porridge?, then it has three selectors each introduced by * at the start of a line.

You'll notice each selector has two parts:

  • The choice flow on the same line as *.
  • The action flow on the subsequent lines.

eg

* Hell yes!   // choice flow
Right on! WHICHBOWL // action flow

If the choice is selected, the action flow is taken. Terms can also occur in the choice flow as NAME in the following;

BOWL?
Which do you want to try NAME?
* the biggest of course!
Eww! It's cold and lumpy! BOWL
* the medium sized one
Eww! It's way too sweet! BOWL
* the smallest one
This one's not too bad. A bit small though, so you eat the lot!
Suddenly the door slams open and three angry bears are glaring right at you! WHATNOW

You'll also notice some of the actions in the BOWL term reference BOWL itself. This causes a loop back to the BOWL term.

By default, choice terms remember which choices have previously been used and these do not appear again. For example the option Climb a tree did not appear again when the options were presented again. The same happened as the different porridge bowls were chosen.

Selectors can also have indicators to tweak behaviour. eg. Indicating *+ Climb a tree. allows the option to be used more than once.


That's it for Part 2. Next time we'll show how selectors can depend on previous choices.

Next Post Previous Post