(set: $attitude to 0)This Twine game oughta teach you about the ways interactive narratives we write can react to player choice. There are three types of reactivity: Branching, Callbacks, and Reputations. Pick a choice below, and watch this game react to your choice. [[1. Thanks for teaching me!->thanks]] [[2. I'm not so sure about this...->unsure]] [[3. Blow it out your ass!->blow]](set: $reaction to "good")(set: $attitude to $attitude+1)\ You're welcome! [[1. Continue.->nextpart]](set: $reaction to "neutral")\ There's nothing to worry about! [[1. Continue.->nextpart]](set: $reaction to "bad")(set: $attitude to $attitude-1)\ Wow, in a grumpy mood, aren't we? [[1. Continue.->nextpart]]See, I gave you a unique response based on your choice by branching off to one of three different nodes. //Everyone// will see this current node, though. That's because I collapsed the branching back into one single node. [[1. Continue.->afterthat]]But, I saved your reaction as a variable, so I can refer to it later. I will always remember how (if:$reaction is "good")[kindly you thanked me.](if:$reaction is "neutral")[unsure you were earlier.](if:$reaction is "bad")[the first thing you did is throw expletives at me.]\ We can react to the player by ''branching to new nodes'' or by making ''conditional callbacks'' like I just did.(set: $learned to 0)\ [[1. Branching nodes?|nodes]] [[2. Conditional callbacks?|callbacks]](set: $learned to $learned+1)\ If you look in the Twine code, the link to this particular line looked like this: (text-colour:yellow)[`[[1. Branching nodes?|nodes]]`] If you wanted to branch to a different node, to take the story in a different direction, you might add a new line: (text-colour:yellow)[`[[2. Conditional callbacks?|callbacks]]`] Now, you've given the player two nodes to travel to! (text-style:"underline")[The nice thing about branching nodes are:] 1. It's easy to visualize how the story changes based on player input. 2. They guarantee the player will see content unique to their choices. (text-style:"underline")[But, there're tradeoffs!] 1. The more you branch, the more complicated things become. Unlimited possibility leads to scope creep. 2. You can't guarantee that every route will feel as satisfying as the others. The more you branch, the less control you have over pacing and tone. [[1. What about callbacks?|callbacks]] (if:$learned >= 2)[[[2. How about reputations?|third]]](set: $learned to $learned+1)\ If you look in the Twine code of the ''unsure'' node, you'll notice I create a variable called "reaction" and fill that variable with the word "neutral". The code looks like this: (text-colour:yellow)[`(set: $reaction to "neutral")`] In each of the three response nodes, I altered what value got shoved in the variable `$reaction`. Then, in the ''afterthat'' node, I looked at that variable. Depending on what it was filled with, I displayed different responses. That code looked like this: (text-colour:yellow)[`(if:$reaction is "neutral")[I will always remember how unsure you were earlier.]`] You can see we have the condition: Does that variable contain "neutral"? If it does, then display that text in the brackets. (text-style:"underline")[The pros of callbacks are:] 1. They're lightweight! No matter what part of the story you're in, you can always call back to something that happened earlier without having branch the story. 2. They can be slipped into content that otherwise wouldn't get variety. If there is an essential path the player has to take, you can break up the monotony with callbacks. (text-style:"underline")[But they have some drawbacks:] 1. If used in excess, the player can recognize when a callback is being shoehorned in. 2. Keeping track of all your variables can be overwhelming. [[1. What about nodes?|nodes]] (if:$learned >= 2)[[[2. How about reputations?|third]]]''Reputations'' are numbers the game can change based on player actions. The value of that number can be used to react to the player's general behavior, rather than to any single action. For example, at the beginning, you had a choice to be nice, neutral, or mean. I used an `$attitude` variable to track how nice you've been. I increase it when you're nice, and decrease it when you're mean. I can tell you your attitude value too: $attitude. (if: $attitude > 0)[See, it's positive because you were nice to me!](if: $attitude is 0)[See, it's zero because you picked a neutral option!](if: $attitude < 0)[See, it's negative on account of the expletives!] But, we can change that attitude value. Let's try it, shall we? [[1. I would love to, thanks!|generous]] [[2. I guess...|guess]] [[3. I'll change //your// attitude value if you don't shut up.|shut up]](set: $attitude to $attitude+1)\ That's it, lay on the gratitude. [[1. Continue.|onemore]](set: $attitude to $attitude)\ The apathy is palpable. [[1. Continue.|onemore]](set: $attitude to $attitude-1)\ Jeez. That was overkill. [[1. Continue.|onemore]]Your current attitude value is $attitude. [[1. I'm happy to give you another data point.|morethanhappy]] [[2. I'm ambivalent toward giving you another data point.|ambivalent]] [[3. I resent you for making me give you another data point.|resentful]]That's it, lick the boot.(set: $attitude to $attitude+1) [[1. Continue.|reevaluate]]Yup, that's a neutral thing to say, alright. [[1. Continue.|reevaluate]]Trust me, no one resents me more than I do.(set: $attitude to $attitude-1) [[1. Continue.|reevaluate]]OK, now we've collapsed to a single node, but I still have that `$attitude` variable. In conjunction with the `$reaction` variable, I can infer how you've responded. I can use a bunch of conditionals to react to your choices so far. For example... Since your attitude is $attitude and your initial reaction was $reaction, I know you (if: $attitude is 3)[have only ever been nice to me!]\ (if: $attitude is -3)[have only ever been mean to me! How awful!]\ (if: $attitude is 1 and $reaction is "bad")[started mean but then resolved to be nicer to me later.]\ (if: $attitude is -1 and $reaction is "good")[started nice and then got meaner afterward.]\ (if: $attitude is 0 and $reaction is "bad")[must have been nice once and neutral once.]\ (if: $attitude is 0 and $reaction is "good")[must have been mean once and neutral once!]\ (if: $attitude is 2)[were neutral once and kind twice.] \ (if: $attitude is -2)[were neutral once and mean twice.] \ We can keep track of how often a player has expressed a certain kind of attitude or disposition. Over time, we can intuit how they acted based on those reputations without having to keep track of every single previous desicion. That's how ''reputations'' work! [[1. Hey, that's all three types! We did it!|wedidit]]We did! The more you know. OK FIN. [[Back to start.|starting]]