29

Ok, so I know roughly that a chunk is like a mass of generated terrain in minecraft.
I hear people say 'loading chunks' and I've seen questions about 'chunk errors' so I assume it is part of terrain generation.

My question is: What is the definition of 'chunk' and what is a chunk used for?

3
  • 9
    I'm a little surprised this hasn't been asked before.
    – MBraedley
    Sep 11, 2013 at 14:30
  • It's frequently asked about over at gamedev.
    – House
    Sep 12, 2013 at 5:24
  • @MBraedley Me too! I thought the answer would already be on this website.
    – LTPro
    Sep 12, 2013 at 6:31

3 Answers 3

35

A chunk is 16x16 column of blocks extending from the bottom to the top of the map.

The game generates new land when you explore and the terrain is generated in such chunks. The game also keeps loaded in memory only chunks that are near you. Technically, building the map from chunks is what made possible the "infinite" (for practical purposes) worlds in Minecraft.

There are several different phenomena called 'chunk error':

  • Client-only chunk error - if the client does not receive information for some chunks (because of network communication error) they appear as holes in the ground; usually can be fixed by re-joining on the server or forcing the client to reload the area around the player (F3 + A).
  • Server chunk error - usually if some world files are corrupted - acts like a real hole where you may fall in the void; can be fixed using external (3-rd party) tools.
  • Terrain generation boundary - sharp, straight edges in generated terrain or biomes. Although it is often referred to as 'chunk error', it is not really an error. Here is how it works:
    1. The terrain is generated randomly using a pseudo-random number generator.
    2. The generator is initialized with a number, called the world seed. This number is stored in the level file. Each world seed can be seen as 'key code' for completely different world from the universe of possible worlds.
    3. When the game needs a new chunk, it uses the seed (the 'key code') to create (to 'summon') the chunk. After the chunk is created, it is saved in the world files.
    4. If the 'key code', that is, the seed changes (intentional or not), newly generated chunks are from 'completely different world' (see 2. above).
    5. Whenever the terrain generator changes (like in the upcoming 1.7), this replaces the entire universe of possible worlds so the same 'key code' now refers to completely different world from the new universe.
    6. Either way the terrain and biome of the newly generated chunks does not match with the terrain/biome of the old saved chunks. See this example from the wiki.

For even more information, see the Minkecraft Wiki page on Chunks

6
  • 3
    Excellently worded multiverse science :)
    – Orc JMR
    Sep 11, 2013 at 13:20
  • 5
    Note that the whole "buffers only chunks near you" explains why grain doesn't grown or furnaces pause their smelting whenever there is no player within like, 5 chunks of them.
    – acolyte
    Sep 11, 2013 at 16:30
  • @acolyte I've always thought that was an odd oversite, rather than taking the in-game time when a chunk is unloaded and then applying all the 'missed time" all at once when the chunk is reloaded Sep 13, 2013 at 11:02
  • @RichardTingle i'm pretty sure it's to save PC resources. consider this. items on the ground despawn after like 10 minutes. but this only occurs if there is a player within 10 or so chunks. past that point, the items will not despawn, and their despawn timers don't run.
    – acolyte
    Sep 13, 2013 at 14:47
  • @acolyte Of course running them real time at (say 1 check a second) would be madness over a large area; grain matures and a graphics update is triggered etc etc. All very expensive. On the other hand a single huge tick when the chunk is reloaded (say a 21.5 minute tick as the chunks been unloaded for that long) is basically free; the graphics are being built anyway so all you have to do is a few hundred additions (of 21.5 minutes). Nothing compared to everything else that goes into a chunk load Sep 16, 2013 at 14:33
5

The other answers have very accurately described what a chunk is; a 16x16 column that represents a unit of terrain. Terrain is seeded, loaded and unloaded in these units. I will attempt to answer why they exist at all; as opposed to an amorphous continuum of blocks; loaded and unloaded as necessary.

Why not every block as its own object?

Each independent object that is passed to the graphics card has considerable overhead, its own connection to textures, a decision to render it or not has to be made etc etc. As such its implausible to have each block as its own independent object (I briefly programmed something like this; it was bad). This discounts the everything separate part of the spectrum.

Why not all the blocks together?

The other end of the spectrum is to have all the blocks grouped together as a single object (this would actually feel very similar to every block being separate). This would give the lowest overhead, but has several fatal drawbacks;

  • When you're not looking at something the graphics card can cull it saving resources, if its all one big object then this isn't possible; its all rendered or none of it is
  • Whenever you wanted to change a block (which happens a lot in minecraft) the whole thing would have to be rebuilt in less than one 60th of a second to look convincing and this just isn't possible.

Summary

Chunks are the intermediate position between these two extremes, you cut your number of independent objects down from hundreds of thousands of blocks down to a few hundred chunks but you can still cull parts of the scene you aren't looking at and if a block is added/removed you only need to rebuilt 1% of the scene instead of 100%

2

its a 16x16 blocks of land going from bedrock to sky. Minecraft Wiki Chunks

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .