https://ifdb.org/viewgame?id=c896g2rtsope497w
Graham Nelson ported my port to his Inform language, and Inform is probably your best choice if what you actually want to do is write a (plain text) adventure game.
If you want to learn C programming, writing a text adventure in C would be a fun learning project! But aside from pedagogy there’s no real reason to write a text adventure in anything other than Inform, TADS, etc. Not only is it much easier to use one of these purpose-built languages, with Inform you get multi-platform compatibility going back to the 8-bit era for free!
Personally if I had any free time, I’d be more interested in looking at how to use a frontier LLM like llama as an integral part of a text adventure. There was something like this using GPT-2 circulating on here a while back, but it was pretty rough.
However, it’s clear that if you figured out how to precisely control the LLM so it didn’t produce crazy stuff, you could realize the dream of truly realistic NPCs in these games. Text adventures would seem to be a perfect laboratory for experimenting with this.
Im playing with an LLM to remake drug wars. i pretty quickly changed it to more of a spiritual successor because i wanted to add more features and then had a hard time with them and the drug mechanic so i switched to financial trading and that made more sense. the i changed it to crypto coins in a dystopian future instead of stocks cuz the ascii art needed some lore to help flavor it now that gritty drugs were out
with Puny Inform6 or limiting Inform6, yes. If not, it's suicidal, even for v3 games. But, from Amiga and Atari machines, most v5 and v8 games if not all will run great.
Realistically, StoryHarp might be most fun to use as an authoring tools for kids making short idiosyncratic adventures to share with friends. StoryHarp could help people practice creative writing and learn just a bit of logic to set up puzzles (without getting bogged down in more computing complexity like writing C code or even just the conceptual demands of TADS or Inform, as amazing as those tools are).
I recently added a option (inspired by "flems.io") where you can create a StoryHarp link that includes the entire world definition in the hash. For example, here is a URL for a game that just says "You are visiting the Hacker News website" when you click "look": https://storyharp.com/v3.0/#world=N4Ig7g9gTgNgJgMQJYwKYDkCGB...
Otherwise the game stores data only in the browser (not the server) which can be exported or imported as files.
While I can see how LLMs might make for more realistic interactions with text adventures, writing text adventures is its own sort of puzzle (like coding programs manually), and I am not sure adding LLMs will really make creating such adventures a much more joyful experience. But maybe it could. I agree in general though that text adventures make a great playground for experimenting with new ideas (as with StoryHarp as an experiment in bringing browser ideas from Smalltalk into interactive fiction design).
P.S. I just expanded that Hacker News story with a couple more rules so you can have more of an experience: https://storyharp.com/v3.0/#world=N4Ig7g9gTgNgJgMQJYwKYDkCGB...
Anyway, that is the sort of idiosyncratic short experiential interactive fiction I am talking about. Just spend five or ten minutes and make something that captures an emotion or a theme or a concern or an moral conundrum or whatever.
I wanted to write my text adventure, but I'd offer reader to have multiple options, especially for those who are not really practical with english (includes myself ^-^).
For the creative side I would recommend trying out all kinds of things. Should your player be able to get stuck/into a dead end? Will players play once or many times. Can you "win" your game or is it more of a narrative? How do you want the player to feel!
For some more specific ideas, think about how your game branches. Branching and decisions in games are far trickier than they might appear. Too subtle and the player misses the choice entirely. Too in your face and they become boring ("kill the baby" vs "save the baby", gee I wonder which one takes me down the evil path)
Also, merely asking a question or giving a choice can influence the player. If you ask "who is the killer?" and give a list of suspects, one of them must have done it, even if the player never considered it. The question also assumes the player knows there was a murder and gives that away if they hadn't worked it out yet.
https://www.inform-fiction.org/manual/DM4.pdf
Crimes Against Mimesis was a famous tract in its day. I don't know how things have moved on since then.
https://www.rickandviv.net/index.php/2004/08/18/crimes-again...
- https://grumpygamer.com/why_adventure_games_suck/
Happy to share anything you'd find helpful. The big takeaway for me has been, you're going to want to graph out the impact of choices before you write the story. If you know the flow of decisions, then that gives a much clearer structure than trying to write the story first and then create branches off it. I think the reason is that it sets a much tighter scope for the writing doing it that way, whereas if you write the story and then find ways to branch it, the scope for that is functionally infinite.
Got any specific questions?
The Interactive Fiction Wiki is a nice place to start:
https://www.ifwiki.org/Main_Page
And if you search for something like "interactive fiction tips" you'll find tons of resources.
https://philipphagenlocher.de/post/video-game-dialogues-and-...
(introduces an interesting and useful way to think about dialogues, in my opinion)
https://philipphagenlocher.de/post/data-aware-dialogues-for-...
(further expands on the ideas of the first blog post, automatically ensuring that some properties that might be desirable)
* Text adventures are a case where it is really advantageous to separate the declaration and definition of objects, since cycles are ubiquitous. For C, consider X-macros, tentative definitions (not in C++, sadly), and using the section attribute to make the list implicit (or if you don't want to rely on compiler voodoo, just output the index during another pass).
* It may be useful to distinguish several ways an object belongs to a location: on top of, contained in, held by, equipped by, integral component of, death drop of. Additionally, "has never been moved [by player? by code]" is often desirable to record.
* Backwards ownership is fine for savefiles and initialization, but during runtime it can be useful to cache lists in the other direction. A dict may be worth it in a few places if your adventure gets big enough, but linear search is fine for a long time (and makes e.g. conditional passages easier; you should simply check that every conditional transition is eventually followed by an unconditional one with the same tag. To ensure conditions are handled uniformly, transitions with multiple names should canonicalize first).
* For C statically-allocated arrays within a struct initializer, we've been allowed to write `(T[]){t1, t2, t3}` for a quarter century now. There's no need to name the separate objects.
* It is very useful for the runtime to support the notion of "overlays" - used for things like menus which can use surprisingly similar logic to rooms. Saves should only ever look at the main game layer.
* Relative directions are very interesting, but tricky to add to a game.
What I wish I had was an example of a game that is complete enough to be interesting but not too big, to be used when porting to a new engine.
I speak from experience when I say if you start by writing the engine then you will quickly become side-tracked with technical issues and never get your game done.
I can recommend ink if you want a choice-based game. It is super easy to get started and the language lends itself to extension if you find it doesn't do what you need out of the box.
For choice based text games there is Twine and ink (plus many others).
I personally used ink[0] for a project[1] and it was a joy to use. It comes with an IDE of sorts that makes just sitting down and writing your story easy before you add the bells and whistles.
My actual aim was to write a simple text-adventure in Z80 assembly, which could run upon a CP/M system. I did achieve that, and later ported the game to the ZX Spectrum.
A few years after that I used one of the inform-compilers to recode a couple of the puzzles in the Z-machine, which would also have allowed me to run the game on a CP/M system, but to be honest by that point I'd lost interest and I never ported the whole of the game's text, and the two different endings etc.
That said my toy adventure was popular when submitted here, back in the day:
LLMs would definitely make a more dynamic and lively world for NPCs. I can even see a place for dynamic quest building. But it isn’t going to produce a full world without a significant amount of prompting.
I do see how it can help write a lot of boilerplate (item descriptions, back stories, etc). A big thing I always wanted is memory and we worked a long time on it for tracking logic (footprints, hunting). Conversational memory is probably single biggest thing that excites me.
Does anyone know of good prior art in this space?
A few observations on the C code (I didn't read all of it):
- please, no strtok
- a little more concentration on the UI, for example not using strcmp to test inputs
- make all preprocessor definitions be uppercase
- those conditional operators confused the hell out of me - just use if/else
[1] http://www.ulisp.com/show?383X
The English (and Spanish library -grammar, object and token translations- with INFSP6) it's something else. Among Inform Beginners' Guide, with DM4.pdf you can set anything, even new grammars, or a Tetris, if you want to dwell into low-level Inform6 functions.
Inform6 gives you literal game objects and attributes for free. The most literal OOP language ever. And the generated ZMachine games/ROMs will run from a m68k Amiga to an Iphone.
Infocom was famous for using this approach, for instance.
DOOM is essentially a text adventure but with fewer keywords.
I've lost too many hours to bad stdlib APIs.