FBC: NIGHT SHIFT - added RPG-lite offers: directives, passives, evolutions, regen/armor

This commit is contained in:
dandovlatov 2026-11-23 18:42:15 +04:00
parent 7afe0f38af
commit 1902617ddc
7 changed files with 215 additions and 3 deletions

31
docs/GAME_DESIGN_PASS.md Normal file
View file

@ -0,0 +1,31 @@
# Game Design Pass
## What works
- Core loop: move/dash + auto-weapons + magnet XP + real-time corruption.
- Corruption: continuous scaling, named tiers, event hooks.
- Credit director: income scaling, too-cheap rule, banked heavy burst.
- Combat math: damage, cooldowns, pierce, AoE, homing, enemy damage taken.
- Ritual MVP: TV and lightswitch with HUD states.
- World objects: random player/enemy effects with magnet pickup.
- Architecture: fixed 60 Hz sim, clean sim/render split, spatial hash, pools.
## What lacks
- Progression is mostly decorative: XP/level increases but weapon levels and Directives are not awarded.
- OoP roster incomplete: 4 of 10; evolutions are data-only.
- Rituals do not grant powers.
- Enemy variety thin: no Elevated, Cluster, Host, Threshold, Taken, elites, bosses.
- No run structure: single arena, no floors, keys, side rooms, shop, finale.
- No meta progression: Panopticon unlocks and starting loadout are docs-only.
- Player has no build stats: no regen, armor, HP growth, passives.
- UI is grey-box: no FBC paperwork, fonts, or audio.
- Some documented mechanics are unused: spawn_rate_mult, elite tiers, caps/stacking.
- No balance telemetry.
## Recommended improvements
1. Make XP meaningful: offers -> weapon levels/Directives/passives -> evolutions.
2. Complete ritual rewards.
3. Add elite affixes.
4. Implement floor/key flow.
5. Enforce caps and stacking.
6. Add audio + fonts.
7. Add automated smoke tests.

24
docs/RPG_LITE.md Normal file
View file

@ -0,0 +1,24 @@
# RPG-Lite Build System
## In-run progression
- XP thresholds roll 1-3 real-time offers (OoP level, new OoP, Directive, Passive).
- Offers auto-apply after a short idle/auto timer; the run never pauses.
- Weapon level 4 plus its required Directive unlocks the Altered Form.
- Directives and passives modify PlayerStats (damage, fire rate, speed, HP, pickup, pierce, regen, dash cooldown).
## Meta progression (planned)
- Panopticon unlocks gate OoP/passive/directive availability and starting loadout slots.
- Starting loadout is selected before a run; max 4 OoPs.
- Autoplay (`--bot`) and manual play share the same progression.
## ECS-lite usage
- PlayerStats are base values; BuffSystem applies transient buffs/debuffs.
- Directives/passives are permanent build components.
- Weapons are components in WeaponSystem.
- World objects apply temporary components on magnet catch.
- Rituals are quest components that can grant rewards.
## Mini quests
- TV ritual: reach TV, wait, gain buff.
- Lightswitch ritual: catch bait, revive fluorescents, damage enemies.
- Future: side rooms, keys, elite hunts.

View file

