I've been brainstorming the last few days on how I can cull parts of my terrain and city efficiently and have come up with the following. I actually think someone has used this before on these forums, but it's been so long I can't remember. I'm also wondering what some your solutions are, and if anyone knows what the practice is in the industry for those of you who have some professional experience.
If you think of sections of my city as 50 meter x 50 meter blocks, with 20x20 blocks, then you get a pretty decent size town. Since the player won't be scaling rooftops or over looking the city freely (they'll be a few pre-rendered or cg scenes), I can cull things pretty close to the chest around the player. I'll probably only need the nearest 2 blocks in any direction (so 25 out of 400). If I need to go higher, I could.
The terrain will, for the most part, be pretty level inside the city. I'll be using the lowest resolution map I can, but keeping in mind the following idea will need a higher res map.
Heightmaps use grayscale values calculated from using the RGB values in the image, but I could also tack on the alpha channel to my image and store another layer of information there, like rotation and position.
For example: My player is in block 13 of a 5 x 5 grid (dead center of the culling radius) with everything else having been culled away around that 5x5 grid. A pixel on the alpha channel of the 512 x 512 heightmap for block 13 is located at 32, 303. My game cross references the block number and the coordinates and sees that a building is suppose to be there. Not only that, but it see's how red the pixel is and rotates the building according (rotations would have to be out of 254 degrees instead of 360).
Blocks on the outside of the view distance would be loaded in but not displayed probably.
It just seems like a really packaged way to cull what I don't immediately need around me, and even contains all the position data I need to boot!
Some of the concerns I have is file size. Height maps take up a bit of room after a while with all the environments I could have. I suppose one solution would be to get everything I want in my block set up and positioned inside of a custom level editor and then export the height, position and rotation values out to a custom file type that could be read in later. I'm not sure, but I'm guessing that would take up less space, and probably even save on processing time as well.
Another concern I have is that I can't stack objections should I need to. I'm not sure this would be a problem though.
What are everyone's thoughts on this?
"If I have seen a little further it is by standing on the shoulders of Giants" - Isaac Newton
Current Project:
http://strewnfield.wordpress.com/ (Last updated 06/11/09)