Could you write IF given these constraints?

Hello, first time poster here. Been playing text adventures/IF since about 1985, now thinking about creating something myself. I’m a programmer by day, and found a neat, unorthodox technology to try and write IF in. I don’t have any writing experience myself, and to get a better understanding of the project I want to undertake, I’d like to ask if you could work with the follow constraints:

  • A response to input can only be given by replacing/adding to text that has been typed in by the user
  • There is no way to keep state (e.g. remember what picked up, what you’ve seen, where you are)
  • The text can’t be interrupted: no newlines
  • Optionally the “parser” could replace/add simple images, inline with the text

I realise this is very limited. I also know this is a bit vague, and I apologise for that. I don’t want to influence your thinking by revealing the technology I have in mind, but will add it later.

Could you write IF with the constraints mentioned about?

Probably not based on your constraints. I would need more info before committing myself. I would definitely require something to help me structure it and I do not use pictures or sound files. (It is supposed to be text.)

The real problem is the lack of state. I can’t think of any modern game—parser, hypertext, point-and-click, app store clickbait—that doesn’t have some notion of state. Apart from that I could see it working, at varying degrees of effectiveness.

I’m having trouble finding it again now, but I watched a presentation on YouTube, given by a game designer of modern, commercial choose-your-own-adventure type stories. His company put out at least a few, and he talked about what they learned from the early games and how their internal system was designed.

I recall that they didn’t have state (at least, it was mostly state free) other than where the user current was in the story. The stories were designed to appear as though they have a large branching factor, but actually the branches were short lived and would soon re-merge with the main trunk of the story, keeping it manageable and virtually eliminating the need for state.

This may be the link, but it might be a different talk about the same technology: youtube.com/watch?v=KYBf6Ko1I2k

You could certainly write a simple interactive story with that, but it would be close to the classic actual “Choose Your Own Adventure” books.

