centralize configuration options

This commit is contained in:
p2r3
2025-09-07 14:07:12 +03:00
parent 5bcab2500c
commit 550edbdb37
3 changed files with 27 additions and 13 deletions

View File

@@ -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

View File

@@ -3,17 +3,6 @@
#include <stdint.h>
// 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;

View File

@@ -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;