Skip to content

Instantly share code, notes, and snippets.

@untodesu
Created December 12, 2021 17:37
Show Gist options
  • Save untodesu/f35010f543423e57d7d7aba228933077 to your computer and use it in GitHub Desktop.
Save untodesu/f35010f543423e57d7d7aba228933077 to your computer and use it in GitHub Desktop.
Here are some thoughts about the world format
because storing all the chunks in memory sucks.
The format still has no name but I would name it
something like VG (as for VGame - project name)
or VX (as for Voxelius - game's name)
Core world configuration is stored in a specific
file called world.toml and placed in the root of
the "world/" subdirectory. This file contains
basic settings for the world such as (TBA) world
height limits, dimensions, etc.
Since there's no dimension support yet, chunks are
stored in the appropriate "world/chunks" subdirectory.
Each chunk is stored in raw binary format. Filenames
are formatted in the following way:
"c_{cx}_{cy}_{cz}" (cx, cy, cz - chunk position)
CHUNK STORAGE CHANGES:
New world format requires chunks to have a reference
counter that marks specific chunks for unloading:
if a multiple players share the same chunks and if one
of them disconnects, chunks shared with another player
should not be unloaded (I say more - client doesn't even
know that it shares chunks with an another client).
RENDER DISTANCE:
Server render distance is a cylinder with defined radius
and height in which chunks should be sent to the player.
Higher the radius and height, slower the server would work
if there's a lot of chunks.
EMPTY CHUNKS:
Empty chunks are not sent by the server but if a player places
a block in the empty chunk, the server, if not prohibited by
world.toml values, must make this chunk present and broadcast
this event to all the clients in render distance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment