mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
* refactor(chunk): add ChunkInfo and switch to shared_mutex for chunk access Introduced ChunkInfo struct to expose chunk metadata (position, seed, biome). Replaced std::mutex with std::shared_mutex for chunk map to allow concurrent read access. Added World::get_chunk_info() method. Temporarily disabled cave/river cleanup and debug biome reporting. * refactor(cave,river,chunk): use ChunkPos as key for paths and track cave existence * refactor(gameplay): use deterministic origin-based cave and river generation Compute cave and river paths on-the-fly per chunk from a deterministic origin instead of storing them globally. Remove concurrent hash map storage, shared mutexes, and related cleanup methods. This simplifies concurrency and reduces memory overhead. * refactor(world): remove unused chunk generation progress tracking
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#pragma once
|
|
#include "Cubed/gameplay/chunk_pos.hpp"
|
|
|
|
#include <array>
|
|
namespace Cubed {
|
|
|
|
constexpr int WORLD_SIZE_Y = 256;
|
|
constexpr int CHUNK_SIZE = 16;
|
|
constexpr int SEA_LEVEL = 63;
|
|
|
|
constexpr int MAX_UI_NUM = 1;
|
|
constexpr int MAX_BLOCK_STATUS = 1;
|
|
constexpr int MAX_BIOME_SUM = 4;
|
|
constexpr int MAX_CHARACTER = 128;
|
|
|
|
constexpr int PRE_LOAD_DISTANCE = 24;
|
|
|
|
constexpr int MAX_DISTANCE = 128;
|
|
constexpr int CROSS_PLANE_DISTANCE = 8;
|
|
constexpr float DEFAULT_FOV = 70.0f;
|
|
constexpr float DEFAULT_MAX_WALK_SPEED = 4.5f;
|
|
constexpr float DEFAULT_MAX_RUN_SPEED = 7.0f;
|
|
constexpr float DEFAULT_ACCELERATION = 10.0f;
|
|
constexpr float DEFAULT_DECELERATION = 15.0f;
|
|
constexpr float DEFAULT_G = 22.5f;
|
|
constexpr int SIZE_X = CHUNK_SIZE;
|
|
constexpr int SIZE_Y = WORLD_SIZE_Y;
|
|
constexpr int SIZE_Z = CHUNK_SIZE;
|
|
constexpr int RESERVED_THREADS = 3;
|
|
|
|
constexpr float DEFAULT_CAVE_PROBABILITY = 0.035f;
|
|
|
|
constexpr ChunkPos CHUNK_DIR[]{{1, 0}, {-1, 0}, {0, 1}, {0, -1},
|
|
{1, 1}, {-1, 1}, {1, -1}, {-1, -1}};
|
|
|
|
using HeightMapArray = std::array<std::array<int, CHUNK_SIZE>, CHUNK_SIZE>;
|
|
|
|
} // namespace Cubed
|