Skip navigation

Ok, so I’m still working out the engine for Kleptos, my text adventure project, but I am almost finished. This means that the rest of it is going to go very quickly, and I could be finished relatively soon. I’m going out of town Friday through Sunday, so I miss out on a fair amount of time I could be coding, so I expect to be done sometime next week. Exciting.

So my content management system is pretty much finished. It basically runs like this: when the game opens, an object I called the Library reads a bunch of files in a directory system I created for the project. The files make up all of the content of the game (as opposed to its structure), from the introduction and back story, to the description of each room of the house that appear at the top of the screen, to lists of possible commands.

The files are read into the Library one of 4 ways, based on how I want the game to handle it:

  1. as a big old chunk of text
  2. as a list
  3. as a dictionary, with every other line being a key and and a string as an item
  4. as above, but the items are all lists containing strings


So, for example, a list of items in the game would look like this in the text file:


dagger
stab slice dice
key
lock unlock
lamp
light throw
rock
drop throw

and would look like this, once Library has read it:

{"dagger":["stab","slice","dice}, "key":["lock","unlock"], "lamp":["light","throw"], "rock":["drop","throw"]}

From that point, it is a simple matter for the program to add and subtract words from the player’s vocabulary, depending on what his or her inventory contains at the moment. (E.g., you can only “stab” when you have the dagger.)

I was considering explaining some other aspects of the game, but it would take too long, and I’d like to wait until it’s all finished. I’ll say for right now that most of the game’s functionality is wrapped up in this system, where all the content is mapped out in text files, rather than in the code itself. I like the idea of keeping the two processes – composing the game and coding the game – separate. They are intertwined but nonetheless distinct.

I’m going make a point of posting more updates than usual as I get closer to my goal. I’d like to get some good practice in explaining what I’m doing – I can get tongue- (and finger-) tied trying to make it even barely comprehensible to other people, sometimes.

Happy coding, everyone!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: