This time I and a friend had a weekend of “let’s just code something from the ground up and see how far we get”. Turns out we got quite far. Apart from making an the actual game level, some color tweaking and so on, this is basically a game ready to play.
A bit of wallpaper, some paint here and there, a full game level, a new points system display and it’s ready to rock!
So this weekend I got it in my head that I should render cubes. Lots of them. Since I usually rather make things up as I go and get something working before reading up on a technique, I tried about 10 approaches before ending up with this:
Basically, the algorithm is buffered and overshoots the camera frustum slightly to all sides, making sure that it has time to fill in the blanks before the camera moves too much. There’s still a lot of room to crank up the update frequency before frame rates start dropping, but this is really good enough.
The reason you see blocks remaining after the frustum moves past is that there is an equally lazy cleanup algorithm being run every now and again (about 500ms at this point), and it too is conservative in what it chooses to clean up, just in case the camera would suddenly turn the other way.