How to make a Text Adventure
williamedwardscoder.tumblr.com
williamedwardscoder.tumblr.com
But there are already at least two javascfipt interpreters for games written in Inform 7 already!
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?)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/
Yes I didn't mean that; I'll rephrase
Good catch.
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.
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.
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" ;)