January 15, 2008

My First Scheme Program

Filed under: Scheme — bnsmith @ 4:15 am

Today, I am releasing my first (more or less) working Scheme program. I’m still only learning Scheme, so my work is not very sophisticated, but I hope this is just the beginning.

I named the program “Conversation Tree Writer.” It’s purpose is to allow someone to more easily write the “conversation trees” that are commonly used to express the plot in role-playing games (RPGs). Once the conversation trees have been written, the program then allows the user to step through the conversations and see if they work as intended.

If I understand correctly, my program implements a domain specific language (DSL) for expressing conversation trees. I implemented it with the ‘define-macro’ syntax, because it is a little easier for novices to pick up.

As you’ve probably guessed, the primary reason that I chose to write this program was as a learning exercise. However, I still hope that it might become useful to someone after a few more revisions. Someone working on a video game would probably find it very difficult to write these trees in a standard word processor. It would become something like a choose-your-own adventure book; adding a page would mean having to manually update all of the instructions for what page to turn to next.

Presumably, commercial game developers have some internal tools to ease this process, but I was not able to find any such open-source programs.

I’m currently distributing the source-code only, so you will need to install Gambit Scheme and SLIB to run it. See Getting Started with Scheme on Ubuntu Part 1 and Part 2 for instructions. After Scheme is set up, download the source code here, open a terminal, move to the directory where you extracted the source code and run this command:

./ctw.scm secure.ctw

You can then choose between the available options by entering a number.


Blog at

%d bloggers like this: