wordplay puzzles

Hello, me again. Thanks for your quick and excellent responses to my earlier question about opening the door-- it’s really exciting for me, as a lonely freelance writer, to suddenly be working on a project that comes with a knowledgeable and helpful community, as opposed to wandering around my room screaming “Why?! WHY?!!” to the unhelpful walls.

I’ve been reading this great book about game design (Jesse Schell’s “The Art of Game Design,” which I thought wouldn’t live up to its Amazon.com reviews, but has, and more-- check it out!) and it’s given me a lot to think about for making my IF more of a game, which of course means puzzles! As a relatively new IF player, I kind of hate puzzles, because I don’t understand how they work. But I playtested some parts of my game at a party and was surprised to find that a lot of players (almost all of whom had never played IF before) were most excited to write funny verbs into the prompt in order to see what happens. I decided that the prompt could really be the “toy” my IF is based around, and this works well thematically because one of the main characters of the story itself has the ability to change the world around him by talking in a particular way.

So the question: I can read all I want about theory, but as super-new coder to Inform7, I don’t know how you actually MAKE wordplay puzzles. There are some games that involve them that I’ve fiddled with, but I was wondering if anyone had any advice on how such puzzles are made-- where saying certain words or things in a certain order makes things happen, or that sort of thing. OR if anyone knows where I can find some Inform7 source code for wordplay puzzles, since I learn pretty well by seeing how others do it.

Maybe this is better for the Inform7 board, but I’m such a noob, and they all seem so experienced over there…


Look up Ad Verbum, by Nick Montfort.

BTW, I’m not particularly fond of wordplay puzzles in IF. But I’m all for puzzles. IF without puzzles is simply like a novel where you switch pages by typing “go north” or other silly and useless nonsense.

that said, most n00bs try out different and silly things at the prompt simply either because they 1) are not aware of IF parser’s limitations; 2) are facing a particularly evil puzzle; or 3) are plain stupid. Most puzzles should be self-evident in the context of the story and settings, at least for the best IF out there. Players should play like an actor: put themselves in the character shoes. It’s not reasonable to make a priest PC “shoot the merchant” simply because there’s a shotgun and merchant nearby or because the player has sadistic tendencies. Unless of course it’s in the context of the story…

Solving good, well-crafted puzzles well integrated in the context of the story are an immensely rewarding experience and makes up for much more immersion of the player in it, he feels like he had some positive influence in its outcome and is not a mere reader of sometimes verbose events…

I don’t know if the source code for Ad Verbum is available, and anyway it’s almost certainly written in Inform 6 (since it came out in 2000 and Inform 7 wasn’t publicly available until 2006). Another recent game based on wordplay is Earl Grey, but that also seems to have been written in Inform 6. Under, in Erebus from this year’s comp was a wordplay-based game that was written in Inform 7, and though I don’t think the source code is available online you could always politely ask the author for it. Oh, and Andrew Plotkin’s “Escape” is a very short wordplay-based game that’s mostly in Inform 7, with publicly available source code here; but the code is a bit harder to read than usual because it had to fit within a 140-character limit for the purposes of a contest.

So that’s not much help for you. One thing about it is that these games have very different sorts of wordplay-based puzzles, and how their implement probably differs accordingly. Escape uses a standard Inform action and implements a couple of synonyms for it (not the one I tried, boo hoo, but it’s impressive that he got any synonyms implemented in a twitter-length IF). Under, in Erebus implements its wordplay through standard actions:

you have to get objects that sound like letters, put them in a row of booths, and push a button, and you’ll get the word they spell out; a bewildering number of words are implemented.

My guess is that somewhere in the source code there’s an enormous table listing all the possible outcomes.

Earl Grey relies mostly on a couple of custom verbs that seem like they must have been really hard to implement. And Ad Verbum has a crazy amount of custom verbs, and some other stuff that I don’t remember too well.

So it really depends on what kind of puzzle you want. Now, if all you want to do is “If the player types in this word, something happens,” that might not be too hard to implement, like this:

[spoiler][code]“A lad in a cave” by Matt Weiner

The Cave is a room. “A bare cave with a door to the north.” Paradise is a room. The magical door is a door. The magical door is scenery. [This means that “You can see a magical door here” won’t show up.] The description of the magical door is “The door has no handles, hinges, or any apparent way of opening it. On it is written: ‘There is a seed that if said will open me.’” The magical door is north of The Cave and south of Paradise. The magical door is closed.

Sesameing is an action applying to nothing. Understand “sesame” as sesameing. [This is the action that will take place when the player types “sesame.”]
Instead of sesameing:
say “With a puff of smoke the door swings open!”;
now the magical door is open.

