Skip to content

Principles

Famro Fexl edited this page Jan 10, 2025 · 6 revisions

Principles

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

Coordinate Spaces

Coordinates need to be handled differently on the client and server.

Below are visual representations of the client's coordinate space (on the left/top) and the server's coordinate space (on the right/bottom). Each of the individual boxes in the grids represent the same wrapped world tiled onto a plane.

On the client side, the coordinate space stretches out forever, encompassing many boxes of the same world. This is how the "wrapping effect" is achieved.

On the server side, the coordinate space doesn't actually look like the picture, but the picture gives an idea how it operates.

In both pictures, their center coordinate is (0,0).

Translating between the server and the client:

  1. The server obtains the relative position of the client in the client's coordinate space. Because the client's render distance is limited to the minimum width of one of its grid's boxes, the server knows the client can only have one of every Wrapped Coordinate in its view.
  2. Based on this information, the server calculates the closest Unwrapped Coordinate to the client based on the Wrapped Coordinate it wants to translate. An Unwrapped Coordinate is just a multiple of the original Wrapped Coordinate, based on how many multiples of distance away from the original grid the client is.

Translating between the client and the server:

  1. In basic terms, the server divides the client's coordinate by the size of its grid box and returns the remainder.
Clone this wiki locally