Implement M5.3 versioned deterministic abiotic generation

This commit is contained in:
dingo
2026-09-26 14:23:24 -04:00
parent 0798410dae
commit e2f99b780f
14 changed files with 520 additions and 5 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ enum class WorldError : std::uint8_t {
invalid_cell
};
// Explicit edge candidate in {8,16,32,64}; no storage size has been adopted.
// Explicit edge candidate in {8,16,32,64}; coordinate API stays explicit; M5 storage selects 16.
[[nodiscard]] std::expected<ChunkLocation, WorldError> split(VoxelAddress voxel,
std::uint32_t edge) noexcept;
[[nodiscard]] std::expected<VoxelAddress, WorldError> join(ChunkLocation location,
+40
View File
@@ -0,0 +1,40 @@
#pragma once
#include "evo/world/coordinates.hpp"
#include <cstdint>
#include <expected>
#include <string_view>
#include <vector>
namespace evo::world {
inline constexpr std::uint32_t base_chunk_edge = 16;
inline constexpr std::uint32_t base_chunk_cells = 4096;
// Raw request, validated on every entry. No implicit upgrade to newer versions.
struct BaseDescriptor {
std::uint64_t seed{};
std::uint32_t coordinate_version{1};
std::uint32_t generator_version{1};
std::uint32_t material_version{1};
std::uint32_t edge{base_chunk_edge};
auto operator<=>(const BaseDescriptor&) const = default;
};
enum class GenerationError : std::uint8_t {
unsupported_coordinates,
unsupported_generator,
unsupported_materials,
unsupported_edge,
invalid_voxel,
invalid_chunk,
unknown_material
};
// Names carry no biological/chemical inventory or density.
[[nodiscard]] std::expected<std::string_view, GenerationError>
material_name(std::uint32_t table_version, MaterialId id) noexcept;
[[nodiscard]] std::expected<CellSample, GenerationError> base_sample(BaseDescriptor descriptor,
VoxelAddress address) noexcept;
// Bounded X-fast staging output, not resident chunk ownership or a wire record.
// Allocation exceptions propagate to the host boundary. No partial result escapes.
[[nodiscard]] std::expected<std::vector<CellSample>, GenerationError>
generate_base_chunk(BaseDescriptor descriptor, ChunkAddress address);
} // namespace evo::world