Anyone can write an interactive story just in plain text if they want (telling the reader to turn to page # for choices) that can be printed out. Similarly, a hyperlinked PDF or Word Doc can do the same thing. I believe there are a number of simple hyperlink ePub choice-narratives on Amazon. That was one of the features of Inklewriter - they could compile your game into an Amazon-friendly format, though I believe state-tracking didn’t carry over.

Paper PDF Example: Trapped in Time by Simon Christiansen. It won an XYZZY award for “Best Implementation” in 2013 because it was so cleverly done.
http://ifdb.tads.org/viewgame?id=juj5b61griyoswn2

I have even seen an experimental adventure game that was done in Excel.

I have an idea what medium you might be referring to. (Would I be correct in saying it might feel most natural in a mobile game?)

If I’m correct, I don’t really see why it has to be stateless; it’s certainly not well-suited to a world model with manipulable objects, but depending on the implementation you could still remember what the player chose to type before, and alter future branches accordingly. For instance, the game could leave off the text with something like “I confessed to…” and the player has to fill in a name; this sends the text off in a new direction, but it can still loop back later into the main narrative trunk, just with a state variable set that might influence future text.

By itself, I think it’s going to be hard - but not impossible - to be engaging with a single uninterrupted flow of text with no line breaks. I could see this being most effective in a short piece with an extremely strongly-characterized narrator - like if you played as a person trying to start a new life, but the game is always fighting against you by replacing your input with things from your old life. But you could also branch out by incorporating other related elements; I’m thinking something like AlethiCorp or Mikayla’s Phone, which simulate a complete digital interface with emails, text messages, etc. This lets you bring in some other narrative voices and interactions besides “single giant flow of text.”

Thanks everybody for your insights and links to examples!

What I had in mind is OpenType, the technology that renders text on computers. I’ve done some font engineering jobs and although I’m well aware of the limitations, I thought it might be fun to see if you could squeeze out a simple text adventure/riddle from it.

To get a quick idea of what OpenType can do, besides rendering fonts: sansbullshitsans.com/

So, the only true game mechanic you have is something like:

When the exact phrase ABC is typed, you can
…add XYZ to it
…change ABC to XYZ
…change A, B, or C to X, Y or Z

Simple example: if the user types “Open door”, you can change it to “Open door. The door opens and poison gas enters and you die!”. But, since you can’t keep state, you can’t determine if the user typed, for instance, “use key” or something.

That’s it, really. I didn’t undersell the limitedness, did I? The attraction would come from being able to “play” this wherever you can instal the font, and wherever these OpenType features are enabled. Not all software that allows customs fonts will enable any or all OpenType features. But it could theoretically be played in Photoshop, Word, your browser, the command line, etc…

I think you’ve underestimated this system’s ability to manage state. At a minimum, instead of a key, you’d tell the user a secret code phrase to use, coupled with the name of the door.

UNLOCK BLUE DOOR WITH MAUVE KEY. The door opens; a TANGERINE KEY is inside. From here, you can GO TO THE THRONE ROOM or GO TO THE DUNGEON.
GO TO THE DUNGEON. There’s a locked purple door here.
UNLOCK PURPLE DOOR WITH ORANGE KEY. You win!

I could see this being a Minecraft like game. If the phrase “rock” appears in the text, you can type “mine” in front of it and the whole thing collapses to “broken rock”.

Players could cheat by typing in the name of a thing they want to create, but you could give objects bizarre names.

This is peripheral, but I’ve always imagined a link-based interface where potentially any word could be interactable.

The story is written in named passages. It displays text as if you are reading a novel.

If you’re interested in the painting on the wall, you click the word “painting” and either:
-The prose cuts in a more detailed description of the painting.
-A temporary window appears with the passage describing the painting.
-Options to act on the painting “take the painting” “examine the painting” appear temporarily and fold away after you make the choice. If you take the painting, all mention of it is removed from the prose as it no longer “exists” in the room description.

Along with this, the author could tag “specific” links which go to a selected passage, and “global” links - which can display a passage that works on a phrase wherever it appears in the text. If you make a global “George” passage, the player will receive the window (potentially with available actions) by clicking on the word “George” wherever he appears. Optimally, the global passages could be tagged with variables such as “george-is-present” where if the chapter just mentions George you’d get the description; if he was actually “present” in the story, you’d also be able to converse.

If George peripherally mentions the murder weapon while nattering about the weather, the player could click on it to steer the conversation.

This is all just in my head, but it’s sort of a cross between what Texture does, and how the game Spondre handled links.

The other possibility with this would be a textual “SCUMM” type interface, where you’d construct commands in sentences by building them with words on the page one by one.

Hanon, to continue the tangent…

This is baked into Squiffy and you can insert Javascript to do other stuff.

There’s a system called Toothrot that does this.

As someone whose primary experience of “programming” has been to work on a CYOA with variables and if/then choices for a while now, I’ve started to realize that all these languages are at bottom about variables and if-then-else and such as that. As such, Javascript seems to be quite a popular jack-of-all-trades at the moment and it seems you can do a lot of different things with that language and similar ones.

According to the Church-Turing thesis, all programming languages are like that, not just IF languages, because all computable programs are nothing more than variables and if-then-else. en.wikipedia.org/wiki/Turing_machine

Yeah, that’s what I’ve been starting to realize as I’ve looked at more programming language examples!

So some uses of programming are about modeling or simulating, right? For instance, most video games and most IF (among other types of programs that also model or simulate). What is it about models or simulacra that is so fascinating? So, not just computer games, but also: real-life doll houses full of doll furniture. Novels. Movies, plays, songs.

There’s a movie/music video director named Michel Gondry who overtly creates simulacra in his videos and some of his movies. Their obvious insufficiency compared to reality doesn’t matter–it makes the work that much more fascinating. For example, the video for Around the World by Daft Punk has dancers walking in a circle on a platform, repeating a set pattern of dance moves. It’s more compelling than it sounds. Or the video for Bachelorette by Bjork, “an exploration of self-reference,”–the narrative in the video is like an endlessly repeating image in a couple of mirrors (that trick)–a story within a story within a story within a story (until it implodes under its own weight). en.wikipedia.org/wiki/Bachelorette_(song

One obvious answer is that models help us better understand the world–like the theory of relativity and all these other theories that have yielded electricity, sound recordings, computers…multitudes of modern conveniences…

…I think humans are compelled to model…

Same answer as Scott McCloud talked about for comics: they simplify away some aspects of reality. Thus they allow us to focus on other aspects, while filling in the missing detail in our heads to make a complete picture which fits both our own experience and the experience that the model (or cartoon) is trying to show.

For cartoons, it’s about visual portrayal – a few circles and arcs can turn into a fully-characterized person in your head. For interactive models, it’s about behavior. You can look at a cloud of moving dots and see a flock of birds, because that’s how they move.

Node JS…terminal stuff. Compile stuff separately… [Interest wanes.]

If there’s not an IDE, I’m probably not interested. I’m picky that way, and yes, it’s my loss. I’m high-maintenance, I know. I didn’t even get into ChoiceScript until there was a really viable IDE developed by the community.

Oh, and Squiffy is great. I would love to do something with it, but it tends to be like…third runner-up whenever I present the rose to the system I end up using for the next WIP.

I hear ya. But I ended up writing my CYOA in Scrivener because it lessened the pain of no IDE and I preferred it to TWINE’s IDE–which I think is kinda useless. I find the map it builds very hard to understand and in general I don’t like point-and-click.

Now I’m playing around with writing a CYOA in Dynalist (an outliner) and then I’ll use Microsoft Word’s sorta-like-regular-expressions find-and-replace to turn it into a Squiffy-compatible file.

That’s a great point!

I figured this was the case for many people and that’s why I’m currently building an IDE for toothrot. It takes care of all the compile stuff for you, builds games for browser, win, mac and linux. It walks you through errors in your code, colorizes the syntax of the story format and will itself be available for windows, linux and mac. It uses the same editor widget that Visual Studio Code uses.

I’m amazed people are already finding toothrot in the depths of the internet. I didn’t promote it yet because I think it’s not quite ready – but it’s hopefully getting there soon. I’m currently figuring out ways to create installers/packages for the IDE, and I still need to write more documentation and example games for toothrot itself.

I really appreciate that you’re making it friendly for people like me. I had heard of it some time ago and remember being interested, but I am severely bad at getting systems with multiple moving parts set up.

An IDE is a big plus when getting writers without code experience to consider a system.
Thanks for the update!

@dfabulich: That’s a fantastic idea! The biggest problem I saw was users accidentaly typing in the final instruction (e.g. open treasure chest) and it’d end the game without any of the necessary previous steps being taken. But your suggestion would work around that nicely by forcing a unique word to trigger the next clue.

So the “source code” for a game like this would be extremely simple: a “key” that needs to be typed in, and a “secret” that is then revealed. Note that the key can’t be too generic: if look would reveal You are in a dungeon, it will always do that, even if the word “look” is part of another sentence. For instance, The goblin shouts 'look out! would be turned into The goblin shouts 'You are in a dungeon out!.

A mini pseudo-adventure, in the format: key secret:

Premise: “You wake up in a room. There’s a fireplace and a locked door.”

Look at fireplace. It’s empty. There’s a loose brick.
Take brick. There are many bricks, which one?
Take loose brick. The brick reveals a red key. You take it.
Open door. It is locked.
Open door with key. Which key?
Open door with red key. You are free! Game over.
Unlock door. With what?
Unlock door with key. Which key?
Unlock door with red key. You are free! Game over.

Some observations:

Since there’s no state, these lines could both be “programmed” in any order, and could be typed in by the player in any order.

There is no wiggle room in interpretation: the key needs to be typed in exactly as provided in the “program”. If you want to make multiple ways of writing work, you’ll have to type them all out:

Open door with red key. You are free! Game over.
Open the door with red key. You are free! Game over.
Open door with the red key. You are free! Game over.
Open the door with the red key. You are free! Game over.

Etcetera. Also, every key is case sensitive, and spaced and punctuation need to match the key 100% as well.

I know this is hardly ideal, and of course you’re better off with a proper parser/engine, but I for one really enjoy the idea that maybe there’s a way to put a creative, fun little adventure into a font. As I said, I’m more of a tech guy, but if you feel the same and want to try writing something like this, let me know :slight_smile: