Files
dingoandClaude Opus 5 d5b4bd068e Initial commit: architecture docs and headless engineering proof
Aeternalis Evolution, a custom-engine persistent evolutionary MMO.

This first commit establishes the project skeleton:

- Architecture and design docs: project vision, system overview,
  engineering constitution, roadmap, 19 ADRs, and the simulation,
  world, network, persistence and infrastructure architectures.
- Headless engineering proof: deterministic synthetic particles,
  component lifecycle, explicit PRNG streams, canonical snapshots
  and restored execution.
- Build and tooling: CMake 3.28+ / Ninja presets, C++23 feature
  check, clang-format and clang-tidy config, format check script,
  Windows check script, and a Docker build context.
- Tests: unit tests, benchmarks, a snapshot fuzz target and CLI
  integration wiring.

No gameplay, renderer, network service or running deployment yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 15:44:41 -04:00

55 lines
1.7 KiB
C++

#pragma once
#include "evo/core/random.hpp"
#include "evo/core/types.hpp"
#include <cstddef>
#include <cstdint>
#include <expected>
#include <span>
#include <vector>
namespace evo {
inline constexpr std::uint32_t format_version = 1;
inline constexpr std::uint32_t rules_version = 1;
inline constexpr std::uint64_t tick_quantum_us = 50'000;
inline constexpr std::uint32_t domain_extent_mm = 1'024;
inline constexpr std::uint32_t max_entities = 100'000;
inline constexpr std::size_t max_snapshot_bytes = 60 + 24 * max_entities;
struct EntityState {
EntityId id;
Position2 position;
Random random;
};
using Snapshot = std::vector<std::uint8_t>;
class SimulationWorld {
public:
explicit SimulationWorld(std::uint64_t seed) noexcept : seed_{seed} {}
[[nodiscard]] std::expected<EntityId, Error> create_entity(Position2 position = {});
[[nodiscard]] std::expected<void, Error> remove_entity(EntityId id);
[[nodiscard]] std::expected<void, Error> tick() noexcept;
// Non-owning inspection; mutation can invalidate views and references.
[[nodiscard]] std::span<const EntityState> entities() const noexcept {
return entities_;
}
[[nodiscard]] Tick current_tick() const noexcept {
return tick_;
}
[[nodiscard]] std::uint64_t seed() const noexcept {
return seed_;
}
[[nodiscard]] Snapshot serialize() const;
[[nodiscard]] std::uint64_t state_hash() const;
[[nodiscard]] static std::expected<SimulationWorld, Error>
restore(std::span<const std::uint8_t> bytes);
private:
std::uint64_t seed_;
Tick tick_{};
std::uint64_t next_id_{1};
std::vector<EntityState> entities_;
};
} // namespace evo