Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

So I have an understanding of Minecraft world dimensions from this very helpful gaming.SE post. A key point in this Notchism is the following,

"Terrain is generated, saved and loaded, and (kind of) rendered in chunks of 16*16*128 blocks."

So I wrote this code based on some of the learning I was able to paste together from tutorials. It is essentially placed in code to be loaded by the ModLoader to generate uranium ore blocks when a world is being generated.

public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
    for(int i=0; i < 30; i++){ //Obviously the higher the upper 
    //bound the more likely the block
        int randPosX = chunkX + random.nextInt(16); //What exactly is being    
            //passed as chunkX? and chunkZ for that matter?
        int randPosY = random.nextInt(128);
        int randPosZ = chunkZ = random.nextInt(16);
        (new WorldGenMinable(oreUranium.blockID, 16)).generate(world, random, randPosX, randPosY, randPosZ);
    }
}

Notch's explanation makes the positioning more clear, but I had some questions about how the chunks are formed. My understanding (intuition? not sure what I'm basing this on) is that the chunks are not all generated at world initialization, and most are generated on demand. Is this true? If so, how much of the world is produced at the beginning?

Another thing I'm wondering is if the above code snippet is overwriting blocks after they are generated? I'd imagine this is the case as it is modifying what must be the per-existing world generation code?

share|improve this question
3  
You've asked two related questions within 10 minutes from each other, both which are more related to minecraft than game development. Please try to rephrase your question and tell us what problems you have related to gamedevelopment. – Roy T. May 4 '12 at 18:12
1  
To elaborate: This site isn't for finding out how game X did Y. However, if you're trying to make a game and want to do thing Y, then ask us how. – Jonathan Hobbs May 5 '12 at 1:29
I think I read Minecraft worlds have the potential to be the size of Neptune so I highly doubt the entire world is generate at the start. Probably just the chunk the player is in and any chunks they can see into up to the view distance limit. Then, as it is detected the player is getting close to seeing chunks that don't exist yet, create them. – Azaral May 5 '12 at 13:16
Seems too localized to me. – Yannbane Sep 29 '12 at 14:18

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.