Procedural Storytelling: The Urchins

In this scene, one of the kids has stolen something, but who it is and what they stole depends on your previous choices.

This excerpt uses procedural storytelling to efficiently handle both scenarios with the same piece of code. There are many advantages to this approach: It makes the code more compact, it simplifies the state machine, and it’s easier to revise, because the same passage is not duplicated in multiple places. The scene is presented first as a sample flow demonstrating one possible pathway, then as a flowchart demonstrating the branching, and finally as a short sample of Ink code demonstrating the text variations. Some text variations have been omitted from the flowchart for readability.

Back to the portfolio

Code Sample

This code sample uses adaptive text, including my own simple pronoun functions, to efficiently handle both theft scenarios in the same knot.


Sample Script

The cabin urchins come tumbling out from under one of the spare boats, bruises on their knees, inexplicable dirt on their faces. The big one is Nat. The small one is Toby. You assume they’re siblings, but really, it’s anyone’s guess. They look put out.

NAT: We wanted to help board the Endeavour.

TOBY: Yeah, you never let us fight!

PLAYER: You’re too little. You’d get hurt.

NAT: I am not. I’m almost five feet!

TOBY: I’m little but I’m tough.

Toby wipes his runny nose.

They’re trying to distract you from a very important fact: Usually there’s three of them.

PLAYER: One. Two. One…Two.

You count the urchins very pointedly. They look up at you innocently as though they have no idea what you’re talking about.

PLAYER: All right, where’s Kit?

Nat and Toby look at each other and shrug.

PLAYER: Is Kit on the Endeavour?

NAT: No.

Just then Kit comes scurrying down the ropes and joins the other urchins as if she’d been there all along.

PLAYER: Kit, were you just on the Endeavour?

She doesn’t even bother lying to you. She just pins you with a knife-eyed glare.

You hold her upside down and give her a good shake. A gold watch comes tumbling out of her pocket.

PLAYER: You never do as you’re told, you eat enough for an entire crew, and now you’re stealing straight from under my nose? I should flog you down to your bones! I should keel-haul you! I should put you off on the first cay we pass!

Their eyes glaze over. Eventually you run out of steam.

You pocket the watch.

PLAYER: Well, run along then. I’m sure someone has something that needs doing.

You’re a big softie when it comes to the urchins. You know you should be tougher on them. But you can never bring yourself to punish them, no matter how feral they act.

The urchins scamper off, their bare feet sliding on the wooden deck.


Flowchart

PDF