Janx, on 20 November 2012 - 06:07 PM, said:
When it comes to the abstract aspect of computer science, I'm more or less clueless. I have very little experience with designing software, so it's difficult for me to think like a programmer. Everything I've posted up to this point is pure speculation, with some facts thrown in here and there. Like I said before, it will be quite some time before I know exactly what's going on inside a CPU while Minecraft is running.
Janx, on 20 November 2012 - 06:07 PM, said:
A block is going to be a class. It will probably have properties for:
block type
facing (because some blocks do have a facing)
From there, the simplest data structure is a to define the map as being a 3d array (895,895,128)*
*technically, the game divides that map into chunks, so you only define and pay for map space the user has visited, regardless of other details of the model.
BlockType zero could be allocated as the "air" block, which means empty air really does take up space. or they could have used NULL to mean an empty air block. In the never-null model, the game size remains the same. So if a block takes up 2 bytes to store, that's 2x895x895x128 blocks to store in RAM and on disk.
If they use nulls, it gets a bit more complicated. in RAM, it still takes up the same space because they system allocates that space when the array is defined. that's the point of an array. When it gets saved, it is serialized to a flat file, and that's when the null cells don't take up any space.
Here's an alternative structure:
the block class would carry the BlockType and Facing, as well as X,Y,Z. Instead using a 3d array of blocks, the blocks are stored in a 1d Collection of all the blocks. The game then pulls out which block is where by the individual block. Collections are expandable/shrinkable (unlike arrays). This method would mean that fewer blocks means less memory consumed. However, it would be much more CPU intensive to determine what blocks are in front of the player to display, than the 3d array model..
In any event, raising the sky limit means more potential blocks. So in ANY model, that means consuming more memory. Some models would be less efficient and make you pay for empty space, others might be more compact, but still, once people start filling this extra space, that'll take more memory.
I'm not sure how much of an effect ANVIL will have on RAM usage, if any. All I know as of now is the optimization seems to be focused mostly on filesize reduction. I'm not 100% sure on that though, I still haven't looked into it too much. Either way, if you feel like posting more about this, I would be more than interested in reading it.








