commit 550edbdb37019bbdfdd5aa4fd25a4640457b6883 from: p2r3 date: Sun Sep 7 11:07:12 2025 UTC centralize configuration options commit - 5bcab2500c61593112251ea899e9c10ce1722b72 commit + 550edbdb37019bbdfdd5aa4fd25a4640457b6883 blob - 03482ddb173f19f1ba0bce86fe1e89a67280144c blob + 173ad2e4f60df19bfd7221417bfba1abdad01042 --- include/globals.h +++ include/globals.h @@ -40,6 +40,31 @@ // Calculated from TIME_BETWEEN_TICKS #define TICKS_PER_SECOND ((float)1000000 / TIME_BETWEEN_TICKS) +// Initial world generation seed, will be hashed on startup +// Used in generating terrain and biomes +#define INITIAL_WORLD_SEED 0xA103DE6C + +// Initial general RNG seed, will be hashed on startup +// Used in random game events like item drops and mob behavior +#define INITIAL_RNG_SEED 0xE2B9419 + +// Size of each bilinearly interpolated area ("minichunk") +// For best performance, CHUNK_SIZE should be a power of 2 +#define CHUNK_SIZE 8 + +// Terrain low point - should start a bit below sea level for rivers/lakes +#define TERRAIN_BASE_HEIGHT 60 + +// Cave generation Y level +#define CAVE_BASE_DEPTH 24 + +// Size of every major biome in multiples of CHUNK_SIZE +// For best performance, should also be a power of 2 +#define BIOME_SIZE (CHUNK_SIZE * 8) + +// Calculated from BIOME_SIZE +#define BIOME_RADIUS (BIOME_SIZE / 2) + // How many visited chunk coordinates to "remember" // The server will not re-send chunks that the player has recently been in #define VISITED_HISTORY 4 blob - 53a637ae57a7cea96a2ba6c9d3c8dcae9d942db9 blob + a33fda21d0210d63a3a6d4cc0fff9c9527546588 --- include/worldgen.h +++ include/worldgen.h @@ -3,17 +3,6 @@ #include -// For best performance, CHUNK_SIZE should be a power of 2 -#define CHUNK_SIZE 8 -// Terrain low point - should start a bit below sea level for rivers/lakes -#define TERRAIN_BASE_HEIGHT 60 -// Center point of cave generation -#define CAVE_BASE_DEPTH 24 -// Size of every major biome in multiples of CHUNK_SIZE -// For best performance, should also be a power of 2 -#define BIOME_SIZE 64 -#define BIOME_RADIUS (BIOME_SIZE / 2) - typedef struct { short x; short z; blob - bbc7fdb767948228b193221022efa5479eaa4441 blob + 762955e72aacd62f780b2e1a729655819e06af60 --- src/globals.c +++ src/globals.c @@ -26,8 +26,8 @@ ssize_t recv_count; uint8_t recv_buffer[256] = {0}; -uint32_t world_seed = 0xA103DE6C; -uint32_t rng_seed = 0xE2B9419; +uint32_t world_seed = INITIAL_WORLD_SEED; +uint32_t rng_seed = INITIAL_RNG_SEED; uint16_t world_time = 0; uint32_t server_ticks = 0;