Some technical details about the game!


Procedural Level Generation & Difficulty Curve

The game is comprised of a single scene, which generates “chunks” as the player progresses. These chunks hold the level geometry such as pits and platforms, as well as any spawn points for randomized items, such as pickups. At any one time, there are six chunks active in the scene at one time; a chunk is disabled once it goes offscreen and is sent back into the pool queue.

Each chunk is assigned a difficulty, represented as an integer value. A “difficulty reader” takes a sample from an animation curve based on the player’s position in the world and spits out a value which represents the current difficulty; using a gradual incline, the game steadily grows in difficulty. Chunks are spawned based on the current in-game difficulty, with a degree of variance that can be set in-editor.

Moe gameplay + editor view

Gameplay (lower), editor view (above) to demonstrate how chunks are procedurally generated in front of the player

Object Pooling

Every object in the game is pooled and initialized OnEnable; this includes level chunks, coins, pickups, interactibles, audio, and visual effects (i.e. particles).

The game takes place in a museum, and so there are lots of varying objects that populate display cases. Each case is assigned a size and can be populated with a combination of objects that fit that specific case layout. Another way to do this would be to assign a size to the objects as well, and to fit a randomized collection of objects into that space, but the method I used proved to be more suitable for our asset workflow, as not every asset that was created fit into a certain size


As for some other objects:

  • posters are handled the same way as cases, in that they have spawn points in each chunk that show a different poster when the chunk is enabled
  • Pop cans and chip bags are spawned when the player knocks over a vending machine or garbage bin

Audio is pooled in a different way; it has a special Audio Factory class that generates audio. There is only one type of game object associated with audio FX, which has an Audio Source attached to it. This is a very simple game, and there are no SFX that have special settings for the Audio Source, so these pooled objects get re-used for each sound. If a sound is played, the object calling “playSound” calls on “AudioFactory” . “Play”, which takes an audio clip and an audio mixer group – this way the correct clip is played, and all sounds are mixed correctly.

Dependency Injection

  • One mega class holds all the settings
  • No objects are created or destroyed after initialization
  • Instead, pools are created, then they get all the settings from this
  • References are established in the bootstrapper; no logic is included in the objects themselves; GameObject.Find is never called