Level generation

Rhys Patterson
ART + marketing
Published in
4 min readMar 17, 2017

One of the many topics of game design I have been keenly interested in during Jetpack City’s development is flow, the powerful experience a player can achieve when a game is so perfectly tuned with their actions that they experience a dance-like fluidness with the game world.

Additionally, I’ve discovered flow is hardly something that can be dialled in so effortlessly as flow = 1.0f. Rather, it is the synergy of a difficult, yet progressive, game design. Successful execution keeps a player entertained and challenged with continuous growth as they progress through a game.

As for my level design, it was important to find an efficient way to quickly produce varied levels that can be ordered and tuned into a progressive sequence that maintains the player’s attention, while constantly putting their growing skills on trial.

Early prototype with coloured rooftops

Level design

Early prototyping presented an enjoyable experience, but the level progression had eluded me. At first, controllable jetpack avatars were styled with a series of colours that would coincide with the building rooftops. Landing on a rooftop of the correct colour would trigger progress towards level completion, but was still an incomplete concept.

A Jetpack-friendly City

This eventually evolved into buildings presented with their naturally expected detail of windows, each either illuminated with light, or not. As the level progresses, illuminated windows will flash the necessary colour style a jetpack avatar will need to match to turn off the light. Once all lights are off, the level is complete!

Based on this approach, a game’s level needs to include buildings with varied heights, windows and light states. Preferably, this is not built manually by hand in the 3D space, there is no way I’d easily align buildings on my radial level plane!

So how do I generate a level, the smart(-est) way (I know)?

Smallest quantifiers

I broke down a level’s definition into 5 primary factors when considering the level’s requirements:

Scale: The physical size of the level, a percentage of the radial grid’s arc

Density: The amount of windows that will occupy the available level space, limited by the number of buildings available

Duration: The number of lights that need to be turned off to complete the level. More lights, the longer a level will take to complete

Spread: Distribution of windows into as few, or spread into as many, buildings as possible

Ratio: A even window distribution, or prominent skyscraper/low-rise height variance

Calculated design

The key to the level generation was limiting the quantifiers while still achieving sufficient variety. The 5 properties above each represent a percentage which, in addition to a random state seed, store a full level design in 1 integer and 5 floats, bite-size by any file storage standards!

As good an example as any, the level below has a reproducible uniqueness using the provided definition, no vector coordinates or level prefabs necessary.

Scale: 20% / Density: 63% / Duration: 49% / Spread: 12% / Ratio: 85% / Seed: 170309

Implementation

The level generator itself is mostly simplistic and was straight-forward to development, but the planning to get to this refined solution took significant effort which hopefully pays off with satisfying level output, along with the potential to provide endless level generation to players in the future.

Coupled with the responsiveness of the Unity Editor, fine-tuning and rapid level creation couldn’t be easier.

--

--

Rhys Patterson
ART + marketing

Software engineering and creativity enthusiast. @rhysjpatterson