Skip to content

Principles

Famro Fexl edited this page Nov 18, 2024 · 6 revisions

Principles

For this explanation, we will use a world with limits (-4, 4) on the X and Z axis.

Mechanics

World Limits

Each Level/Dimension can be configured with individual limits.

  1. The Nether can use different limits than The Overworld so nether portals line up.
  2. The End can loop or go on forever.
  3. This also allows custom limits for custom dimensions.

Chunk Limits

World limits are defined in terms of chunks. This allows the server to simply swap out chunks for other chunks rather than generate new chunks composed of two separate chunks.

When you enter in an axis' limit from -4 to 4 for example, the limit goes from the start of the minimum chunk (-4) to the start of the maximum chunk (4) (or [-4,4) as an algebraic interval). This means chunk 4 isn't actually included. This is required because world coordinates start at chunk (0,0) on the north-west side of that chunk.

Below you can see chunk coordinates in red and the (0,0) world coordinate in blue. Chunk Graph

Chunk Wrapping

When the client requires a chunk, the server interprets that chunk relative to its limits.

If the client requires chunk (-5,0) the server gives the client (3,0). The chunk (-5,0) is really just (3-8,0). Untitled Diagram(3)

If the client requires chunk (-13,0) the server also gives the client (3,0). The chunk (-13,0) is really just (3-16,0). Untitled Diagram(4)

Therefore, the actual chunk can be found by taking the remainder after dividing by the diameter of the X axis.

Coordinate Wrapping

When the client crosses over the limit, the server teleports the player to the other side. This allows collision systems and interaction distances to work properly. However, this teleportation does not take place on the client. Instead of teleporting, the client continues on, and the server compensates for this coordinate discrepancy by modifying the packets it sends the client.

Clone this wiki locally