Hi, Martin here. I thought I’d write about the levels made for Crazy Sorting Factory, as this is something we haven’t talked very much about publicly yet. Earlier this week we had a stream where Robin and I talked about while playing the game. You can watch it here on our YouTube channel: link to youtube video

Designing a level – complexity & execution

So. If you haven’t played Crazy Sorting Factory yet, the goal is to sort the different cakes into their corresponding boxes for points, essentially. Although, having played the game many players would say that the game looks and sounds much simpler than what it actually is while playing.

Now, let’s get to the point. When creating a level there’s two aspects that often comes back as thoughts behind the challenge: speed of execution and logical thinking. The pistons are primarily what gives the game complexity by letting the player send the cakes from one track to another. These pistons comes in two different modes: binary and trinary. Using only binary pistons gives the player two different game-states to consider, while the trinary sets it to three different game-states. Although when binary and trinary pistons are combined in a level, they together form a combination of a total of six game-states. So, as you can probably figure out, the combination of binary and trinary can make a level really complex by its own.

Because of how the objects spawn in a nice and fixed pattern in our game (yes, there might be a slight hint of perfectionism in me, but whatever), we can easily figure out how to maximize the player’s need of handling the pistons. The objects spawn every fourth ”step”, meaning that there’s room for exactly three other cakes between every cake spawned. By dividing the playing field into these four steps, it’s easy to count and see when objects will reach pistons during the stage.


In the level shown in the picture above, the upper-left objects will hit the piston on step 2, the upper-right on step 3, and the bottom one on step 9 (which is the same as step 1).  So for anyone into music this will be a piece of cake, right? (I’m sorry for my bad puns :C) As the pistons are placed in different steps, and we’ve used a combination of piston types, that level should be considered both tricky when it comes to execution, and hard for logical thinking. That level thankfully only spawns red cakes on the two top rows, so it isn’t quite as hard as it may look.

To wrap it up: speed of execution is drawn from having pistons placed in as many of the four ”steps” as possible. While the need for logical thinking comes from adding a complex pattern of piston-types into the level.

Working in Defold

Now I’ve tried to be brief about the thought-process that goes behind creating levels for the game. There’s of course many more factors to take into account, such as visibility, the player’s ability of focusing on multiple points of interest, and how the number of cake types also gives an increase in complexity, among other things.

However, now I want to talk about how I designed my levels using the Defold engine.

First we create a blank level. In Crazy Sorting Factory we use a 10×10 grid for our levels, so we know how big of a playing field we have to use. Then we have a number of objects needed for the level to work, but we’ll focus on the aspect of designing a level and the variables we have to play with. There’s tracks, spawners, pistons, score thresholds, and container types available for us.

Since Defold uses a grid, we can hold down shift while dragging around objects to let them snap to the grid, and since every object is sized properly to fit the grid, it’s easy to just make a level quickly and test it out. Defold is great in the way that testing goes so quick and easy.



I quickly threw together this level. As we can see here there’s a number of problems that makes this into a bad level. First and foremost we’re using all four steps. Then the bottom and top pistons happen simultaneously, which means one would have to be binary and the other trinary in order to make the level work. The three center pistons just makes this level impossible for the player. The second center piston will push objects down so that they align on top of the objects spawned from the bottom spawner. This could put the player in situations where they’re unable to sort all objects into their proper containers.

Just looking at this level makes me dizzy. I’ve made some really difficult levels, and I’m sorry for that, but this one is just too much. There’s an easy way to fix that though.


Now we’ve removed some of the cluster without making the level that much different mechanically. We’ve improved the visibility by letting all objects spawn in the same direction. The middle field is simpler to use now that it’s got less pistons. Since we’re still letting the top and bottom tracks handle its objects on the same step, we’ve instead given the player a tiny bit more breathing room by removing pistons from some of the other steps used by the middle row.

This level went from absurd to simple enough by just applying some easy fixes in under a minute.


Defold is handy in the way that you have all information right in front of you at all times. There’s a window for script properties, an outline for all the objects in the scene, a project explorer, and a log of what files you’ve changed so far since your last project commit. For Crazy Sorting Factory where there isn’t a huge amount of different objects to handle, Defold have been a very good tool to easily make and handle multiple levels at a time.