cntrl/src/game/game.hpp
dandovlatov 78f058176d FBC: NIGHT SHIFT - scaffolded the project and delivered grey-box milestones M0-M2, laying the C++23/raylib horde-survivor base
Control-universe Vampire Survivors-like horde survivor (C++23 + CMake + raylib 6.2 via FetchContent).

- sim/render split: raylib-free core/game, deterministic 60 Hz tick, PCG32 seeds
- RoR2-style corruption scaling + credit spawn director (too-cheap rule)
- 4 Objects of Power weapons with levels 1-4 and Altered Form evolutions
- VS-style Board Directive drafts, damage numbers, brutalist diorama presenter
- docs: game design, art direction, technical design, roadmap

Milestones M0-M2 complete and validated (250 enemies @ 60 fps stress capture).
2026-10-24 09:46:55 +04:00

75 lines
1.9 KiB
C++

#pragma once
#include <cstdint>
#include "core/events.hpp"
#include "core/rng.hpp"
#include "game/corruption.hpp"
#include "game/director.hpp"
#include "game/enemies.hpp"
#include "game/input.hpp"
#include "game/pickups.hpp"
#include "game/player.hpp"
#include "game/weapons.hpp"
enum class GameState { Playing, LevelUp, GameOver };
// Level-up offer kinds (Vampire Survivors structure, Control skin).
enum class OfferKind {
Directive, // passive perk
WeaponNew, // claim a new OoP
WeaponUpgrade, // tune an OoP up (levels 2-4)
Evolution, // Altered Form: OoP lv4 + required Directive
};
struct LevelUpChoice {
const char* title = "";
const char* desc = "";
OfferKind kind = OfferKind::Directive;
int a = -1; // directive id or weapon type
int b = 0; // target level (upgrade)
};
struct GameConfig {
float arena_half = 26.0f;
int max_enemies = 260;
int max_weapons = 4;
bool no_player_damage = false; // dev stress mode (--no-damage)
};
// The whole simulation. Fixed 60 Hz ticks (see main.cpp). No raylib here:
// main fills InputState, the presenter reads the world and drains `events`.
class Game {
public:
explicit Game(std::uint64_t seed);
void update(const InputState& in, float dt);
void reset();
// World state (read by the presenter/UI).
GameState state = GameState::Playing;
Player player;
EnemySystem enemy_system;
WeaponSystem weapon_system;
PickupSystem pickup_system;
Corruption corruption;
Director director;
EventQueue events;
Rng rng;
GameConfig config;
float run_time = 0.0f;
int kills = 0;
int level = 1;
float xp = 0.0f;
float xp_to_next = 6.0f;
LevelUpChoice levelup_choices[3];
private:
void death_pass();
void roll_levelup_choices();
void apply_levelup(int choice_index);
std::uint64_t seed_ = 0;
int last_tier_ = 0;
};