Triadic: Procedural Test Scene
So over the past couple weeks I have been perfecting the procedural obstacle generator. If you read my last blog post, you saw my ideas on how to design this step; basically I'm just implementing what I talked about last time.
I created a test scene to help visualize what the procedural generator actually does. Here's what it looks like:
At the bottom left of the image above, you can see a difficulty slider and a button to actually generate the row. On the bottom left is the details on that row's obstacle(s) as well as how difficult each value is and the overall total difficulty at the bottom. In the middle of the screen is the starting line which would be where the very top edge of the last row would end.
In this particular example, we can see that this row's requested difficulty is 21, but the total difficulty (bottom-right) is 16.86. The generator attempts to make a row as close to a difficulty of 21 as possible, but it will never go over. So when using the generator, you will only ever see difficulties that are at most the requested value.
As far as the row details, you can see that it has a height of 0.99, space (or padding) of 1.69 and 1 cell. As you can see, the space from the last row is actually what adds most of the difficulty here, as it would be closer to the last row. Let's take a look at some other examples.
Difficulty of 49
In this example, I generate a row with difficulty 49. Now we can see that the number of cells in this row is what adds most of the difficulty. The height and spacing is pretty much the same as the last row I generated with difficulty 21. Let's go ahead and generate another with some more difficulty.
Difficulty of 93
Here is a row that's very difficult, but only because it would be so close to the previous row, meaning you would need to destroy the last row and quickly switch to the color blue to destroy this row. I'll generate one more row with difficulty 93 to show something interesting.
Another Difficulty of 93
This row's difficulty is about the same as the last, but notice now that there is much more space and 4 cells instead of 1. This demonstrates what the procedural generator is really useful for: giving a row of a specific difficulty by modifying multiple parameters. In this way, I can make the game more difficult by creating random types of rows, rather than the game getting harder by simply making all the rows closer together or having more cells.
While the generator works how I planned, there is still some testing to be done to get the values just right (this step will come during game-play testing). As for what happens next, I will need to create different row types. The one you've seen so far is the most basic row type, which is just square obstacles. I need to add moving obstacles, hazards, and unbreakable objects as well.
When adding this next part, I will also need to add the ability for a row to look at the last row that was generated and modify its values accordingly. For example, if the last row's right half contains an unbreakable object, the next row cannot have it's left half also contain an unbreakable object (would be impossible to continue with a small enough spacing).
Anyhow, that's what I have for today, until next time. Thanks for reading!
- Michael Hart