2011
12.23

The paths more traveled

Today I want to lift the veil and go behind the scenes here at the Tin HQ. I have been a bit quiet on the blog in the past few months. This is because we have been working on some really cool tools to help us make gamebooks better for our readers. (not to mention the new books that are coming up, the Android/Mac/PC port, and a whole slew of other goodies I can’t mention!)

First off I wanted to give a shout out to Ariel and Clinton (@elephantish and @foolhardygames on the twitters, follow them!) who have come on to help us out. Ariel is working on a new Orlandes based gamebook and Clinton is building a really cool automated testing tool, which is what I wanted to talk about today.

You may or may not know but we have an editor program that we built from the ground up (twice actually) that is specifically geared towards writing gamebooks. It makes the creation of the links and the inventory items and the combats and the dice rolling all really easy and it has a built-in game sim that allows the authors and editors to basically play the game as they are editing it. This has increased our productivity to be able to create quality gamebook content dramatically.

However there is still room for error.

If you have ever tried to write a gamebook then you know that one or the biggest problems is making sure that all of your choices are internally consistent.

This means that if you have a choice like:

If you have the Stabby Knife, turn to 35.

Or if you have the Choppy Axe of Chopping, turn to 273.

This is fine unless there is some path through your book where you could end up in this section without either the Stabby Knife or the Choppy Axe of Chopping. In this case the player will get stuck.

We never want the players to get stuck. A player getting stuck is the equivalent of a crashing bug in my mind. It is supremely frustrating so we want to try an make sure that never happens.

And one thing that we love about our gamebooks is that we can have a great deal of complexity going on behind the scenes to make the adventures more immersive. There are dozens and dozens of hidden items that you pick up as you move through the books (in addition to the regular items) and each one of those items informs the links in the later sections of the books. So you can imagine that keeping track of all that gets mighty complicated.

So how do we do this now?

First off: the author writes the book and they do their best to keep everything logically consistent. Then we have a technical editor (like Ariel) go through every section and make sure all of the links work properly and the narrative flows in each path. Finally we have a copy editor run through the whole book looking for any missed grammar and typo errors, and they also try to keep an eye out for inconsistencies.

Then we start doing internal builds where the Tin Crew gets the game on device and we all play through it a few dozen times. Once we have found all of the big glaring errors, we then do a limited beta release and let our beta testers run through the book. And we repeat the internal/external betas until we cant find any more issues.

All of this testing usually uncovers dozens and dozens of game logic bugs that we can fix before it ever hits the shelves.

So finally after we are happy that the book is in the best shape we can get it we release it to the masses.

Trust me when I tell you that collectively the Tin Team reads through each adventure hundreds if not thousands of times before it gets to the app store.

But inevitably we miss one or two and our faithful readers let us know where they are so that we can fix them in a patch.

So why is it so hard to find all of the bugs?

Lets have a quick look at the first 12 sections of Gamebook 1 (spoilers!.. not really). If we discount the fitness checks and combat for a moment and just focus on unique paths I can come up with a whole bunch:

1-45-91-64-49
1-45-91-64-412
1-45-91-73-49
1-45-91-73-412
1-45-52-31-412
1-45-52-31-5
1-17-45-91-64-49
1-17-45-91-64-412
1-17-45-91-73-49
1-17-45-91-73-412
1-17-45-52-31-412
1-17-45-52-31-5
1-25-45-91-64-49
1-25-45-91-64-412
1-25-45-91-73-49
1-25-45-91-73-412
1-25-45-52-31-412
1-25-45-52-31-5

So there are 18 unique paths through those 12 sections. Just to give you a quick idea of how big GA1 is here is the whole book: (with the first 12 sections in light green)
Yes it is small and blurry, and no you can't zoom and enhance and get the solution map to GA1.

Now, some links are dependant on your Fitness level and your Vitality, so we need to test each path with min/max for fitness and vitality so that gives us 4 times as many unique paths:

min VIT, min FIT -> 18 paths
min VIT, max FIT -> 18 paths
max VIT, min FIT -> 18 paths
max VIT, max FIT -> 18 paths

so in the first 12 sections of a book that has about 520 sections we already have to test 72 unique paths.

This sounds like the perfect problem for a computer!

So: Clinton has been tasked with creating an automated gamebook playing program, called GAP (Gamebook Auto Player). He has been working away on this for a few weeks now and has created an amazing bit of code. It will test every single possible path through a gamebook with every single possible roll of the dice, combat resolution, and skill check.

As you can imagine, this is no small task, and it takes a looooong time to test every single path through one of our gamebooks.

So this week we put it to the ultimate test, we set Gappy up playing Gamebook 1 on one of the spare laptops and just let it go.

We ran it for 60 hours before I killed it because the data output file had grown to 26 gigs and the laptop was running out of disk space.

