implement simulation shell

This commit is contained in:
2026-04-19 15:49:18 +02:00
parent 41fd2a83ee
commit ffe69f08b5
8 changed files with 275 additions and 0 deletions

41
src/lib/sim/Simulation.h Normal file
View File

@@ -0,0 +1,41 @@
#pragma once
#include <random>
#include <vector>
#include "EntityId.h"
#include "FireEvent.h"
#include "BlueprintDropEvent.h"
#include "GameConfig.h"
#include "Tick.h"
class Simulation
{
public:
explicit Simulation(const GameConfig& config, unsigned int seed = 0);
// Advances the simulation by one tick. Tick order per architecture.md §Tick Order.
// Currently a stub; subsystems are plugged in across Steps 3-7.
void tick();
// Returns all fire events accumulated since the last drain, clearing the
// internal queue. Call once per rendered frame (REQ-SHP-FIRING-BEAM).
std::vector<FireEvent> drainFireEvents();
// Returns all blueprint drop events since the last drain.
std::vector<BlueprintDropEvent> drainBlueprintDropEvents();
Tick currentTick() const;
private:
EntityId allocateId(); // Strictly increasing; never returns kInvalidEntityId.
const GameConfig& m_config;
std::mt19937 m_rng;
Tick m_currentTick;
EntityId m_nextId; // starts at 1; 0 is kInvalidEntityId.
std::vector<FireEvent> m_fireEvents;
std::vector<BlueprintDropEvent> m_blueprintDropEvents;
};