Simple mechanics, complex puzzle creation - Part 4: Interesting challenges

Jan. 12, 2017
protect

In previous parts, we defined our game mechanics and level complexity (1), then we found a way to automatically verify that a level respects the rules of our game, presenting a fair (2) and fun challenge and rate it on a 5-star scale (3).

We are now left with the final problem of deciding which levels are worth analyzing in the first place, as a correct level can still be pretty dull to solve.

Should the designer just randomly place blocks and hope for the best, testing level after level? Is there a set of characteristics that defines an “interesting” level?

Semi-procedural generation

As a starting point, we decided to attempt a procedural generation of levels where the designer could set some desired parameters and get a set of random levels to be play tested for final approval.

As some of the parameters that influence level topology such as size, block types, can be verified during generation but other parameters related to the level’s difficulty or its star rating can only be verified after checking it (as described in previous parts) the full process is a semi-procedural generation:

Procedural block placement -> generated level -> brute-force analysis -> keep/discard level

The list of input we can set in our generator is as follows:

  • Width,

  • Height,

  • the inclusion of up to 2 additional dynamic block types and how many blocks of that type (at least 2 red Skiddies are always present),

  • % of static blocks allowed in level’s inner area

  • How many exits for each Skiddy color and if different colors are allowed to be neighbors,

  • minimum - maximum moves for perfect,

  • target star rating (game levels must be 4 or more but lower ratings are useful for analysis)

All the above user defined parameters are used by the generator to randomly place the necessary blocks while avoiding generating wrong levels.

This requires that for every placed block, it must respect space constraints (as some blocks require a certain amount of empty neighbor blocks to function properly) and some other position rules, defined by the game mechanics:

  • Never create separate enclosed areas in a board

  • Never place static blocks or same colored Skiddies in front of goals

  • Never place two adjacent goals of the same color

  • Never corner a pushable crate with an L of static blocks

  • Never place pits in corners unless there is an adjacent goal

  • Never place adjacent pits

In this handmade test level, the top pit is useless as blocks will stop in the same spot against the corner wall (and keep this level’s rating at 3 stars). The bottom one, however, is not, because of the goal nearby. Without the pit, you couldn’t perform the perfect solution (Left, Down, Left) as one skiddy would disappear after the first left. Removing the top pit makes this a correct 5-star level (not a very interesting one though). In our procedural generation, the pit will never be placed in that position.

Should the generator fail while placing a block it will either try to reduce the blocks of that type or abort all together and start from scratch, depending on the situation.

In addition to these, Christian (the game designer) discovered an additional and very interesting parameter that is worth discussing in details.

Fearful symmetry

During the first hand-made attempts there was an easily perceivable influence of a level’s symmetry on our idea of “good level” so, after careful considerations about game mechanics, we recognized the following 4 types of symmetry as useful for our puzzle design:

Linear and diagonal symmetry are self-explanatory, the blocks are just mirrored following the symmetry’s axis.

Rotated symmetry takes the left half of the level and rotating it 180 degrees around a middle point.

Translated is just copying left inner blocks to the right while mirroring border blocks.

Depending on the size of a level, all symmetry can include some skipped blocks that are not influenced.

The effect of symmetry on a level is two-fold, not only does block placement give an ordered and cleaner look, but solutions become slightly easier for a player to visualize and being symmetric they are more forgiving, especially in starting moves

Symmetry example, either left or right are correct starting moves for a perfect solution. Even if perceptually we are inclined to go up at least on the first try.

 

 

We can add two more inputs to our generator:

  • level symmetry (including random placement)

  • Color swap during symmetry (to allow greater variation in levels)

Two examples of linear symmetry. On the left without color swap, on the right with color swap enabled. For the right board, perfect solutions (of course vertically symmetrical) are: Right, Up, Right, Down, Left, Up  (Yellow combo first) or Left, Up, Left, Down, Right, Up (Red combo first)

 

Fill in the blanks

In addition to this fully randomized mode, there’s another way we can generate a level, a “drawing mode”.

In this mode, the designer can draw some blocks (while the editor will enforce the same constraints as for randomly generated blocks) and fix them in place, set the parameters and let the generator just fill the empty parts of the level with different block configurations until the required number of pieces and the set level conditions are met.

We can draw and lock this layout (1 red skiddy, one ice block) and set a minimum of 3 moves for perfect and require 2 red Skiddies (the minimum for a combo)

The generator will add one skiddy and at least a goal and find a possible valid configuration. In this case, Down, Right, Down, is the perfect solution

Or this other variation (with the original blocks still in the same place). Perfect solution is Left, Up, Right, Up. 4 moves in this case as we didn’t set a maximum limit

Depending on the blocks already defined it is not always possible to get a valid level.

Whatever method of generation we used, once we have a complete level we then pass it to our checker which will solve it and analyze it with the methods we discussed before and determine if the solution is within the min/max required range and if the level rating is equal or greater than the required one. In addition, we’ll get the ratio of used level “states” over possible combinations (see part 1) and the maximum number of parents per node, both acting as a complexity indicator for the level.

A successful generation will not only create a level according to the required parameters but, because levels can be flipped and rotated, it will give us up to 8 variations of the same level, depending on its symmetry.

JikGuard.com, a high-tech security service provider focusing on game protection and anti-cheat, is committed to helping game companies solve the problem of cheats and hacks, and providing deeply integrated encryption protection solutions for games.

Read More>>