

How to make a Text Adventure - willvarfar
http://williamedwardscoder.tumblr.com/post/21865366869/how-to-make-a-text-adventure

======
starwed
>We wanted to use Javascript so that the game could run in your browser.

But there are already at least two javascfipt interpreters for games written
in Inform 7 already!

<http://code.google.com/p/parchment/>

<http://eblong.com/zarf/glulx/quixe/>

~~~
lygaret
And a pretty neat site with parchment set up and hosting things:
<http://playfic.com>

------
jimmytucson
I enjoyed this article, thanks! Playing MUDs was one of my favorite pastimes
in high school and I often wonder whether text-based games will enjoy a
resurgence with the many new technologies being developed.

Side question... he mentions how you can't quite achieve this "room" object in
Python:

>you can’t turn to anonymous functions because Python doesn’t have them. You
can’t use dot notation to dereference the fields inside the structure because
Python uses [“key”] notation.

Why couldn't you subclass an object that has an 'on_enter' method? A nice side
benefit would be that you'd be able to use dot notation to refer to its
attributes!

    
    
        class Kitchen(Location):
            name = 'kitchen'
            description = 'Your kitchen is untidy and cramped.'
            visits = 0
            def on_enter(self):
                if (self.visits == 0):
                    #first time in this room
            ...
    

So far the magic of Javascript has been a bit over my head but I want to learn
more. Why is this something you'd need anonymous functions to accomplish? (And
why not just use Perl or some other language with them as opposed to JS?)

~~~
natep
When I see your class definition, I think "why define a whole class for just 1
room?" because then you have to separately define and instantiate every class,
an everything would effectively be a singleton (even if you didn't follow the
pattern). If you can treat code as data, and concisely define an anonymous
function, it saves a step.

Speaking of code==data and text adventures, I'm currently working my way
through the book Land of Lisp[1]. Some chapters just focus on new concepts,
but most illustrate concepts through the creation of a game (except for the
streams chapter, which has you write a web server). The first game is an
extremely basic text adventure. You can only move around and pick up objects,
but it did parse 'normal' keyboard input. Now that I'm a few chapters deeper,
I'm starting to see how it could be expanded to handle different actions, etc.

Another interesting approach to web-based adventure games is "Adventure Games
Live". Instead of typing, you select a radio button for the action you want.
Some of those games are extremely challenging (I've spent hours playing and
haven't finished many of them)

[1] landoflisp.com [2] <http://www.rinkworks.com/adventure/>

------
dfan
I don't understand how the fact that Inform 7 syntax looks like natural
language means that "you don't write any code at all." It's actually a really
interesting domain-specific language, though I don't know how well its lessons
generalize.

~~~
zem
the drawback (from the author's "where's the fun in that?" pov) is that
inform7 is for people who want to write text adventures, rather than text
adventure engines.

------
jiggy2011
I'm surprised there hasn't been more of a text adventure resurgence of late.

I can't remember playing one since MUDS were cool.

I don't even necessarily mean a fully text only game. What about something
like a slow paced game that combined beautiful prose read by a talented voice
actor with static hand drawn graphics or fully ray traced scenes.

Also we have better NLP now and better voice recognition which would make
things more interesting.

~~~
gmkoliver
Text adventures (interactive fiction), and muds for that matter, are alive and
well. I've been an active participant in both communities for many years so I
feel like I have some perspective on it; in fact I'd say text adventures have
seen a resurgence in the last few years. It's hard to say how much of that is
fueled by nostalgia though.

------
tikhonj
One of the projects in my very first CS course in college (based around SICP)
was to write a text adventure game in Scheme. It was certainly an interesting
project and a good introduction to OOP, but also a little tedious. If we were
working on our own stories instead of implementing the map and objects from a
project spec, it would have been much more interesting.

------
zserge
Talking about text adventures, the INSTEAD project is worth trying. It's a
simple text adventure game engine written in Lua and ported to many platforms,
including Android. <http://code.google.com/p/instead/> Also, it includes some
really interesting games.

~~~
brianobush
Cool, I have a text adventure idea I would like to try my hand at... however,
the examples are in Russian. Hmm,..

~~~
zserge
Yes, the developer is from Russia. But there's a nice english documentation as
well: <http://instead.syscall.ru/wiki/en/gamedev/documentation> Plus, INSTEAD
supports URQ games that have a much more simplified syntax.

~~~
brianobush
wow, that is seriously nice documentation. Thanks!

------
ivan_ah
Very cool.

I have never played text adventures on a computer, but I like the simplicity
of the idea of "connection between places".

Two suggestions: (A) You add a onkeypress listeners for the arrow keys to
mean: NORTH, EAST, WEST, SOUTH? (B) Add an ASCII ART version ;)

Text adventures are not too far from "choose your own adventure" books....
hm... this will kick ass as an educational app. Imagine the island is full of
"level spots" like in Mario World and each "spot" is one question from khan-
exercises.

~~~
willvarfar
Thanks :)

I think arrow keys are a bit overloaded inside text boxes already and should
be used for editing, but I would add "w" as a shortcut for "west" and "e" for
"east" etc if I could travel back in time.

Would also have added command-auto-completion like in IDEs. That'd stop the
complaints by people who don't know to type "HELP" ;)

------
ragmondo
I started making a text adventure over google chat - based on app engine (not
that this matters). The idea being that you could add / update / change the
"world structure" as well. Oh and it could easily be an MMO as well. Anybody
interested in helping me out / taking this over?

------
iRobot
Text adventures rocked until dungeon master came along and nuked the genre.
They may be nice to code, but life's too short and I would not play one again.

