Live data from Hacker News

How to program a text adventure in C

helderman.github.io

31–40 of 56 posts

Re: How to program a text adventure in C

#31
post #22

Earlier quoted context omitted.

I haven’t used lisp is 30 years, so help me understand/remember why this would be easier than say C++ or any other language with object inheritance and virtual functions. Is there something else about it?

OO is absolutely the wrong paradigm for interactive fiction. Writing a text adventure has been my favorite way to experiment with a new language for decades now, and I’ve gone down the OO rabbit hole too many times. For this use case, you want something more like an ECS, so that a single entity can be more than one kind of thing at the same time. Consider a talking robotic vehicle. It is an object in the world: the p…

Thanks - I hadn’t heard of ECS before. That expanded my mind :)

Re: How to program a text adventure in C

#32

Many years ago (circa 1993) I ported the original Colossal Cave adventure by Crowther and Woods to TADS, a language created by Mike Roberts specifically for authoring text adventures. (Colossal Cave just came up recently here.) 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 tex…

I wrote StoryHarp for creating speech-interactive choose-your-own text adventures back around 1998 (in Delphi for Windows desktop), and ported it to the web about seven years ago (with some limitations) using TypeScript and Tachyons: https://storyharp.com/v3.0

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.

Re: How to program a text adventure in C

#34
post #27

Earlier quoted context omitted.

Ron Gilbert's 1989 "Why Adventure Games Suck And What We Can Do About It" https://grumpygamer.com/why_adventure_games_suck/

Text adventures are not graphical adventures. Text games don't have the linearity and constraints of a graphical one. Compare Anchorhead, Devours, Spider and Web... with most point and click games.

Gilbert's essay wasn't limited to graphical adventure games.

Re: How to program a text adventure in C

#35

Many years ago (circa 1993) I ported the original Colossal Cave adventure by Crowther and Woods to TADS, a language created by Mike Roberts specifically for authoring text adventures. (Colossal Cave just came up recently here.) 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 tex…

cave is the first game i remember feeling immersed in. it was so good. its awesome you ported it!

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

Re: How to program a text adventure in C

#36
Didn't read the article, but my first reaction to "How to program a text adventure in C" is to write a language / tool in C, and then use it to program the actual game much faster and safer. A Lisp-like a or a Lua-like language would both be relatively easy to implement.

Infocom was famous for using this approach, for instance.

Re: How to program a text adventure in C

#37
I have long wanted to make a procedurally generated text adventure that focuses on economics, information, and politics rather than spatial exploration. This gets complicated quickly, of course. Basic microeconomics and armchair psychology gets one a bit of the way there, but not enough to generate compelling dialogue and intrigue -- at least I have not been successful.

Does anyone know of good prior art in this space?

Re: How to program a text adventure in C

#39
post #37

I have long wanted to make a procedurally generated text adventure that focuses on economics, information, and politics rather than spatial exploration. This gets complicated quickly, of course. Basic microeconomics and armchair psychology gets one a bit of the way there, but not enough to generate compelling dialogue and intrigue -- at least I have not been successful. Does anyone know of good prior art in this spac…

Kind of sounds like Drug Wars for the TI-86+

Re: How to program a text adventure in C

#40
I did once write a text-based adventure game in C, however I only did that to work out some of hte "plot" and the layout/objects I was going to work with.

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:

https://news.ycombinator.com/item?id=26946130

Post reply on HN