Triadic: Procedural Level Generation
Today's post is going to go over what I have been developing on the procedural level generator for my latest hyper casual game. This blog update will be a pretty abstract one, so if your eyes start to glaze over after about 30 seconds of reading and you have to go look at cat pictures instead, I don't blame you. If you decide to go ahead and read this post, it may help to read what this game is all about so you get what I'm writing about:
So basically, my generator will attempt to generate obstacles based on a few parameters. The generator is given a difficulty (ranging from 0 to 100) and then it does its best to match that difficulty based on the parameters it can play with. Here is the list of parameters it can modify for each set of obstacles it will generate:
This is the amount of space in between the obstacles being generated and the last obstacles that were generated. So if the generator wants to add a tremendous amount of difficulty, it will make the padding very small, since that means you will have a lot of obstacles flying at you that are very close together. Of course, to make an easier difficulty, the generator will instead make the padding larger to allow you to react less quickly.
This is simply how long the object is (length in the forward axis of where your ball is going). If an object is longer, then when you break that object, you now have more time until the next obstacle reaches you. While this accomplishes essentially the same thing as padding, this is different when it comes to things like hazards that can kill you. A bunch of small hazards that can kill you are much more dangerous, even if they are given lots of padded space in between them. This parameter can also affect difficulty when it is coupled with side to side movement of a hazard/obstacle.
Number of Cells
When the generator generates obstacles, it does so in a row that runs side to side (perpendicular to the direction you are travelling in). This row can be split into a bunch of different cells that hold multiple obstacles. So this parameter controls how many obstacles (or cells holding obstacles) are in a row. The more obstacles that are in the row, the harder the difficulty. This is especially true if there are multiple rows that have many cells consecutively, as this requires the player to react to lots of information all at once.
This is an easy one, it is the colors that each obstacle will be in each row. To make the difficulty harder, the generator will pick different colors to force the player to switch between the different colors quickly. It will need to take info about the previous generated obstacles to see what would be a good color to make the next obstacles.
All in all, I have my work cut out for me to get the generator to work correctly. I would also like to add some form of locking parameters to generate similar obstacles all in a row; for instance making the length locked to a certain amount for the next 10 obstacle rows so that they all look nice and uniform when they are generated.
Either way, this will take me a bit to finish and as usual I will do my best to post on what I've been working on. Thanks for reading!
- Michael Hart