Thrive or Die Dev Blog #2 - Cellular Autonama


Pixabay

binary linebreak.png

Cellular Autonama, in a way, is a fancy term for Procedural Generation.

It's a way of creating an almost infinite amount of content, with minimal code. It can be used to lay down large swaths of land, complete with lakes, forests, mountains, and more. I can be used to generate enemies who don't all have exactly the same attributes, and objects in the world with varying dynamics as well.

It's all about directing the code to "make random choices" over executing specific commands.

binary linebreak.png

Just about everything in Thrive or Die will be randomly generated. The world currently gets generated in seven steps. This is obviously a very early version. I plan to add things like mountains, camps, even small towns, all random.
mapgeneration.png

The FirstBiome() procedure loops through all the tiles in the game world, and randomly turns them into different types of terrain based on probability. Once that's done, the SecondBiome() loops through each tile that got changed, and gives each of it's neighboring tiles, and each of IT'S neighboring tiles, a probability to change to the same type of terrain, expanding a single tile of water for example, into a pond or lake. The ThirdBiome() procedure then goes through the world smoothing out each "biome" by looking at each tile and determining what is around it, IE: If a single water tile is surrounded by grass, it will change back into a grass tile.

Once biomes are generated, the code then loops through each tile, giving it a chance to spawn a tree, rock, lilypad, or other type of "spawner object" depending on the type of terrain. A "spawner object" is something designated to spawn creatures or items during runtime. After spawners have been generated, the code has to then give each spawner a chance to spawn something it's supposed to, whether that be a wolf in a forest, or a broken rock in a cave.

There are always two maps "attached" to each other. One is above ground, the other, below. Sinkholes get randomly generated on the above ground map, so the last procedure needs to loop through, and make sure the area "below" the sinkhole is cleared out a bit so a player can dig and venture underground, where cave systems are generated just like forests and lakes above ground.

binary linebreak.png

I've been fascinated with procedural generation for some time now, and am glad to be working on a project with PG at it's core.

In the next Dev Blog, I'll be showcasing some of the in depth crafting system I have planned, and the intricate steps it will take to craft the numerous tools and items one will be able to create.

I'll also leave you with a sneak peek at the interface and some of the place holder graphics.

randomforest.png


Dev Blog #1


badge.gif
Follow me @thatsweeneyguy


H2
H3
H4
3 columns
2 columns
1 column
2 Comments