capnmidnight / small-town

A Multi-User Domain in Node.JS
7 stars 3 forks source link

Introduction

This is a basic Multi-User Dungeon written in Node.JS. The goal is to use this as a test-bed for works in interactive fiction.

It runs a WebSockets server that serves up a basic HTML page that is used as a client to connect to the game. The game runs off of simple text-file formats defining the items and rooms that the user can interact with. AI bots are a little difficult to define right now, but technically can be any level of complexity.

Playing the game

When the server is running and you connect to site, You're presented with a textbox in which to enter commands and a large field of text to display the results from the server. The gameplay follows fairly basic text-adventure style commands. I'm not going to link you to any particular MUDs. The ones I used to play are no longer running, and the ones that are still running are not very accessible. However, I would suggest playing the original Zork: http://pot.home.xs4all.nl/infocom/zork1.html

Imagine "now add other people" and that should give you an idea of how these sorts of games go.

Contributing

I'll take pull requests from just about anyone, considering I doubt just about anyone will want to contribute. I'll seriously consider adding you as a contributor if you ask.

Running the server

To run the game, use the command line in the project directory and run the command node server. This will start the server and wait for connections to be made from a browser. Use your favorite internet browser and connect to http://localhost:8080. This should display the green client page and you should be able to play the game.

I like to use Firefox, but don't limit yourself to only using one browser. The game should work on all browsers, so feel free to use whatever you want. The goal is to have this work on mobile devices, too.

There is an optional command-line switch that can be used to run a "cover all" test on the game. On your command line, type node server --test. This will create a testUser that starts at the very beginning of the game and execute in sequence the commands listed in script.txt. The server will run through the commands and print out a lot of text to demonstrate the results of each. Since there is so much, you might instead want to use node server --test > log.txt. This will write all of the output to a file called log.txt that you can then open and read in a text editor.

Playing the game

Once connected to the server, follow the on-screen instructions.

Commands

buy targetId itemId
sell targetId itemId
yell msg
say msg
tell targetId msg
quit
help
look
north
east
south
west
leave
up
down
enter
exit
take itemId
drop itemId
give targetId itemId
make recipeId
inv
drink itemId
equip itemId
remove itemId
who
attack targetId
loot targetId