I was thinking of Minecraft the other day and i wondered how he did it. So, i tried coding something really fast using simple arrays, but i soon encountered a wall.
Say the center of the world is at (0,0,0) and the world is supposed to be infinite in the X and Y direction, you can’t have negative arrays, even though the X and Y will have to be negative somehow.
For example, the center is at world[0][0] if the player moves left, you can’t access the array with, say, world[-1][0];
So is the solution to start creating the world really far like at world[1073741823][1073741823], and just hope the player never reaches the end of the infinite… finite world? (of course, the “world” array would contain “chunks” of, says 161616 cubes) Or you could have an even bigger array on top of “world”, say, “universe” which would contain other “world” arrays?
Also, i read the old thread by Markus Persson, and he was talking about octrees and chunked rendering. He dismissed the former as being too slow in favor of chunked rendering (which i have no idea what it is exactly, besides what the name implies). I looked a bit into it, but it seems i lack the mathematical knowledge to understand the reasoning behind it’s choice. Could someone explain it in plain english for me?
Well, where do i start? Is there a good read somewhere about this topic?