5 ms·
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
by jimmytucson 15y ago
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 15y agoWhen 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/ http://www.rinkworks.com/adventure/