08-03-2016, 06:17 AM
So, for my next trick I will be working on refactoring tree generation, specifically implementing a simple way for server admins to add variations of tree types.
One thing is bugging me, though. When I was testing out converting tree generation to a more OO approach, I had to check whether there was space enough for the tree to grow. However, I had to write 2 different variations of the checking method because we have two different ways that trees can be generated: Through chunk generation, where cChunkDesc is used, and the cWorld::GrowTree* methods, where the world/chunk map is used.
I know this would take a big refactor of generation code, but shouldn't we be using a single generation path?
I mean cChunk is a data object, and when generating anything into the world the code needs to know information about the surrounding chunks, if available. Why not just use cChunk? I'm assuming it's a efficiency thing, but the way we are doing it right now, at least for trees, leads to then growing right next to each other, in separate chunks.
One thing is bugging me, though. When I was testing out converting tree generation to a more OO approach, I had to check whether there was space enough for the tree to grow. However, I had to write 2 different variations of the checking method because we have two different ways that trees can be generated: Through chunk generation, where cChunkDesc is used, and the cWorld::GrowTree* methods, where the world/chunk map is used.
I know this would take a big refactor of generation code, but shouldn't we be using a single generation path?
I mean cChunk is a data object, and when generating anything into the world the code needs to know information about the surrounding chunks, if available. Why not just use cChunk? I'm assuming it's a efficiency thing, but the way we are doing it right now, at least for trees, leads to then growing right next to each other, in separate chunks.