Well I told you all it would be a couple of weeks until I follow up on my last blog post and here we are, a “couple” weeks later. I promise you though, the wait has been worth it. I’ve accomplished some major updates to PJVoxels, and I am pumped to share them all with you! So let’s dive right in, starting with:
1: Variable Voxel Sizes
That’s right! You can now change the size of the individual voxel the world loads with. Without getting too into the weeds, the way this works is by subdividing the voxels present in the scene. Now we can use the same maximum world size for each Voxel Size, and get exponentially different voxel counts depending on the size we’re using. Since we’re dividing from a base Voxel Size, this does limit us to only using proportions of the base Voxel Size, but the 4 sizes currently available (1/8 for tiny, 1/4 for small, 1/2 for medium, and 1 for large) are good for most use cases. And since the base size is considered to be too big for normal use, treating like the maximum size means that somewhere in the smaller proportions is a good general use case size for us to use. Luckily, it just so happens that 1/2 is that size. Another issue is one who’s obstruction may be addressed depending on the use case, and that’s the world size. You see, Unity has a maximum amount of vertices it will render for a single object in the world. That maximum, for our purposes, is 65,535 vertices. Since each world is a singular chunk, that means our world has a maximum vertex count of 65,535. That means with each step smaller we go in Voxel Size, we have to cut the world size down considerably to compensate. Whether or not this is an issue that needs to be resolved is one I’ll answer once we have more testing, since I don’t know yet if it’s a big deal for people to be on a smaller chunk because there are more voxels to edit per base voxel. And testing world generation stuff will be much easier with another addition I’ve made:
2: World Generation Scene
Now it’s not just the developers who can set the world size, but also the users themselves! In addition to that, the player can also select which biome they want to use for their world. I’ve also included preview references for both the voxel size and the biomes so the player knows exactly what they’re generating when they decide. And what if a user really likes the world they’ve created, can they save it for later use? Well now, they absolutely can with:
3: Data Storage
The user can now save their world and use it as their base if they choose to during the World Generation Scene. There’s definitely a lot of work that still needs to be done in regards to this, but this first draft allows for a world of any size and biome to be saved. Currently they save the major details of the world and the type of voxel each voxel is in the scene. Then when that data is loaded in it just pulls from the save file instead of using the normal info SmallVoxelData.cs.
Conclusion
There have also been numerous minor updates and bugfixes including things like: Adding a pointer when placing voxels, Removed the ability to remove edge voxels so you can’t just fall through the world, Reduced the amount of vibrating between blocks, and I’ve already had to resolve issues tied to how the data is saved/loaded and when to use that data. So all in all there’s still a ton to do on this project, but this has been a great step forward. I look forward to reporting my progress and showing off more cool new updates in a few weeks. See you all then!