itch.io is community of indie game creators and players

Devlogs

Week 8 - Level Blocking

Ricochet
A browser game made in HTML5

Working with the Random Level Generator.

Level Generator

I originally wanted to run the Random Level Generator using the TileMap from the tutorials and the Random Tile Generator (which was used for vases or something). However, after spending some time (probably too much) I found that this wasn't quite going the way I wanted it to. So what does one do when they can't figure out what to do? The Internet!
It was there I found the walker idea (thanks to Mehails Tumkins for the original code). The basic idea was to create a grid(x, y) and then create a number of "walkers" that will walk around the grid recording the squares they walk on whilst staying away from the edge of the grid.
These squares become the floor of the level. 

In addition to this, if a square has multiple floor neighbours, then these numbers can be added together. Once all the squares have been assigned then the script will add the appropriate wall tile prefabs to their assigned squares. 
Each of these wall tile prefabs come with a box collider to create the effect of actual walls.

After the walls have all been created, the game will then add in the exit square, usually as far from the player as possible while still being inside the map, because we don't want to make it too easy. This particular tile prefab also comes with an exit script attached to it, which will, when touched by the player, regenerate and restart the whole level. This gives the effect of entering into another level, or proceeding further down into the Dungeons of Dread! My intention is, in this script to add a counter which will be attached to the enemies, making them harder/faster on each level down you go. In addition to this, the counter will also be the high score for the player, the more levels down you go, the higher the score. 

Enemies

As you can see in the gif's, there are spawners happening for enemies. Currently they are just circles (with an added shader), but they are also generated randomly with the level at random locations.

References
M. Tumkins, https://medium.com/@mihailstumkins/how-to-create-random-levels-with-unity-3d-221..., viewed 3 Sept 2020.

Files

  • 10 Sept.zip 7 MB
    Sep 10, 2020
Leave a comment