Some interesting stats:
In the 60 hours it ran:

it traversed 2,252,184 unique paths from start to an ending.
it picked up 76,602,977 items
it visited 248,890,218 sections
and it saw 25,926,696 illustrations

(note these run-throughs did not simulate every combat nor every fitness roll, so there isnt a unique path for every possible combat result, just one for a win and one for a lose etc.)

Since it never finished, these arent totals, or probably even close, but we can make some interesting stats from them:

An average playthrough of GA1 is:
110 sections long
unlocks 12 images
and picks up 34 items

Now, as I mentioned it never finished. Since the gamebook structure isn’t a proper binary tree and the dice rolling adds to the complexity quite a bit, it is hard to calculate just exactly how many total unique paths exist in gamebook 1, but I have a hunch that it is much bigger than 2 million. (our best back of the envelope estimates were somewhere between 14 and 500 million, but we could be totally wrong about that)

However, for the average gamebook reader, the vast majority of those unique playthroughs are functionally identical. So the next step is to use the GAP to figure out how to collapse most of those 2 million playthroughs into meaningful data. This is the next step of the project! (that and to make it multi-threaded so it has a chance of completing in our lifetimes 🙂

In any case, it is an exciting time here! And hopefully we will be able to use some of this tech soon to help keep our gamebook fans happy!

Cheers!
-Ben

9 comments so far

Add Your Comment
  1. That’s pretty interesting. (I’m also astounded at looking at how large the gamebook schematic is when you lay it out like that!)

    I was thinking about how I would write a program like that, but I guess my version wouldn’t be too different. 😀

  2. Very interesting Tin Man, makes me want to write a gamebook of my own!

  3. Hey John,

    Yeah, and this is GA1, our shortest gamebook. GA5 and GA6 clock in at nearly 200 sections longer, and Spider God is longer still by another 40 or 50 sections.!

  4. Hello,

    I’m just going through GA1. I find it to be a lot of fun. Just wanted to point out that Choice of Games have a related piece of software to go through their games, which is available for public use. You could ask them about it and/or collaborate to make an even better version.

    David

  5. Hi David. Glad you’re enjoying GA1. Because we have more complex game mechanics than the Choise of Games (dice rolling etc) we need to have our own internal tools specific to our engine. At the moment we would rather not make this public domain although we are looking to release our editor at some point in the future to buy.

  6. Hi again.

    I understand your point. I just thought that maybe there was no point in reinventing the wheel…

    I am not sure where to put this, but it would be nice if there was an option to get e-mails when someone else replies to a comment you’ve posted, like on other blogs. I remember posting on another article, but I don’t remember where now… Of course, making this an option would be better than forcing it onto people.

    Also, since I’m off-topic anyway. I believe the story in GA1 and GA3 to be much better than GA2. I think that with this type of game, being a book and all, it’s very important to have a good narrative and I thought it lacking in GA2. GA2 seemed like a hack and slash ARPG, with little to no real choices. The choices were all guesswork as it was: “go left” or “go right” or “go to door #1”.
    Even though GA1 is much shorter than GA2, the way it was written makes it feel as if the choices have a much bigger impact and that the choices are at least somewhat informed.

    GA2, again, seemed to just be random choices and sometimes fighting goblins with no real direction to it or any idea what’s happening.

    The only time I felt this way in GA1 was when I got to the end of the game and the only reason I lost is because I didn’t look into a tomb to find a specific item required to win.

    I haven’t gone through all of GA3 yet, but it at least has the illusion of much more “freedom” and maybe different opportunities to get to a good ending…

    Sorry for putting this here, but I thought it might help giving my impressions of the game.

    Great work and I hope to read more books like GA1 and 3 🙂

  7. It’s good this thread is moderated. If you don’t want to approve the message you can e-mail me on the e-mail address I provided, so as to keep the blog comments clean 🙂

    Sorry for the double post.

  8. This all sounds very exciting, and I cant wait for my first play through. Unfortunately I tweaked the resolution to the highest setting in the pre-game setup screen because I have an rMBP, I also checked the small box that would prevent the setup screen from appearing whenever I started the game… I wasn’t really thinking that one through… Anyhow, now all I can see is the bottom left corner of what I assume is the title screen/main menu. I’ve tried reinstalling the game, however that hasn’t fixed the issue… Any ideas on how I can fix this? I’m not complaining by any means, I manage to get myself into unlikely situations fairly often, just looking forward to playing your games.

  9. Basically you need to close down the game if you have it running and then hold down the Option key and start it back up. This should popup the rezolution setting box so you can change it. The other thing that may work (if that does not) is to hit command-F while the game is running. This should switch between windowed and fullscreen and should restore the game to a playable resolution.