The revision of my world geography objects inspired a lot of other thought about how my world was going to work. Specifically how I was going to represent or store the important parts of my world. This in turn resulted in me digging in with a notebook and a pen and starting to try to figure out what I would need and how it would work.
Once I had my basics in place on paper, I started making all of the changes needed to make them possible. The first was to start making loads of additional data structures. After all the talking about clusters, I needed to finish creating the class that represents them. I had additional ideas about world features as an external structure, which led me to the idea of a BitList for storing large numbers of booleans efficiently without all the extra features or auto-sizing that Java’s BitSet provides. The idea of having lots of features meant that keeping some sort of index to help know when to use them would be handy so the FeatureIndex and WorldVolume classes were born. And so on…
Next, my current design of IByteBufferSerializable was missing the idea of data structures that were variable size so I added that. Also, I wanted to remove the serialization header from the size the objects reported for their serialized size. As it turned out, this change to support variable sized objects meant it was actually helpful to have two different functions for reporting the size of serialized objects. One for the size of the data, and the other for the size of the data plus the header (because the header is a variable size too). This makes slightly different hoops to jump through with serializing and deserializing, but in the end I believe them to be simpler hoops than remembering to include the header every time in my reported size. Several of my data classes didn’t even support IByteBufferSerializable and others needed to be revised to match the new patterns.
Finally, I wanted to add piles and piles of tests to ensure all the various parts of my fancy data structures worked the way I expected. It would be a shame to be writing a world generator later on and to think something not appearing in the world correctly was because I screwed something up in the generator when in fact the error is in the way the data structure is holding the data. You could literally waste hours or days trying to figure out where you went wrong all because you thought you got your data structures correct. For that reason, similar to the massive numbers of math library tests, the data structure tests need to be extremely careful and complete. If you can’t trust they are behaving properly when you are using them somewhere else, you don’t know where the actual problem you are encountering is coming from.
Next I get to try to figure out how the heck things actually spatially line up in all these structures when considering the “real world” rendering of the places you will walk around. My three dimensional chunk structure makes that frustratingly difficult to draw on paper, so it’s going to be a bit of mental gymnastics before I have the actual graphics pipeline working.