@ -1,4 +1,108 @@
#include "game/game.hpp" #include "game/game.hpp"
#include <algorithm>
#include <cmath>
namespace {
std::vector<Offer> roll_offers(Game& g) {
std::vector<Offer> pool;
// New weapons
for (int i = 0; i < kWeaponTypeCount; ++i) {
WeaponType wt = static_cast<WeaponType>(i);
bool owned = false;
for (const WeaponInstance& w : g.weapon_system.weapons) if (w.type == wt) owned = true;
if (!owned && static_cast<int>(g.weapon_system.weapons.size()) < g.config.max_weapons) {
pool.push_back({OfferType::NewWeapon, i, weapon_def(wt).name, weapon_def(wt).description});
}
}
// Weapon levels
for (const WeaponInstance& w : g.weapon_system.weapons) {
if (w.level < 4) {
pool.push_back({OfferType::WeaponLevel, static_cast<int>(w.type), weapon_def(w.type).name, "OoP level up"});
}
}
// Directives (one copy each)
for (int i = 0; i < static_cast<int>(Directive::Count); ++i) {
if (g.player.directives[i] == 0) {
pool.push_back({OfferType::Directive, i, "DIRECTIVE", "Board Directive"});
}
}
// Passives (stack up to 3)
for (int i = 0; i < static_cast<int>(Passive::Count); ++i) {
if (g.player.passives[i] < 3) {
pool.push_back({OfferType::Passive, i, "PASSIVE", "Field perk"});
}
}
std::vector<Offer> out;
// Pick up to 3 unique offers.
std::vector<int> idx(pool.size());
for (std::size_t i = 0; i < idx.size(); ++i) idx[i] = static_cast<int>(i);
// Fisher-Yates partial shuffle
for (std::size_t i = 0; i < idx.size() && out.size() < 3; ++i) {
const int j = g.rng.range_int(static_cast<int>(i), static_cast<int>(idx.size()) - 1);
std::swap(idx[i], idx[j]);
out.push_back(pool[static_cast<std::size_t>(idx[i])]);
}
return out;
}
void check_evolutions(Game& g) {
for (WeaponInstance& w : g.weapon_system.weapons) {
if (w.evolved || w.level < 4) continue;
const Directive req = weapon_def(w.type).evolution_req;
if (g.player.directives[static_cast<int>(req)] > 0) w.evolved = true;
}
}
void apply_offer(Game& g, const Offer& o) {
switch (o.type) {
case OfferType::NewWeapon:
if (static_cast<int>(g.weapon_system.weapons.size()) < g.config.max_weapons) {
g.weapon_system.weapons.push_back({static_cast<WeaponType>(o.id), 1, false, 0.0f});
}
break;
case OfferType::WeaponLevel:
for (WeaponInstance& w : g.weapon_system.weapons) {
if (w.type == static_cast<WeaponType>(o.id) && w.level < 4) ++w.level;
}
break;
case OfferType::Directive: {
if (o.id < 0 || o.id >= static_cast<int>(Directive::Count)) break;
if (g.player.directives[o.id] > 0) break;
g.player.directives[o.id] = 1;
switch (static_cast<Directive>(o.id)) {
case Directive::LaunchTraining: g.player.stats.damage_mult *= 1.20f; break;
case Directive::MaintenanceTraining: g.player.stats.fire_rate_mult *= 1.15f; break;
case Directive::LevitateDrill: g.player.stats.move_speed *= 1.12f; break;
case Directive::BlackRockPlating: g.player.stats.max_hp += 25.0f; g.player.hp += 25.0f; break;
case Directive::ResonanceAttunement: g.player.stats.pickup_radius *= 1.40f; break;
case Directive::PiercingRounds: g.player.stats.pierce += 1; break;
case Directive::BoardFavor: g.player.stats.damage_mult *= 1.08f; g.player.stats.fire_rate_mult *= 1.08f; break;
default: break;
}
break;
}
case OfferType::Passive: {
if (o.id < 0 || o.id >= static_cast<int>(Passive::Count)) break;
if (g.player.passives[o.id] >= 3) break;
++g.player.passives[o.id];
switch (static_cast<Passive>(o.id)) {
case Passive::Levitate: g.player.stats.move_speed *= 1.10f; break;
case Passive::Evade: g.player.stats.dash_cooldown_mult *= 0.85f; break;
case Passive::Shield: g.player.stats.max_hp += 20.0f; g.player.hp += 20.0f; g.player.stats.regen += 1.0f; break;
case Passive::Polaris: g.player.stats.regen += 2.0f; break;
case Passive::Maintenance: g.player.stats.fire_rate_mult *= 1.10f; break;
default: break;
}
break;
}
}
check_evolutions(g);
}
} // namespace
Game::Game(std::uint64_t seed) : rng(seed), seed_(seed) { Game::Game(std::uint64_t seed) : rng(seed), seed_(seed) {
weapon_system.reset(); weapon_system.reset();
@ -39,6 +143,7 @@ void Game::update(const InputState& in, float dt) {
corruption.update(dt); corruption.update(dt);
buff_system.update(dt); buff_system.update(dt);
player.mods = buff_system.player_mods(); player.mods = buff_system.player_mods();
player.mods.damage_taken_mult *= 1.0f / (1.0f + player.stats.armor * 0.05f);
if (corruption.tier() != last_tier_) { if (corruption.tier() != last_tier_) {
last_tier_ = corruption.tier(); last_tier_ = corruption.tier();
events.push(EventType::TierUp, player.pos, static_cast<float>(last_tier_)); events.push(EventType::TierUp, player.pos, static_cast<float>(last_tier_));
@ -51,6 +156,19 @@ void Game::update(const InputState& in, float dt) {
enemy_system.update(dt, player, buff_system, events); enemy_system.update(dt, player, buff_system, events);
if (config.no_player_damage) player.hp = player.stats.max_hp; // stress mode if (config.no_player_damage) player.hp = player.stats.max_hp; // stress mode
weapon_system.update(dt, player, enemy_system, events, rng); weapon_system.update(dt, player, enemy_system, events, rng);
if (length_sq({in.move_x, in.move_y}) < 1e-4f && !in.dash) idle_time += dt;
else idle_time = 0.0f;
if (!pending_offers.empty()) {
offer_timer -= dt;
if (offer_timer <= 0.0f || idle_time >= 3.0f) {
apply_offer(*this, pending_offers.front());
pending_offers.erase(pending_offers.begin());
offer_timer = 2.0f;
idle_time = 0.0f;
}
}
death_pass(); death_pass();
float xp_gained = 0.0f; float xp_gained = 0.0f;
@ -61,10 +179,13 @@ void Game::update(const InputState& in, float dt) {
xp -= xp_to_next; xp -= xp_to_next;
level += 1; level += 1;
xp_to_next = 6.0f + 4.0f * static_cast<float>(level - 1); xp_to_next = 6.0f + 4.0f * static_cast<float>(level - 1);
// Offers roll as real-time HUD offers when XP crosses a threshold — auto offers = roll_offers(*this);
// the run never pauses, everything continues (GAME_DESIGN.md §2.2). for (const Offer& o : offers) pending_offers.push_back(o);
offer_timer = 2.0f;
} }
player.hp = std::min(player.stats.max_hp, player.hp + player.stats.regen * dt);
if (!player.alive()) { if (!player.alive()) {
player.hp = 0.0f; player.hp = 0.0f;
state = GameState::GameOver; state = GameState::GameOver;

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <vector>
#include "core/events.hpp" #include "core/events.hpp"
#include "core/rng.hpp" #include "core/rng.hpp"
@ -16,6 +17,15 @@
enum class GameState { Playing, GameOver }; enum class GameState { Playing, GameOver };
enum class OfferType { WeaponLevel, NewWeapon, Directive, Passive };
struct Offer {
OfferType type = OfferType::WeaponLevel;
int id = 0;
const char* name = "";
const char* description = "";
};
struct GameConfig { struct GameConfig {
float arena_half = 26.0f; float arena_half = 26.0f;
int max_enemies = 260; int max_enemies = 260;
@ -52,6 +62,10 @@ public:
float xp = 0.0f; float xp = 0.0f;
float xp_to_next = 6.0f; float xp_to_next = 6.0f;
std::vector<Offer> pending_offers;
float offer_timer = 0.0f;
float idle_time = 0.0f;
private: private:
void death_pass(); void death_pass();

View file

@ -9,7 +9,7 @@ constexpr float kDashSpeedMult = 3.2f;
void player_update(Player& player, const InputState& in, float dt, float arena_half) { void player_update(Player& player, const InputState& in, float dt, float arena_half) {
if (in.dash && player.dash_cooldown <= 0.0f) { if (in.dash && player.dash_cooldown <= 0.0f) {
player.dash_timer = kDashBurstTime; player.dash_timer = kDashBurstTime;
player.dash_cooldown = kDashCooldown; player.dash_cooldown = kDashCooldown * player.stats.dash_cooldown_mult;
} }
player.dash_timer -= dt; player.dash_timer -= dt;

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "core/math.hpp" #include "core/math.hpp"
#include <array>
#include "game/buffs.hpp" #include "game/buffs.hpp"
#include "game/input.hpp" #include "game/input.hpp"
@ -18,6 +19,8 @@ enum class Directive {
Count, Count,
}; };
enum class Passive { Levitate, Evade, Shield, Polaris, Maintenance, Count };
struct PlayerStats { struct PlayerStats {
float max_hp = 100.0f; float max_hp = 100.0f;
float move_speed = 7.5f; float move_speed = 7.5f;
@ -25,12 +28,17 @@ struct PlayerStats {
float fire_rate_mult = 1.0f; float fire_rate_mult = 1.0f;
float pickup_radius = 3.0f; float pickup_radius = 3.0f;
int pierce = 0; int pierce = 0;
float dash_cooldown_mult = 1.0f;
float regen = 0.0f;
float armor = 0.0f;
}; };
struct Player { struct Player {
Vec2 pos{}; Vec2 pos{};
float hp = 100.0f; float hp = 100.0f;
PlayerStats stats{}; PlayerStats stats{};
std::array<int, static_cast<int>(Directive::Count)> directives{};
std::array<int, static_cast<int>(Passive::Count)> passives{};
PlayerMods mods{}; // Transient buffs/debuffs (player channel, §4.5) PlayerMods mods{}; // Transient buffs/debuffs (player channel, §4.5)
float dash_timer = 0.0f; // remaining dash burst float dash_timer = 0.0f; // remaining dash burst
float dash_cooldown = 0.0f; // time until dash is available again float dash_cooldown = 0.0f; // time until dash is available again

View file

@ -90,6 +90,20 @@ void draw_hud(const Game& game) {
oy += 21.0f; oy += 21.0f;
} }
// Pending offers (real-time progression).
if (!game.pending_offers.empty()) {
float oy2 = oy + 6.0f;
char offer_line[128];
std::snprintf(offer_line, sizeof(offer_line), "OFFERS PENDING: %d", static_cast<int>(game.pending_offers.size()));
DrawText(offer_line, 20, oy2, 16, Color{245, 197, 24, 245});
oy2 += 18.0f;
for (const Offer& o : game.pending_offers) {
std::snprintf(offer_line, sizeof(offer_line), "- %s", o.name);
DrawText(offer_line, 20, oy2, 15, Color{200, 198, 192, 220});
oy2 += 16.0f;
}
}
// Bottom: XP bar. // Bottom: XP bar.
const float xp_w = 640.0f; const float xp_w = 640.0f;
draw_bar(GetScreenWidth() / 2.0f - xp_w / 2.0f, GetScreenHeight() - 44, xp_w, 18, draw_bar(GetScreenWidth() / 2.0f - xp_w / 2.0f, GetScreenHeight() - 44, xp_w, 18,