A Random Level Generator for Unity.
Assets > Import Package > Custom Package > Select the downloaded UnityPackage
This level maker works recursively. Each Level Piece placed is responsible for placing the next Level Piece. This happens untill no more valid Piece placements are available.
- Place the first level piece at any random tile on the top row.
- From the available empty tiles, select a random tile and place next Level Piece there.
- Update the former Level Piece according to the later one.
Note : The level pieces are pre made and the level generator randomly picks from those premade level pieces. If more variety is there in level pieces, more random levels will be generated.
Components :
- Da Grid : Grid is responsible for keeping track of whether a tile is empty or not. New Level Pieces are only placed on empty tiles.
- Level Generator : Level Generator is responsible for spawning the first level piece, spawning the hurdles and populating the other Level Pieces that are not the continuous path.
- Level Piece : Level Piece is a gameObject that can be spawned by the LevelGenerator. It is responsible for spawning the next Level Piece. It is spanwed as empty Level Piece (with no contents) at first and then changes its content according to the next Level Piece.
took me hours to make this gif ;-;
Game Maker's Toolkit : Spelunky Level Making Magic