What is Aerogen mod?
Aerogen is a mod for the popular creative sandbox game Minecraft. A normal Minecraft world is made up of oceans and land with a variety of biomes. Different biomes have different features, such as mountains, trees, rivers, ponds, hills, etc. Players can find enjoyment from exploring the pseudo-randomly generated world, which is - for all intents and purposes - infinitely large on the PC version of the game.
Aerogen mod is a plugin I am writing for the game that provides an alternative world generator. My custom generator populates an infinite-ish world of floating island (masses of land suspended in the sky). Each island has its own unique features and belongs to a region, which is similar to Minecraft’s biomes.
Why develop a mod for Minecraft?
Some might wonder why I spend my time making a mod for Minecraft. Without addressing the issue of whether or not Minecraft (or games in general) are worth playing, let me tell you why Minecraft is a wonderful enviroment for developing a procedural world generator and visualizing the results in 3D.
Minecraft worlds are reasonably simple to generate. The world is set on a perfect 3D grid with an in-game size comparable to 1 meter. The world is VERY large in the X and Z dimensions, and up to 256 “meters” high in the Y dimension. Each block has a type (e.g. Stone, Dirt, Grass, Logs, Leaves, Water, etc.) and sometimes a small amount of data. This means that generating a world for Minecraft amounts to writing a routine that can produce an arrays of block types and optional data.
Once the world is generated, you can load up the game and run, jump, and fly through your code’s creations to see experience whatever you managed to produce. Minecraft even has a VR mod which allows headset owners to see the Minecraft world in a very large and immersive way.
So, why Minecraft? Because I love procedural generation and using an existing game is a lot easier than re-inventing the many wheels of Minecraft’s game engine. I also happen to like playing Minecraft.
I published an older version of my generator on the bukkit forms (here). I’m pretty happy that it got around 8,000 downloads without any advertising. I am now working on the newest version because I wasn’t happy with the original. Currently, the new version is a bit of a secret and isn’t published.
Developing this island generator has been a very fun and challenging task. To give an idea of what I’m dealing with here’s a short list of issues that have arisen while developing and how I solved them:
- If any islands overlap vertically, they cast huge dark shadows on eachother.
- Solution: Islands are generated using cells from a voronoi diagram, which prevents overlap.
- Every island needs to be uniquely generated and always produce the same result given the same seed.
- Solution: All random operations in island operation are seeded pseudo-random. Individual cells are given seeds based on the a hashing algorithm applied to the world’s “golbal” seed value and the coordinates of the cell center.
- Islands need to look somewhat natural. I will have a concept in mind of how they should look, but then I need to design procedures that make those ideas come to life.
- Solution: Island shapes use some pretty cool procedures I’ve invented, combining Fractal Simplex Noise, Distance Transforms, and arbitrary generated feature placement.
- My code needs to be fast enough that players can explore their infinite world without stalling the server.
- Solution: I have been moving my code over to a custom multi-threading task system. I can now specify procedures that need to be executed for each island or region. These procedures can even have prerequisites which are handled by the task manager and pre-empted over the current procedure depending on available threads.
- I wanted to have rivers flowing through regions and waterfall-ing from one island to another.
- Solution: When regions generate, they create a list of cells and then assign clumps of those cells to individual islands. Rivers and other inter-island features then generate and assign altitude constraints to a constraint system. Using these constraints, island’s are given an altitude and then populated with necessary features, such as waterfalls and basins.
I will be writing detailed posts on significant aspects of Aerogen mod’s development. This project deserves a lot more documentation than one post should reasonably cover. I will keep posts about this project somewhat short and on a specific topic. When those posts are finished, I will link to them here and create a table of contents.