Wednesday, May 6, 2009

Linux command line game

One thing that has turned people off about linux is the scary white-computery-text-on-black-background command line. People who actually use it knows how much easier it is to just type in the commands, instead of looking for the menu for the feature; but for those that don't, it's like opening up a mechanical clock, who knows what will happen if you make a mistake.

Even though they look the same, text-based adventure games are really fun. Way back before graphics were 3d, heck even 2d, there were the text-based games. Just type in what you want to do, and your virtual avatar will try to do it in the virtual world. It is one step up from those choose-your-own-adventure books, ya know, the one where there's a choice at the bottom of each page, and you flip to the page that corresponds to the option that you chose. Good writing and some imagination makes them better than a lot of million-dollar games that are just boring.

Anyways, so I was doing some work on the terminal and I was also thinking about making a text-based game for a friend of mine and I made the connection: a text-based game in the termainal. So, each directory that you are in is a location, files in the directory are the different things that you can interact with, and /usr/bin will contain the actions that you can perform. Since there are symbolic links, it is totally possible to create a map that is arbitarily complex. Say you're in /start/room1/ there will be two files: LOOK and useSwitch. When you first ssh'd into the terminal, it will display a quick tutorial like, "to look around a location use: cat LOOK; and to perform an action use ./useSwitch". The file "LOOK" will contain a quick description of the room: "You are currently in a room that has a switch, use it by typing ./useSwitch", and when you type ./useSwitch, it will echo the text: " you flipped the switch, and a door appears" and add a symbolic link to the current directory to the next room.

There are two goals for this game: it's coooooooooolllllllllll, and it'll be a fun way to learn how to use the terminal. Right now, I'm making up the list of commands that should be in it, and how to make it a fun game... if you have suggestions, please leave it in the comment section!

directory - location
ls - find what's at a location
cd - change location
LOOK - text file of the description of the room
./executable - do something, may add files to the directory, or display text
john.person - binary file of information
/bin/talk john.person - start the program to have a conversation with john
/bin/attack john.person - start the program to attack this person -- after you beat him, something may happen
processes - this can be your party
ps - list your current party
kill signal pid - signal your party to perform an action.. or dismiss them
~/ contains your inventory, stat information? use "cd -" to return to the adventure
/bin/save - creates a symbolic link from your home directory to the current level.

cp/rm/mkdir - these commands might mess things up.....
pipe/direct to file/grep/wc/sudo/aptitude/

ideally this will actually be done in the filesystem, but... it may have to be done outside.