Monday, 13 December 2010

Next Project - A Game Book On The Web.

After creating a little text adventure and enjoying the process I thought I would stay with my childhood a while longer and create a small Choose Your Own Adventure or Game Book web game.

These multi-choice "books" seem to be undergoing a bit of a revival on iPhones with many of the classics being republished and new ones being created. I have fond childhood memories playing these and since the graphical requirement are practically zero. Well many provide pictures to accompany the text but that is not a requirement.

With my new zeal for keeping things to a minimum I set about figuring out a story line that is perhaps a bit derivative but also minimal. There are about 40 different locations and this is a more traditional multi-choice book so there are no statistics or dice rolling for battles. It is pretty much the experience of living through the story and deciding on the outcome. There are quite a few endings so perhaps it will be worth a couple goes at winning the game.

Technology wise I am using JavaScript as it will be a web game. I may port it to android if the mood takes me but that is for a later date and a separate project.

Creating a game like this requires typing in of text. I took the option of creating a simple text based mark up scheme to define all the locations and choices. I then process this text file using a python script I quickly pulled together and get it to spit out a JSON data structure. As the description of some locations depends on the state of the game, say an object you have or something that has happened, the mark up language needed a way for me to set state or pick up objects and query the game state to decide which text/options to display. It is simpler than it sounds but I did not want you thinking at was really trivial, my goal is to be 100% data driven.

Python is good at this sort of thing. As I was doing a preprocessing stage I added a validation routine that checks there a no dead option links, I may add further checks to the preprocessor, particularly if I keep making mistakes that are hard to track down in code.

Progress so far is quite reasonable. I have the story planned out on paper, wrote the python script and I messed around with JavaScript to begin getting the data loaded in. This evening I have spent a while typing in the locations and minimal descriptions but the choices all in place. It seems to take a surprising amount of time and I consider myself a fairly fast typist. I am well over half way so just a another hour or so working on it.

Once I have all the locations in place I plan to work on the JavaScript side of things to get it playable and then gradually add in the better written descriptions of the locations.

No comments:

Post a Comment