Here’s a shorter update, but sorry, no pics this time. I’ve spent a lot of time in the voxel chunk rendering code, perhaps too much time, but part of it has to do with converting chunks to 32x32x32 size.
Previously, every chunk was 32x256x32 in size (256 being the height). That seemed like a good idea at the time, so I could query only X and Z in world coordinates and not worry about height when it comes to lighting or neighbors. But it took too long to generate one chunk in my old laptop, which I want to use as a baseline spec for running games on older hardware. So I redid everything in the chunk management code.
It took a while but it was worth the trouble. Chunks are now cubic, and still queried individually for collision detection and rendering, but with more granularity in loading times. Making voxels from 3D noise is no longer prohibitively expensive which was also a very nice thing to discover.
Chunks with the same X and Z coordinates are grouped in a class called ChunkStack. For 256 units in height each ChunkStack contains 8 chunks. This class makes it easier to organize chunks by distance so I have 8 times less things to order, and also have it share the same 2-dimensional data for generating the chunk in each stack (so I don’t have to redraw the same portion of a height map or a biome map 8 times, for the 8 chunks). With the height data, an average height can be computed in order to find a good max and minimum height for each ChunkStack. In theory this would permit for worlds with heights that can span thousands of units, despite the stacks themselves being limited in height.
Finally, I added the ability for a chunk to connect to its up to 8 neighbors (on the sides and corners) and this is where loading and rendering meshes can get very flexible. It’s already working in that mesh creation is deferred until a 3×3 area of chunk voxels are loaded. This will aid in fixing the seams in shading that appear on the chunk borders.
Continuing on an Old Game
In non-voxel related news, I’m thinking of going back to finish the top-down shooter game which I barely started. It was supposed to the way I was going to go back into XNA programming, but designing the game with ECS in mind bogged me down so I’m gonna do away with it completely for this game. The most I have managed to do with it is move a 3D model around an empty room. But this game should be something I should be able to finish in a short time, so this will not be a big sidetrack from my voxel game. Just something I want to do quick and dirty, and still be enjoyable. Maybe it’ll be done as a challenge for One Game A Month.
Unlike last time, 3D will not be a hard requirement this time around, but just a potential upgrade after finishing the game in 2D. The game will be, as originally planned, a twitch combat style shooter with multiplayer support. Graphics will be more pixelated/retro in style with grayscale colors.