No more is the entire world a big 100x100x100 cube! Instead, I've implemented some basic worldgen using perlin noise. This sounds like it should be simple enough, and to be fair it almost was. However, you always end up encountering just one more thing that makes it that little bit harder to make it work. In this instance, I wanted to ensure that my world generation system was as robust as possible, to do this, I built it around what I call 'chunk preprocessors.' Preprocessors are simply a special class which contains a method invoked before a chunk is built. In this case, it's responsible for generating the terrain for that chunk if it hasn't been already. Chunk preprocessors are ran by the chunk generation thread, not on the main thread, allowing them to be relatively performant. However, if you are loading a lot of chunks you will see some slow-down. Being able to generate large worlds rapidly wasn't really a priority for me, since in-game you'll only be playing on fixed-size maps, however I still wanted to make the system as robust as possible.
Another thing I added is more dynamic blocks. Now, instead of block data just holding a name and texture, blocks can also have their own 'Process' methods. A block is processed when it is placed and every time any of its neighbouring blocks are modified. To test this, I made a grass block, which uses this process method. When a grass block is processed, it checks if the space above it is free, and if not converts itself into a dirt block, avoiding ugly stacks of grass.
peterkirkcaldy@gmail.com