Sponsored By

Puzzle Design in Last Train to Timbuktu: Difficulty Levels

I wrap up my series on "designing a puzzle designer" with a look at how difficulty levels influence puzzle creation.

Scott MacLean, Blogger

April 27, 2013

5 Min Read

This is the third and final post in my series about puzzle generation in Last Train to Timbuktu! Each puzzle, as you might know from the previous installments, is a scrambled grid of train tracks which the player must unscramble to connect a pair of train stations. Each move the player makes rotates a row or column of the track tiles. The first two posts in this series explained how the game generates single-path puzzles, and how those puzzles are elaborated upon with power-ups and bonus points.

This time, I'm going to talk about difficulty levels. Because the puzzles in Last Train to Timbuktu are randomly generated, the biggest challenge in creating the difficulty levels is to control that randomness so that each generated puzzle is appropriate for the difficulty level the user selected.

A difficulty 1 puzzle. A difficulty 1 puzzle.

Some puzzles at difficulty level 1.

To do so, I came up with an approach that allows for varying puzzle difficulties in the short-term, but a consistent average difficulty level over the long-term. That way, the player gets to feel smart with easier puzzles and be challenged by trickier ones, but the overall difficulty level is more-or-less constant.

The main idea behind this "variable consistent difficulty" is to set a target puzzle difficulty for each difficulty level. Then each time a puzzle is generated, compare its difficulty to the target. If it's too easy, make the target higher for the next puzzle; if it's too hard, make the target difficulty lower next time.

A difficulty 2 puzzle. A difficulty 2 puzzle.

Some puzzles at difficulty level 2.

To be a bit more precise, we first need a way of measuring a puzzle's difficulty numerically. This is actually fairly difficult to do in general. But as an approximation, we can just call the number of points awarded for solving the puzzle its "difficulty". Then the game follows these steps to generate a puzzle:

  1. Choose a puzzle board size appropriate to the target difficulty T.

  2. Generate a single path puzzle of that size (see part 1).

  3. Optionally embellish the puzzle with power-ups and bonuses (see part 2).

  4. Calculate how many moves to scramble the puzzle by so that its difficulty will be as close as possible to T.

  5. Scramble the puzzle (see part 1 again).

  6. Measure the puzzle's final difficulty D.

  7. Add T - D to the target difficulty for next time.

Most of these steps are self-explanatory, but I'd like to look a bit more closely at the interaction between the target difficulty T and the puzzle difficulty D. What's going on in the last step?

A difficulty 3 puzzle A difficulty 3 puzzle

Some puzzles at difficulty level 3.

Well, remember T is how difficult we want the puzzle to be for the player's selected difficulty level. In a perfect world, each puzzle generated would always have difficulty D equal to T. But because the puzzles are created randomly, this is exceptionally unlikely. So when we take T - D in step 7, we are measuring the difference between the generated puzzle's difficulty and the ideal difficulty. If the puzzle is too hard, the difference will be negative, and if it's too easy, the difference will be positive. Then the next puzzle's target difficulty is adjusted by that difference to keep the average difficulty constant.

As an analogy, you can think of the difficulty as a savings account where you plan to save a target amount (T) each month. But because of unexpected expenses or income (haha!), your actual amount saved (D) varies from month to month. So to stay on track, you tack the surplus or deficit onto next month's target.

A difficulty 4 puzzle A difficulty 4 puzzle

Some puzzles at difficulty level 4.

Of course, in practice things are a bit more complicated, but not by much. There are upper and lower caps on the difficulty at each level to prevent things from getting too out-of-balance, and some features like bonus points are disabled at low difficulty levels. But by-and-large, the straightforward approach I just described works well to create puzzles with interesting variations in difficulty, while maintaining a consistent challenge.

A difficulty 5 puzzle A difficulty 5 puzzle

Some puzzles at difficulty level 5.

Well, that wraps up my look at "designing a puzzle designer" for Last Train to Timbuktu! I hope you enjoyed the series, and enjoy the game as well! I can't quite send this out without adding a plug, so I invite you to check out the game for yourself to see the puzzle designer in action. There are free demos for Windows and Mac at http://greeneyedgames.ca/timbuktu.

Read more about:

2013Featured Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like