I am thinking about making a game that stores its world map in a 3 dimensional array and it renders the tiles to screen using OpenGL. This is fine, however when I draw things to the screen, I do NOT wish to simply brute force my way through the entire set of tiles and draw each of them on screen.
The only problem is that there are so many variables involved, I have no idea how I should deal with this.
1 - Render distance - While obviously rendering as far away as possible would be ideal, it would be highly impractical to simply allow the game to load as much of the world as it likes and render as much as it wants. How should I limit how much of the world I'd like to show? Should it just be an arbitrary preset distance or is there some sort of calculation I should be able to make?
2 - Running time - Even if I only rendered a simple 10x10x10 area, this would still require me to run a for loop through and draw 1000 blocks. Even if I give them variables that say which sides are definitely hidden by other blocks and stop it from drawing the inside blocks, I still have to iterate through them and this sounds like it could get slow, fast, especially if I want to draw any reasonably far distance. Is there some algorithm I could use that would only iterate through blocks that are actually drawable?
3 - Blocks that are behind other blocks - Is there any really fast way of determining what blocks are hidden from the camera behind other blocks and not drawing them? Would it be okay to just let OpenGL do this for me? Would it be okay not to worry about it at all?
Of course I may be looking at this entirely the wrong way, so your people's expertise on this subject would be greatly appreciated.