So, I finally published ScottKit. Now what? What can you do with it?
You can build your own games, that’s what! Adventure games of the GO NORTH, GET LAMP, KILL TROLL variety. If that seems limited to you, consider that the same mechanisms can easily underlie games in any setting, and with any theme. It’s a style of gaming that gets you a lot of game for relatively little work: for example, the source code for Scott Adams’s own classic Adventureland, as decompiled with scottkit -d, comes to only 22 Kb.
I’ll write more about the charms of this kind of game creation in a subsequent post, but today I want to get you started in creating games.
Step 1. Install ScottKit
You’ll need Ruby. Installing that will depend on your operating system. Any Linux distribution will have it in a package: use apt-get install ruby on Debian-based distributions (including Ubuntu), yum install ruby on Red Hat-based distributions (including CentOS), or whatever package manager you use. If you’re on a Mac, MacPorts and homebrew both have packages: use something like port install ruby or brew install ruby.
Once you have Ruby installed, you also have its gem system for installing Ruby packages. Then you can simply gem install scottkit to get the latest released version (currently v1.1.0):
mike@sauropod:~$ sudo gem install scottkit Fetching: scottkit-1.1.0.gem (100%) Successfully installed scottkit-1.1.0 1 gem installed Installing ri documentation for scottkit-1.1.0... Installing RDoc documentation for scottkit-1.1.0... mike@sauropod:~$
And the scottkit program should be on your path. You’re ready to go!
(Note: depending on your setup, some or all of these steps may need to be done as root, the administrative superuser. If you are told you lack permission to do any of these steps, prefix your commands with sudo, and enter your usual password when prompted.)
Step 2. Create source code and compile it
Fire up your favourite text editor (that’ll be Emacs, of course) and write a file called game1.sck. (“game1” is the name of the game — you might want to pick something more evocative. “sck” is the usual extension for a ScottKit source file, but you don’t need to use it if you don’t want to.)
Start with this trivial game:
room chamber "square chamber" exit east dungeon room dungeon "gloomy dungeon" exit west chamber
That’s it: a complete game. It consists of two rooms, connected along the east-west line, which you can move between. (I didn’t say it was a good game.) Here’s a map:
Now you can compile it:
mike@sauropod:~$ scottkit -c game1.sck > game1.sao mike@sauropod:~$
You now have a compiled game file called game1.sao. (Again, “game1” is just the name of the game — you’ll want to use the same name as for the source file. And “sao” is the usual extension for compiled games.)
Step 3. Play the game
You’ve got a few choices here. You can play the game using ScottKit itself:
mike@sauropod:~$ scottkit game1.sao ScottKit, a Scott Adams game toolkit in Ruby. Release 1.0, (C) 2010 Mike Taylor <firstname.lastname@example.org> Distributed under the GNU software license I'm in a square chamber Obvious exits: East. Tell me what to do ? go east I'm in a gloomy dungeon Obvious exits: West. Tell me what to do ? go west I'm in a square chamber Obvious exits: East. Tell me what to do ? help You use word(s) I don't know! Tell me what to do ?
But ScottKit plays games in a relatively primitive way, simply emitting text in a stream. That’s good for some purposes (for example, it makes for great regression tests) but not necessarily what you want. You can get a more authentic 1980s Scott Adams adventure experience using ScottFree, which is available as a package for many operating systems:
mike@sauropod:~$ sudo apt-get install scottfree [sudo] password for mike: Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: scottfree 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/21.9 kB of archives. After this operation, 81.9 kB of additional disk space will be used. Selecting previously unselected package scottfree. (Reading database ... 35920 files and directories currently installed.) Unpacking scottfree (from .../scottfree_1.14-9_amd64.deb) ... Processing triggers for man-db ... Setting up scottfree (1.14-9) ... mike@sauropod:~$
Now you can use this curses-based program to play in split-screen mode, with the location description above the line and the dialogue below, using scottfree game1.sao:
Why, yes. Yes, it can. But more on that next time. If you’re keen to get ahead, you might be interested in the bare-bones tutorial, which builds on the two-room game we just created; and then in the reference manual, which explains the source language in detail.
Next up here: creating rooms and items in ScottKit.