Writing web-based interactive fiction with Ink
inklestudios.com
inklestudios.com
I want to show this to a friend and I think an example would help give them an idea of what's possible.
Edit: Someone wrote a "portfolio" for their personal website which is pretty cool https://news.ycombinator.com/item?id=26765367
If anyone has any narrative examples that would be ideal.
(A few of those are false positives because someone made a personal scripting language called Ink, but most of them appear to be the interactive fiction from this article)
[0] https://www.springthing.net/2021/play_online/CopperCanyon/in... [1] https://www.springthing.net/2021/index.html
https://github.com/inkle/the-intercept/blob/master/Assets/In...
ETA:
here is a Cloak Of Darkness in Ink https://github.com/micabytes/mica-ink/blob/master/sample/clo... which can be compared to other languages http://www.firthworks.com/roger/cloak/
I'm starting over tomorrow.
There's one UX wrinkle I haven't sorted out yet, which is that I would ideally like to let readers propose new branches to support rebuttals/perspectives I didn't consider in the initial draft. Probably the cleanest way (particularly in my case, because the source is open) is to request PRs on the Ink script with new branches. But non-technical readers are unlikely to be comfortable working with PRs, even in a language as approachable as Ink.
Well, and a second, which is that in my ideal UX for something like this, I'd like support for explorable models (like in Jupyter). You could probably merge Ink and Jupyter because Ink's Javascript integration is open (I added support for "choices" that behaved as hyperlinks in my portfolio site linked above).
To that end, these days I'm exploring hacking the Godot editor into a browser of "model-driven documents", but life is busy so progress is slow.
I hear Bandersnatch had a huge issue editing and filming due to the same issue.
Deus Ex (2000) had similar issues. The game's story was originally intended to branch much harder than what actually shipped. Still, it's widely considered to be one of the best games ever made, owing in no small part to its emergent gameplay.
I think we're going to be entering the era of emergent story soon. After all, AI Dungeon exists today.
[0] https://news.ycombinator.com/item?id=26874918
[1] https://www.goodreads.com/book/show/1722845.Horror_and_the_H...
Interactive fiction markup language is a programming language - just with a weird syntax that's tuned for content-rich, control-poor programs. Kind of like SGML/XML is a format good for storing text-heavy, markup-lean data.
The same is the case with an interactive movie script. In both cases, your story forms a directed graph[0], and the reader/viewer traverses it. But you don't have to, and shouldn't, write out the whole graph![1]
Personally, when I see "managing complexity", I read "writing code". Because, once you look past all the minutiae of programming languages, build systems and computers, this is what programming is - managing complexity.
I don't think everyone should be a programmer, but I do hope the concepts used in software development will eventually become common knowledge.
--
[0] - Possibly infinite.
[1] - For the same reason you don't put your whole program into main() and don't write out conditional jumps as your only control structure.
You can graph dependency graphs and state machine graphs to try to look for bad patterns or unwinnable cases visually.
In one interesting extreme example Andrew Plotkin put a ton of work into building python tools to build the puzzle dependency graph of Hadean Lands to hard prove them (in the style of mathematical proofs) and make sure they didn't contain unaccounted for unwinnable states. Plotkin blogged a lot about that during the development of Hadean Lands.
Any object can potentially interact with any other object in the same scene (or in your inventory). These languages support standard language abstractions (classes, types, whatever) - but that will end up with very boring responses when you try to make two things interact with each other, and players don't enjoy the game if it has too much of this - it kills the suspension of disbelief. As such, game designers put in a lot of effort to put in custom responses and behavior just so that the player remains immersed in the game.
It's an O(N^2) problem.
They usually invent game dynamics to prevent this from happening (e.g. making sure you lose/consume objects to get from one part of the game to the next - so that N is drastically reduced).
I hate to say it, but your comment comes off a bit condescending. While Ink and Inform hide away some abstractions to make it easy for newcomers, plenty of games are written in TADS (easily the 2nd most popular language for IF), and you very much have to have a programmer mindset to write games in it. Telling a TADS programmer they need to think in terms of variables and functions is like telling a physicist he needs to understand calculus to model the world.
Upon re-reading, I think it may come off this way. I'm sorry - I didn't mean it.
My comment was mostly colored by experience with various IF examples I browsed over the years, including most recently poking around some RenPy-powered visual novels. In all those cases, the stories were vastly under-utilizing its markup language. By that I mean, you could cut the source down to 1/10th or less of its original size by introducing some loops and variable grouping; further still with procedures. Reading them felt like reading assembly output of heavily inlined code.
What I failed to communicate is that my complaint comes from a good place in my heart! The stories I just criticized were all good stories, packaged into great experiences. But then I see the mess inside and realize just how hard it was for the author to evolve it, how much time and pain and effort they've burned maintaining an script whose complexity grows like O(2^N), not O(N^2)! How much easier it would be for them, how much richer story they could deliver, if they used higher-level tools for the job.
> It's an O(N^2) problem.
In raw form, it's 2^N problem - it's all the little "visited-church_1?", "visited-church_2_night?", "ate-biscuit?" flags that are exploding. This is the part I see frequently mismanaged, where higher-level tooling would be helpful. You can build neat interactive stories with just some flags and conditionals, but what you write is limited by how much of the resulting state space you can keep in your head over time (the problems really start when you want to change something you written a while earlier).
> They usually invent game dynamics to prevent this from happening
That's a good, time-honed, high-level strategy :).
> that will end up with very boring responses when you try to make two things interact with each other, and players don't enjoy the game if it has too much of this - it kills the suspension of disbelief
That's true, and the same is also a problem with videogames with procedurally generated content (this and IF being essentially facets of the same thing). But there are ways around it, if the tooling helps you with this, and you know how to use it. That's why I'm wishing for some wider knowledge sharing of tools and techniques from the programming world, because we deal with structurally isomorphic problems every day, and have plenty of tricks up our sleeve, that could be useful for IF writers, or even managers and legislators (bureaucracy is a computing environment too - where rules are code, forms are messages, humans are the runtime).
> While Ink and Inform hide away some abstractions to make it easy for newcomers, plenty of games are written in TADS (easily the 2nd most popular language for IF), and you very much have to have a programmer mindset to write games in it. Telling a TADS programmer they need to think in terms of variables and functions is like telling a physicist he needs to understand calculus to model the world.
You're right, and I apologize here. I haven't seen TADS before. Skimming some sources downloaded from the project page, it definitely exposes you to some software development experience (including the less nice, and perhaps less relevant, parts too).
Also, if you want to create a non-English game i7 gets messy fast.
And the Z machine games can be run everywhere.
Declaring some room with i6 it's literally four lines of code:
The object name and the internal one, the description upon entering it, a light attribute, and a semicolon.
But I have created text based adventures (usually with some RPG-style combat) in C++ a few times for fun and it can be done in a fairly clean and simple way.
Using C wasn't too painful, but I agree that using something else would have been more straightforward. I've ended up in a situation where the user can type "USE TORCH", but really they want to type "LIGHT TORCH". So I added that as a synonym, but once you do that in a few different places you end up accidentally supporting commands such as:
LIGHT THE BOOK READ THE TORCH
They work, but they're utterly bogus from a logical point of view.
That said I'm pleased I managed to get it working at all, and my next step will be writing a third version using an infocom compiler & interpreter.
https://vetusware.com/download/Infocom%20CPM%20Interpreters%...
You can use infocpm. Just hexedit the COM file to match the DAT file (rename game.z3 to game.DAT).
For example, if the OG interpreter works with zork1.dat, hexedit the file and replace zork1 with "game" so it matches "game.dat".
Object -> "flashlight"
with name 'flashlight' 'torch',
description "It's a battery-powered flashlight, of the sort that switches on and off.",
after [;
SwitchOn: give self light;
SwitchOff: give self ~light;
],
has switchable ~on ~light;Even on mobile devices!
Which IF programs support Z machine output?
[1] https://github.com/coppolaemilio/dialogic
12-minute tutorial: https://www.youtube.com/watch?v=sYjgDIgD7AY
More past threads: https://news.ycombinator.com/item?id=26763071
Is there a way you could easily set the Ink variables based on that input and then create a story (of possible paths forward) from that current state?
*not the Dilbert guy, as far as I know
Additionally, Ink's script engine has been used inside of even 3D Unity games.
Ink in particular (as opposed to, say, Inform7) is strong here because it already supports Unity integration. Heaven's Vault was developed with Ink, and that's a 3D adventure game that happens to have its story branches managed by Ink but the user experience is far from typical IF fare.
But you can even make commercial parser games. Anchorhead and Hadean Lands are two relatively recent examples.
Said this, I'd like people knew Inform6 more, among IBG.pdf (Inform's Beginner Guide) and DM4.pdf (Inform6's manual).
The language is dumb easy. It's object oriented (almost literally, you declare in-game objects as... objects with properties), and the games can be run on legacy machines fastly, such as Amiga/Atari/68k Macs.
Here's an Inform6 libre game to start with:
http://www.amirrorclear.net/flowers/game/devours/
Also, I forgot: There's Puny Inform, a reduced subset from Inform6 with few changes here and there in order to create games targetting the 3th version of the Z-machine. Thus, the games will run anywhere, even on the C64, Spectrum, MSX, BBC, Linux, OSX, Windows... everywhere.
https://github.com/johanberntsson/PunyInform
Example on a commercial Z3 game:
https://hlabrande.itch.io/tristam-island
A libre one (Calypso):
http://microheaven.com/ozmoo/games/calypso/calypso.z3 https://github.com/dave-f/calypso
The refactoring isn't necessarily making it "simpler" (especially compared to something like Puny Inform or even the people that have resurrected ZIL for the challenge of writing games with it), as it is defining a higher level object (world) model than just raw VM characteristics like Inform 6 or otherwise writing directly for a Z-Machine. But if it does reduce the coupling between stages of Inform 7 compilation it does offer some interesting tools for world building that Ink or Inform 6 can't quite offer.
A talk on some of the refactor progress and goals: http://inform7.com/talks/2019/06/14/narrascope.html
Text adventures offer far more depth and gameplay choices and freedom to roam aorund.
I recently wrote an Ink-based game that, among other things, allows you to swap out one of the main characters based on an early choice, necessitating swapping out names, pronouns, behavior and dialogue throughout. You could manage this as a PDF, but you're looking at an exponential explosion in length. Much easier to handle it with variables, subroutines and text substitution.
So it's PostScript. But, could you get a game with the same playability and freedom such as Adventure?
I mean, roaming around and using objects tryung stuff without being annoyed because of the interface as it happens with hiperlink based games.
Because doing that with if6 is dumb easy, you can create better stories with a much higher interactivity and emergent gameplay.
On games written with Ink, most games I've seen are as "complex" as the Lone Wolf adaptations for Android.
That said, if you remember games like The Secret of Monkey Island, they attempted to capture the feel of a traditional text adventure, but they swapped out the parser for a visual interface with a limited vocabulary. I've seen at least one attempt to do something similar with Twine (a traditionally choice-based engine).
Not so much since mid-90's. That happened with GAC/PAWS/DAAD games for the ZX Spectrum, yes, but since Inform (specially inform6) targetting the ZMachine with the English library for i6 it made dumb easy to generate basic actions and synonyms to avoid that from the roots.
Ink is open source, and they run an instance of the editor etc so you can try it out and publish your own compositions (like Twine).
It's a games company trying to make better storytelling tech, they're not data mining anything.