Spellcaster Studios

Make it happen…

Caves

Today I squashed an old bug…

I had a cave planet whose generation ended up being this:

screen727

So the player couldn’t get out of the initial drop zone!

I have a lot of code to try to prevent this sort of thing, but sometimes some stuff falls through the cracks… That’s actually one of the big problems of procedural generation: you either have very boring and similar areas, or you risk having bad gameplay situations.

 

In the case of the cave levels, they are built by creating some noise (which can be biased towards more “walls” or more “floor”):

screen728

Then I apply a cellular automata to cluster stuff:

screen729

And to have a bit more open areas or closed areas, I add some random blobs on the noise:

screen730

screen731

And the blobs were the reason I was getting that bad circumstance in the beginning area… Solving it was just a matter of avoiding a blob too close of the starting area:

screen732

I also decided to try something else: add more floor near the center area, so the map becomes more dense/claustrophobic the more you go away from the starting area:

screen733

screen734

But it didn’t work:

screen735

I get too much of an empty space (because the cellular automata tends to get rid of small clumps)… Fine tuning the area a bit yields a very similar result to the initial one:

screen736

So, all put together:

screen737

So, I got rid of a bug, but spent an hour or so on a dead end, which annoys me, especially nowadays when I don’t have much time to work on the game!

Now listening to “Illumination” by “Tristania”

Comment