It looks like you're new here. If you want to get involved, click one of these buttons!
Title:TTLG (Code Critique)
Author/s: Frances Van Scoy
Language/s: Inform 7
Year/s of development:2008-2020
Software/hardware requirements: Mac OS 10.13.5; Inform 7 Build 6M62
"Kudzu Ken 20200127 v2" by Frances Van Scoy
Book 2 - General Definitions
Use the serial comma.
Use American dialect.
When play begins:
Say "This game is one square of a planned 64 square mildly educational game set in the expanded world of Lewis Carroll's [italic type] Through the Looking Glass[roman type]. The anticipated main audience is middle school girls. [paragraph break] [paragraph break]";
Say "To the west you see a large brick wall with a wooden gate in it. You open the wooden gate and walk through it. The gate closes behind you.";
Now the likeability of the player is 2; [Likeability ranges from -5 to +5.]
Now the left hand status line is "[player's surroundings]";
Now the right hand status line is "Likeability: [likeability of the player]".
Part 3 - Properties of Things
A knapsack is a container. A knapsack is wearable.
Part 1 - Properties of Plants
A person can be known or unknown.
A plant is a kind of person.
A flower is a kind of plant.
A daisy is a kind of flower.
A tiger lily is a kind of flower.
A weed is a kind of plant.
A kudzu_plant is a kind of weed. The description of a kudzu_plant is "The kudzu seems to be growing as you look at it."
A kudzu_plant is either quiet or active. A kudzu_plant is usually quiet.
A kudzu_plant is either angry or defeated. A kudzu_plant is usually angry.
kudzu is a kudzu_plant.
A tree is a kind of plant.
A dogwood is a kind of tree. The description of a dogwood is "Next to the dogwood tree is a sign that says 'cornus florida.'"
Part 2 - Properties of Player Character
The player has a number called the likeability.
A person is either hostile_to_kudzu or friendly_to_kudzu.
A person is usually friendly_to_kudzu.
The player is wearing a knapsack. The description of the knapsack is "a canvas bag in which you store items you acquire."
A knife is in the knapsack. The description of the knife is "a garden knife, suitable for cutting an ear of corn from a cornstalk, for example".
Part 3 - Properties of Non Player Characters
Chapter 1 - Guard Dog Wood (a dogwood tree)
Guard Dog Wood is a tree. The description of Guard Dog Wood is "Guard Dog Wood is an exceptionally large dogwood tree in the middle of the garden."
Chapter 3 - Dayzee (a daisy)
Dayzee is a flower. Dayzee is nowhere.
Chapter 4 - Tigra (a tiger lily)
Tigra is a flower. Tigra is nowhere.
Chapter 5 - Ken (a kudzu plant)
Ken is a kudzu_plant. Ken is nowhere. The printed name of Ken is "a large aggressive kudzu plant".
Part 4 - Facts
A fact is a kind of thing. A fact can be known or unknown. A fact is usually unknown.
Flowers can talk is a fact.
Part 6 - Actions
Understand the command "pick" as something new.
Understand the command "pick" as "take".
Understand "who" as whoing.
Whoing is an action applying to nothing.
Understand "tickle" as tickling.
Tickling is an action applying to nothing.
Understand "help" as helping.
Helping is an action applying to nothing.
Understand "what" as whating.
Whating is an action applying to nothing.
Book 3 - Scenes and Rooms
The player is in the Garden of Live Flowers.
Part 1 - The Scenes
Chapter 1 - Scene Main Garden
Main Garden is a scene.
Main Garden begins when play begins.
When Main Garden begins:
if Guard Dog Wood is known:
now Guard Dog Wood is in The Garden of Live Flowers;
otherwise:
now Guard Dog Wood is nowhere;
if Tigra is known:
now Tigra is in The Garden of Live Flowers;
otherwise:
now Tigra is nowhere;
Chapter 2 - Scene Attack of the Creeper
Attack of the Creeper is a scene.
When Attack of the Creeper begins:
say "You feel something moving on your leg. You look and see that a tendril of a kudzu plant is growing rapidly and wrapping itself around your leg. Almost immediately it reaches your body and begins wrapping itself around you.";
now Ken is in the Garden of Live Flowers.
Attack of the Creeper ends badly when Ken is active and Ken is angry.
When Attack of the Creeper ends badly:
say "The kudzu lets out a horrifying scream, releases its grasp on you and grows to three times its previous size."
Attack of the Creeper ends well when Ken is defeated.
When Attack of the Creeper ends well:
Now Ken is in The Garden of Vegetables;
Now Ken is quiet;
say "The kudzu struggles for a moment, uproots itself, crawls across the garden, and slides under the gate leading into the Garden of Vegetables ."
Section 1 - CUTTING a weed
Instead of taking a weed when Attack of the Creeper is happening:
say "You reach for the kudzu but it moves away from your hand."
Instead of cutting a weed when Attack of the Creeper is happening:
if player is carrying a knife:
say "You attempt to cut the kudzu with the knife.";
now Ken is active;
now Ken is angry;
otherwise:
say "You need to hold a knife in order to cut kudzu."
Section 2 - - TICKLING a weed
instead of tickling when Attack of the Creeper is happening:
say "The kudzu shakes with laughtern so much that it releases his grip on you.";
increase the likeability of the player by 2;
now Ken is active;
now Ken is defeated;
now Ken is in The Garden of Vegetables.
Section 3 - Asking for HELP
[Advice on persuasion isfrom Writin with Infrom, section 12.4 Persuasion, Infor 7 Build 6M62.]
Persuasion rule for asking someone to try helping during Attack of the Creeper:
if the likeability of the player is greater than 0:
Say "[the person asked] says to the kudzu, 'Let go of her right now!'";
if the person asked is Guard Dog Wood:
Say "The kudzu releases you.";
increase the likeability of the player by 1;
Now Ken is quiet;
Now Ken is defeated;
persuasion succeeds;
otherwise:
Say "The kudzu appears to stick out its tongue at [the person asked] and wraps his tendrils more tightly around you.";
Now Ken is active;
Now Ken is angry;
otherwise:
persuasion fails.
Part 2 - The Rooms
Chapter 1 - Outside the Garden
Outside the Garden is a room. "To the west you see a large brick wall with a wooden gate in it."
Chapter 2 - The Garden of Live Flowers
The Garden of Live Flowers is a room. The Garden of Live Flowers is west of Outside the Garden. "You are in a large walled flower garden. In the center of the garden is a large dogwood tree. Surrounding the dogwood are many flowers, including daisies and tiger lilies. There is also some kudzu growing in the garden. [paragraph break] The wooden gate in the brick wall on the east leads to the outside world. There is no handle on the garden side of the door. [paragraph break] You hear a voice say, 'Welcome to the Garden of Live Flowers.'"
In The Garden of Live Flowers are some daisies. The daisies are scenery.
In The Garden of Live Flowers are some tiger lilies. The tiger lilies are scenery.
In the Garden of Live Flowers is some kudzu. The kudzu is scenery.
In the Garden of Live Flowers is a dogwood. The dogwood is scenery.
Section 1 - GOING east, south, west or north
instead of going east when the player is in the Garden of Live Flowers:
say "The wooden gate in the brick wall leads to the outside world. Unfortunately it only opens into the garden, and there is no handle on the garden side of the door."
before going south:
say "This garden gate leads to the Garden of Vegetables. You enter the garden and look around. [if Ken is in Garden of Vegetables]You notice some kudzu is growing in this garden.[end if]";
continue the action.
instead of going west when the player is in the Garden of Live Flowers:
say "That part of the world is still under construction."
instead of going north when the player is in the Garden of Live Flowers:
say "That part of the world is still under construction."
Section 3 - PICKING flowers
Instead of taking a flower for the first time:
decrease the likeability of the player by 1;
say "You think you hear [the noun] screaming. Some nearby flowers shake, and you think you hear them saying something. You hear a loud barking sound coming from the center of the garden. You suddenly think that it might have been a bad idea to try to pick [the noun].";
Instead of taking a flower for the second time:
decrease the likeability of the player by 2;
say "You are startled by a noise from the center of the garden and release [the noun] without picking it. You look up and see what appears to be an extremely rapidly growing branch coming from the dogwood tree in the middle of the garden. It stops growing just above your head and then bends down, lifts you from the ground, shakes you and then drops you back onto the garden path."
Instead of taking a flower for at least the third time:
decrease the likeability of the player by 3;
say "A large branch of the dogwood tree lifts you from the ground, extends itself over the brick wall, and drops you outside the garden.";
move the player to Outside the Garden.
Instead of taking a kudzu for the first time:
now the player is hostile_to_kudzu;
say "You attempt to pick the kudzu.".
Attack of the Creeper begins when the player is hostile_to_kudzu.
Section 4 - SAYING SORRY
Instead of saying sorry for the first time:
increase the likeability of the player by 1;
say "You say, 'I'm awfully sorry!'".
Instead of saying sorry for at least the second time:
say "Apologizing over and over won't change anything!"
Section 5 - WHOING (asking "who")
Instead of whoing when player is in The Garden of Live Flowers and Guard Dog Wood is unknown :
say "'Who said that?' you ask. [paragraph break]'I did. I am Guard Dog Wood. I live in the Garden of Live Flowers and protect the plants in the garden.'";
move Guard Dog Wood to the Garden of Live Flowers;
now the printed name of Guard Dog Wood is "Guard Dog Wood";
now Guard Dog Wood is known.
Instead of whoing when player is in The Garden of Live Flowers and Guard Dog Wood is known and flowers can talk is unknown :
say "'Who said that?' you ask. [paragraph break] 'I did. My name's Tigra,' says a tall tiger lily as she bends gracefully towards you. [paragraph break] 'I didn't know flowers could talk!' you say. 'I CAN talk,' says Tigra, 'when there's someone worth talking to.' [paragraph break] 'We can ALL talk!' say several flowers simultaneously.'";
move Tigra to the Garden of Live Flowers;
now flowers can talk is known.
Section 7 - Recognizing speech that contains certain words
[The code in this section is based on Chapter 17 Understanding in Wriitng in Inform in Build 6M62 of Inform 7 internal documentation. ]
After reading a command:
if the player's command includes "beauty":
say "You hear a voice saying 'Thank you! We think the garden is a beautiful place to live.'";
reject the player's command;
if the player's command includes "beautiful":
say "You hear a voice saying 'Thank you! We think the garden is a beautiful place to live.'";
reject the player's command;
continue the action.
Chapter 4 - The Garden of Vegetables
The Garden of Vegetables is south from the Garden of Live Flowers.
Book 4 - Ending the game
check quitting the game:
end the story;
When play ends:
if the story has not ended finally:
say "Thanks for playing! For more information about the game, please send email to LookingGlass@juno.com"
Book 5 - Testing
test pick_plant with "who / examine / look / pick daisy / pick daisy / pick daisy / west / pick kudzu / tickle "
Comments
As a computer science professor, I teach a senior elective in game development to art, computer science, and media majors. I like to write small sample games to illustrate my lectures and to give my students examples to modify for their own games.
Often I base these examples on Alice in Wonderland and Through the Looking Glass. Then I noticed that my description of an attack on Alice by a sentient weed named Ken Kudzu was too sensual, almost sexual for use in a game whose announced audience was middle school girls. I rewrote that passage and re-considered the rest of my code for that game. I seemed to be rewarding players for behaving like a Victorian girl rather than a girl living in the 21st century, so I had to do some serious rewriting.
This year in honor of the 400th anniversary of the landing of The Mayflower I've been writing some short examples based on Henry Wadsworth Longfellow's 19th century poem, "The Coursthip of Miles Standish." In the poem Priscila Mullins is the only woman of "marriagable" age surviving the first winter in Plymouth. Both men want to marry her and she has to decide which to marry. I wanted to include an option in gameplay in which she would decide not to marry either man. From historic documents we know that her father was a shoemaker and owned hundred of pairs of new shoes at the time of his death. I wrote a ficticious backstory in which Priscilla begs her father to teach her his trade. He does so and after his death she takes over his business (and defers thoughts of marriage).
So I'm wrestling with the problem of re-interpreting narratives based on older texts while maintaining their itegrity and reflecting current cultural values.
What sort of behaviours are encouraged or expected is an active concern for writers of games where players type commands. The parser-game format reflected in Inform7's default verbs and vocabulary of rooms and objects prebakes a lot of assumptions about the core activities of the player. The default assumption is that the player will spend most of their time be examining and manipulating objects in their environment, rather than talking or undertaking long projects.
I found it interesting that your conversation system jumps off of the pronoun "who". Did you find in testing people would type things like "Who said that?", "Who are you?" or "Who is there?".
Thanks so much for sharing this, Frances.
Based on the comment 20200127 v2, it seems that this code is freshly post-rewriting! Are there any before / after snippets or any previous versions that you would like to share, or is there a public version control with change history? Or should we focus on looking forward, not back?
The Longfellow example also sounds fascinating! This form of exploring the alternate possibilities for female protagonists is fictional social situations reminds me of some of Emily Short's work on conversational IF -- I'm thinking particularly of her "fractured fairytales" series including "Bronze" (Beauty and the Beast), "Glass" (Cinderella), "Alabaster" (Snow White), and "Indigo" (Rapunzel).
I'm interested in the use of headings to organize the code ("book", "part", "chapter", "section"). I know that headings can act somewhat like a file/directory system for organizing Inform 7 code, and that they are particularly helpful for organizing very large works -- I'm thinking of Aaron Reed's Blue Lacuna, for example, with source code exported into 498 pages organized under into an outline of 546 headings. But I believe (but can't recall) there are other considerations for the way that headings work in the language -- like scoping names, or providing more informative error messages, or...?
Could you say something about how you use headings pedagogically, or how you find that "outlining" facility of Inform7 different from the affordances of other programming languages?
@francesvanscoy Is this code running anywhere? I'd like to see the output before I comment on anything in this particular case. If not, do you have screenshots? I also second @jeremydouglass's request for snippets of the code before editing, if you have them!
Yes. For supporting my testers, I relied heavily on example Alpha in the documentation provided with Build 6M62 to give directions to my testers. Here's the Inform 7 code from the large code of which my code above is part.
The Emily Short article mentioned is "Suggestions or Testing" at her blog at https://emshort.blog/how-to-play/writing-if/my-articles/suggestions-for-testing/
I found that my players frequently typed lines that began with "Who" or "What". I teach students who are majoring in art, computer science, and journalism. They are often not familiar with the conventions of text-based games.
I had to do some recent rewriting in order to get my code to compile using Build 6M62.
As a Mac user I worry about future access to older implementations of Inform (because I have several years of Inform 7 projects).
See
http://inform7.com/releases/2019/10/10/catalina.html
I love these examples by Emily Short and frequently discuss them in class, especially the Pine series of examples (from Sleeping Beauty) provided in the Inform 7 documentation.
Because of being an academic, I often return to a piece years after I first worked on it. The headings help remind me of what I was thinking about a few years ago.The great flexibility in organizing code under headings is liberating in some ways but some times gives me too much freedom and forces me to make some organizational decisions sooner than I would prefer in a work-in-progress. I enjoy building IF from Alice in Wonderland and Through the Looking Glass and usually give each book chapter its own Inform 7 chapter.
To save interested followers of this discussion the work of extracting the headers from the current work under discussion, here is a list of my headers that shows one approach to organizing a work that I currently use. (Inform 7 rules about the order of code imposes some restrictions on how I might otherwise arrange code.)
One interesting thing about this code that I would focus is this line:
A plant is a kind of person.
However,
person
isn't defined elsewhere in the code, because it is an Inform7 built-in, and this is a moment of explicitly leveraging that core library.When I cut-paste the source code into Inform7 (attached, to preserve tabs) then I can run the game and inspect the Index > Kinds Index, which gives me an object tree:
There are objects, including rooms and things. One kind of thing is a person -- and the player is a person. Other built-in things are "man" "woman" and "animal" -- and this game makes "plant" another kind of person, then extends a hierarchy of kinds of a plants and instances of plants.
In particular, there is an interesting resonance between the form (IF, with facilities for conversational agents), the design, and the particular story/game genre. The negotiation of who counts as a person (or plant) and how they should be addressed or what kinds of actions are appropriate or possible for them to take is crucial to the scene from Alice Through the Looking Glass, Chapter 2: In the Garden of Live Flowers -- and to the musical adaptation in Disney's Alice in Wonderland -- in her conversations with Tiger-Lily, Rose, Violet, and Daisy.
I don't know whether there is an easy way to download the code snippet I posted (without line numbers). If so the code could be pasted into the Source window if the Inform interface and run as written.
But I have added a test statement
and executed it, with the following result.
I don't have easy access to the computers on which I wrote earlier drafts, and I may have just deleted rather than saved the old statements. I can try to check this week before this WG session is over.
But, I don't want Alice, the Player Character, to be too polite and too concerned with pleasing adults as she seems to be in the books or to behave the way players of traditional adventure-like text-based games do (ex. stealing things, killing opponents). For example I want her to find notes that say it's ok to take one item out of a pile or to earn money as a waitress at the restaurant built by the Walrus and the Carpenter and thereby earn money which she can use to buy things. Since the flowers she meets early in the game are sentient beings and can talk I want her to be prevented from picking them.
I included it as attachments to my comment, in text or Inform7 file.
It appears that, when copy-pasting from the forum into Inform7, the code is damaged because Inform7 uses whitespace (tabs) to organize code blocks (what is known as the off-side rule, as found in Python, CoffeeScript, and Make files et cetera) but our markdown processor may transform those into spaces. File attachments are a way around that.
There are several decisions the designer of a work of Interactive Fiction or text-based game needs to make early in the design process.
One of those is whether the work is to be parser-based or choice (menu)-based.My preference is parser-based because it allows greater apparent freedom for the player and allows the player to be surprised when finding an unexpected command. Emily Short argues otherwise (https://emshort.blog/2010/06/07/so-do-we-need-this-parser-thing-anyway/ and https://emshort.blog/2019/12/10/mailbag-moments-of-non-choice/ ) But it's important to include sufficient hints that a player won't be stuck for a long time looking for a command that the parser will accept. (I've been embarrassed when I've shown my students a game that I wrote a year or two ago but have since forgotten how to play. ) Here's an example of my hint functionality in a slightly larger version of the game under discussion.
This at least reveals some useful but non traditional commands such as "notebook," "sorry," and "tickle."
Secondly, Chris Crawford's advice on choosing "verbs" and emphasizing people more than objects ( https://www.erasmatazz.com/library/c839b0d2d6b6417787b1/too-many-verbs.html,
https://nodontdie.com/chris-crawford)
are something I've taken to heart. I'm currently writing my game about the love triangle involving Prisilla Mullins as a menu- or choice-based game because I think it's easier to write it as a choice-based game. But once I have it working correctly I hope to convert it into a parser-based game. Questions inspired by Chris Crawford include: how many verbs should be in a game? How do I teach the player what verbs I've implemented? Will my game be better if it emphasizes people rather than objects? How will the implementation of my game or IF change if it emphasizes people?
Thirdly, another question is based on our not always considering an alternative mechanic to the taking (stealing?) of treasure. My target audience is often middle school girls. I've been inflenced by the text book for my game development class, Jesse Schell's The Art of Game Design: A Book of Lenses, in the latter chapters of which he writes about the impact of games on their players. "Games are not just trivial amusements. . . . You are working in, and inventing, the medium that will subsume all others. The medium that a person is immersed in when they are young defines how they will think for their entire lives. " I ask myself, do I want to teach middle school girls to become thieves? Or can I assume that they will recognize the fantasy aspect of a game? The 1983 Infocom game Infidel seemed critical of the behavior of plundering artifacts by the Player Character archaelogist, as described by Emily Short ( in video Emily Short - The Past, Present and Future from AdventureX 2016,available online at 4:56-6:17).