Instead of opening the magical door:
say “There isn’t any obvious way to open the door.” [We don’t want it to be openable by normal means, but I don’t want to lock it and have the default “It appears to be locked” message appear, so this should work, I hope.]

After going through the magical door:
end the story finally saying “You have won”. [An “instead” rule won’t work here, because that’ll fire before we check to see if you can actually go through the door.]

[The most fiddly bit may be getting the game to understand “say sesame” as well as “sesame.”]
Understand the command “say” as something new. [This is necessary because “say” defaults to the built-in action “answering it that,” I think, and we have to remove that understanding in order to get “say” to do what we want.]
Speaking is an action applying to one topic. [A topic is a piece of text from the command that needn’t be an object that’s present.] Understand “Say [text]” as speaking.
Instead of speaking “sesame”: try sesameing. [This means that “say sesame” does what “sesame” would do.]
[But we need something to happen when the player types “say cheese.”]
Instead of speaking: say “Nothing seems to happen.” [This rule won’t interfere with the previous one because the previous one is more specific.]

[And if the player just says “poppyseed” they’ll get “That’s not a verb I recognise.” That’s bad, so we can include a catchall command to trap any unrecognized command and treat it as a wrong answer to the riddle.]

Wrong-answering is an action applying to one topic. Understand “[text]” as wrong-answering. [In theory this understands any input as wrong-answering, but since the other rules for understanding text are more specific they’ll fire first. That means that, if the command can be understood as anything other than wrong-answering, it will.]
Instead of wrong-answering: say “No, that’s not it.”

[Or, and this probably would’ve been better, I could’ve defined one action to cover both the right answer and the wrong answer.][/code][/spoiler]

It’s more of a riddle than a wordplay, but it’s maybe the same principle.

BTW, I wouldn’t be shy about posting to the I7 forum. I may talk like I know what I’m doing, but I’m basically a noob too. Also, I just look at the unread posts, so I usually don’t even notice which board something is posted in. :wink:

[UPDATE: I just walked my wife through the game – she doesn’t play IF, but she did get the puzzle – and her reaction was “you scored 0 out of a possible 0?” So the moral is, turn off scoring if you don’t use it.]

name, don’t talk about noobs. Everyone has the right to play IF however and at whatever skill level they wish.

That said, however you implement a word puzzle, don’t make it a guess-the-verb. While I would have tremendous respect for anyone who implemented DEFENESTRATE as a synonym for THROW OUT WINDOW, I would hate anyone who actually made you use that particular command instead of a perfectly reasonable synonym.

This is a good point. I think sometimes it might be OK to make people type in the exact word, if there’s enough cluing that that word is needed and why other synonyms won’t work. Ad Verbum has some puzzles like this. But you’d have to be pretty careful about it.

Roughly speaking, I think you should be able to enter anything that accurately represents what you’re referring to. So, if the game environment is the real world, TAKE, GET, PICK UP, etc, all represent the same action and should all work accordingly. Same with objects: if there’s a drinking glass, I should think DRINKING GLASS, GLASS, CUP, etc should all work; since TAKE GLASS and GET CUP clearly are trying to do the same thing, they should both work, even if there’s a very clever reason why TAKE GLASS makes much more sense in-game.

But I think it’s another thing altogether if you’re in some kind of nonstandard environment: a dream, a meta-computer, a surrealist game, or just an abstraction. In those cases, there might be no other words that represent what you’re referring to: the only way to ZERF THE QUIGDERB is to ZERF THE QUIGDERB.

(On the other hand, you can always have a word puzzle that indicates that taking the glass is what you’re supposed to do, but then allow you to take the glass using any wording you like. Telltale’s new Back to the Future game, which was great, had a puzzle like this: There’s a character having an argument in another room, and he slips in words hinting at what you’re supposed to do next.)

See: The Gostak. :slight_smile:

Well, in Ad Verbum you have a nonstandard environment. In particular – this isn’t very spoilery, and in fact I think is a pretty well-known fact about the game, but under the tag it goes in case you don’t want advance notice of the puzzles

there are some rooms where you can only use words starting with a certain letter. And you have to figure out how to pick up an object and leave the room while only using words that start with that letter. So in the S room you can’t just type “get spatula [or whatever it is]” even though that’s what you want to do. But this is pretty well clued – every word that the game prints while you’re in that room starts with S, so it’s easy to see what’s going on. And the whole fun of it is seeing how you can do what you want only using S words.

This probably counts as a non-standard environment, even though what you’re trying to do is standard.