Explore! Build! Die!

Day 3: The Map Generator

Here we are again and it’s been… demanding. Developing an entire game engine proved to be much more effort than we had expected. However, there’s progress and I’m writing this article to tell you about it.

The map generator is working! Well, more or less. There is at least a working draft at the moment. On Monday it only generated some chunks, no dynamics at all. Now it dynamically generates chunks as needed. It was necessary do optimize a couple of the internal mechanisms to do so.

The chunks (1 chunk=10x10x10 blocks) are stored as simple numpy arrays of 16-bit unsigned integers (giving us 216 possible different chunk types, which should, in principle, be enough). Then there is a geometry generator, which processes one chunk per frame. They are queued as soon as they are required but can’t be loaded all at once.

Both the procedural chunk generator (intuitively called Globus) and the geometry generator had to be ported to cython, since they were way too slow in vanilla python.

Anyway, the engine works very well now. For now, there is only a piece of grass on two layers of dirt and rock. The height map is generated by interpolating random noise. But now, that the generation algorithm works dynamically, it should be quite easy to implement more complex terrain. I’m thinking about mountains and woodlands here.

Ah, and finally: the screenshots!

This is an earlier version without grass:

And here is grass: