Add PUSH skill on L: radial knockback and stagger with rebuilt rubble

PUSH is a fourth always-available active skill bound to L (gamepad RT).
It shoves visible enemies in a 6 m radius outward, damages them and holds
them in a 0.55 s stagger that stops chasing and attacks. Autoplay toggling
moves to Tab so the new key is free.

The effect reuses the rock-debris pool via a new radial burst variant and
the shattered-concrete GLB rebuilt in Blender: broken slabs, raised
splinters, bent rebar and Hiss cracks. Warm rings, ground pulse, sparks
and tumbling GLB shards carry the shockwave; stagger feeds the actor recoil
shader. HUD, docs and skill tests updated.
This commit is contained in:
dandovlatov 2026-11-25 04:22:37 +04:00
parent ae7871b23e
commit da0d157e29
20 changed files with 482 additions and 60 deletions

View file

@ -6,7 +6,7 @@ You are a nameless FBC worker who never resonated. Your Objects of Power have a
## Highlights
- **Move-only combat** — WASD + dash, four auto-firing OoPs. Press `J`/`K` to steer them, `L` to toggle autoplay.
- **Move-only combat** — WASD + dash, four auto-firing OoPs. Press `J`/`K`/`L` to steer CONCRETE CALL, WARP and PUSH (`U` for FLUORESCENT once earned); `Tab` toggles autoplay.
- **Rituals as rewards** — complete an OoP's ritual and it becomes a permanent skill for the run (Mega Man structure, Control skin).
- **Three Beacons** — aged grey monuments; walk within 2.5 m to ignite one in a bright red Hiss wave. The third fires a placeholder event, pending design.
- **Projector blackout** — walk into the screen, answer twenty red phones in the dark, claim FLUORESCENT.
@ -30,12 +30,12 @@ C++23 (GCC 13+) and OpenGL/X11 headers; raylib 6.2 is fetched by CMake. Automate
|---|---|
| WASD / stick | Move |
| Shift / Space | Dash (*Evade*) |
| J / K | CONCRETE CALL — hurl rubble at a crowd / WARP — collapse enemies together |
| J / K / L | CONCRETE CALL — hurl rubble at a crowd / WARP — collapse enemies together / PUSH — radial shockwave that knocks enemies back and staggers them |
| U | FLUORESCENT (earned in the projector blackout) |
| L | Toggle skill autoplay (AUTO / MANUAL / OFF) |
| Tab | Toggle skill autoplay (AUTO / MANUAL / OFF) |
| R / Esc | Restart on death / quit |
J/K presses are remembered while that skill cools down; the HUD stamp shows a `Q` while a cast is queued. A manual press takes control of that skill only — the others keep autoplaying.
J/K/L/U presses are remembered while that skill cools down; the HUD stamp shows a `Q` while a cast is queued. A manual press takes control of that skill only — the others keep autoplaying.
## Level data & tools

Binary file not shown.

Binary file not shown.

View file

@ -137,19 +137,23 @@ not make the throw miss. **WARP** (`K` / gamepad B) locks the nearest visible
crowd, drags those subjects together in a 4.5 m field over 0.75 s, then
collapses the field for 75 damage (9 s cooldown, teal containment rings,
tethers and an implosion burst). With no target, a manual K still drops an area
field just ahead of the agent. Skills never target, fly through, or damage
units through walls.
field just ahead of the agent. **PUSH** (`L` / gamepad RT) needs no target: an
omnidirectional 6 m shockwave shoves every visible enemy in range outward
(strongest at the centre), deals 55 damage and holds them in a 0.55 s stagger
so they cannot chase or attack. It shares the shattered-concrete GLB and rock
debris pool with CALL — the rubble and dust rings sweep outward with the wave.
Skills never target, fly through, or damage units through walls.
Every active skill also **autoplays** when its key hasn't been pressed recently
— a manual press takes control of *that skill* for a few seconds, then its
autoplay resumes; `[L]` disables autoplay for players who want fully manual
autoplay resumes; `[Tab]` disables autoplay for players who want fully manual
skills. New active skills join the same `SkillSystem` cast/autoplay path, so
the no-button playstyle keeps working. A manual press is **queued while the
skill cools down** (autoplay otherwise keeps the cooldown spent, making J/K
feel dead); the queue lives until that skill is ready, not merely for the
manual-control window, so a press 1 s into WARP's 9 s cooldown still fires. The
HUD stamp flashes on every press and shows a small `Q` badge while a cast is
remembered. Pressing `[L]` back into autoplay drops any queue. Fruitless
remembered. Pressing `[Tab]` back into autoplay drops any queue. Fruitless
autoplay scans are throttled so an empty floor never rehashes the horde at
60 Hz.

View file

@ -163,9 +163,13 @@ Both baseline skills (CONCRETE CALL / WARP) got a systemic and visual pass.
grey-tinted rubble and a grey (not Hiss-red) impact decal.
- `ui.cpp` — HUD stamps use per-skill accent colors and reveal a `Q` badge for
a queued press.
- `--skill-test` stages a frozen crowd and alternates CALL / WARP casts every
3 s; `--screenshot-at` is keyed to sim time in that mode for repeatable VFX
captures (e.g. 0.5 s gather, 0.75 s impact, 3.45 s field, 3.82 s collapse).
- PUSH adds a fourth stamp (`L`, warm charged-concrete palette): the shattered
GLB rubble from CALL flies outward with two expanding dust rings and a warm
ground pulse. Staggered enemies recoil via the existing actor `uStagger`.
`L` was formerly the autoplay toggle; that moved to `Tab` (gamepad Back
unchanged). `--skill-test` now rotates CALL / WARP / PUSH every 3 s;
`--screenshot-at` is keyed to sim time in that mode for repeatable captures
(e.g. 0.5 s gather, 0.75 s impact, 6.1 s PUSH burst).
**Verification:** 16/16 ctests pass; staged captures confirm the dust/teal
palettes and the impact/collapse beats.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 574 KiB

After

Width:  |  Height:  |  Size: 574 KiB

View file

@ -35,6 +35,7 @@ enum SkillCastFlag : unsigned {
kCastConcrete = 1u << 0,
kCastWarp = 1u << 1,
kCastFluorescent = 1u << 2,
kCastPush = 1u << 3,
};
struct GameEvent {

View file

@ -2,6 +2,7 @@
#include "game/floor.hpp"
#include <algorithm>
#include <cmath>
#include "core/spatial_hash.hpp"
@ -68,9 +69,15 @@ void EnemySystem::update(float dt, Player& player, BuffSystem& buff_system,
if (e.mods.burn_dps > 0.0f)
e.hp -= e.mods.burn_dps * dt;
// PUSH staggers a unit: it holds position and cannot attack for the
// short window, then resumes its chase. Burns and DoTs still tick —
// stagger is a crowd-control state, not invulnerability.
e.stagger_timer = std::max(0.0f, e.stagger_timer - dt);
const bool staggered = e.stagger_timer > 0.0f;
// Steering + contact attacks. Walls block movement; spawns are kept in
// the player's room so a straight chase never needs pathfinding.
if (dist > 1e-4f) {
if (!staggered && dist > 1e-4f) {
e.pos += normalized(player.pos - e.pos) * (e.speed * dt);
e.pos = floor.resolve(e.pos, e.radius * 0.6f);
}
@ -79,7 +86,7 @@ void EnemySystem::update(float dt, Player& player, BuffSystem& buff_system,
e.attack_cooldown -= dt;
e.bob_phase += dt * 2.0f;
if (dist < e.radius + kContactRange) {
if (!staggered && dist < e.radius + kContactRange) {
if (player.mods.taken > 0.0f) {
// Taken: immune to damage while near enemies; pulls the player.
if (length(e.pos - player.pos) > 1e-4f)

View file

@ -29,6 +29,9 @@ struct Enemy {
float radius = 0.7f;
float attack_cooldown = 0.0f;
float hit_flash = 0.0f;
// PUSH (and future crowd control) freeze steering and contact attacks for
// this long. Presentation feeds it into the actor stagger shader uniform.
float stagger_timer = 0.0f;
float bob_phase = 0.0f;
EnemyType type = EnemyType::HissStaff;
// Set by WARP at cast time so late arrivals don't join a locked crowd.

View file

@ -9,6 +9,7 @@ struct InputState {
bool skill_concrete = false; // one-shot: CONCRETE CALL (J / gamepad Y)
bool skill_warp = false; // one-shot: WARP (K / gamepad B)
bool skill_fluorescent = false; // one-shot: FLUORESCENT (U, ritual reward)
bool toggle_autoplay = false; // one-shot (L / gamepad Back)
bool skill_push = false; // one-shot: PUSH (L / gamepad RT)
bool toggle_autoplay = false; // one-shot (Tab / gamepad Back)
bool restart = false; // one-shot
};

View file

@ -30,6 +30,14 @@ constexpr float kFluorescentCooldown = 14.0f;
constexpr float kLightRadius = 6.0f;
constexpr float kLightDuration = 10.0f;
constexpr float kLightDamageMult = 1.25f;
// PUSH: an omnidirectional shockwave at the agent. No target selection — it
// shoves everything inside the radius outward and holds it there briefly.
constexpr float kPushCooldown = 11.0f;
constexpr float kPushRadius = 6.0f;
constexpr float kPushDamage = 55.0f;
constexpr float kPushDistance = 4.2f;
constexpr float kPushStagger = 0.55f;
constexpr int kPushAutoTargets = 2; // autoplay fires only once a crowd is close
// A remembered press stays alive until the skill is ready plus this much time
// to find a target. The old code tied it to kManualHold (5 s), so presses made
@ -230,6 +238,61 @@ void try_cast_fluorescent(SkillSystem& skills, Player& player, EnemySystem& enem
kCastFluorescent);
}
// Autoplay cannot see a target the way CALL/WARP can, so it waits until enough
// enemies are genuinely inside the shockwave (and not behind a wall). A manual
// L press still fires on an empty floor — the key must never feel dead.
int push_targets(const EnemySystem& enemies, Vec2 center, const Floor& floor) {
int count = 0;
for (const Enemy& e : enemies.enemies) {
if (e.hp <= 0.0f) continue;
if (distance(center, e.pos) >= kPushRadius + e.radius) continue;
if (!segment_clear(floor, center, e.pos)) continue;
++count;
}
return count;
}
void try_cast_push(SkillSystem& skills, Player& player, EnemySystem& enemies,
EventQueue& events, const Floor& floor, bool manual) {
const int index = static_cast<int>(SkillType::Push);
if (skills.cooldowns[index] > 0.0f || !player.alive()) {
if (manual)
DEBUG_TRACE(debug::Skills, "push: blocked (cd %.2f, alive=%d)",
skills.cooldowns[index], player.alive() ? 1 : 0);
return;
}
const int targets = push_targets(enemies, player.pos, floor);
if (!manual && targets < kPushAutoTargets) return;
DEBUG_TRACE(debug::Skills, "push: cast at %.1f %.1f (%d targets)",
player.pos.x, player.pos.y, targets);
// Emit the VFX before the damage loop: a full queue must never swallow the
// shockwave even if a crowded hit floods it with EnemyHit events.
events.push(EventType::SkillCast, player.pos, kPushRadius, kCastPush);
for (Enemy& e : enemies.enemies) {
if (e.hp <= 0.0f) continue;
const Vec2 delta = e.pos - player.pos;
const float dist = length(delta);
if (dist >= kPushRadius + e.radius) continue;
if (!segment_clear(floor, player.pos, e.pos)) continue;
if (dist > 1e-3f) {
// Strongest at the centre. Floor resolution stops a shove from
// tunneling a unit through a wall, mirroring WARP's inward pull.
const float falloff = 1.0f - std::min(1.0f, dist / kPushRadius);
const float shove = kPushDistance * (0.45f + 0.55f * falloff);
e.pos = floor.resolve(e.pos + normalized(delta) * shove,
e.radius * 0.6f);
}
e.stagger_timer = kPushStagger;
const float applied = kPushDamage * player.stats.damage_mult
* e.mods.damage_taken_mult;
e.hp -= applied;
e.hit_flash = 0.15f;
events.push(EventType::EnemyHit, e.pos, applied);
}
skills.cooldowns[index] = kPushCooldown;
}
void detonate(const ConcretePile& pile, EnemySystem& enemies,
const Floor& floor, EventQueue& events) {
// Emit the VFX event first: a full queue must never drop the impact itself.
@ -268,6 +331,7 @@ const char* skill_name(SkillType type) {
case SkillType::ConcreteCall: return "CONCRETE CALL";
case SkillType::Warp: return "WARP";
case SkillType::Fluorescent: return "FLUORESCENT";
case SkillType::Push: return "PUSH";
default: return "UNKNOWN";
}
}
@ -277,6 +341,7 @@ float skill_cooldown(SkillType type) {
case SkillType::ConcreteCall: return kConcreteCooldown;
case SkillType::Warp: return kWarpCooldown;
case SkillType::Fluorescent: return kFluorescentCooldown;
case SkillType::Push: return kPushCooldown;
default: return 1.0f;
}
}
@ -320,6 +385,7 @@ void SkillSystem::note_input(const InputState& in) {
press(SkillType::ConcreteCall, in.skill_concrete, "J (CONCRETE CALL)");
press(SkillType::Warp, in.skill_warp, "K (WARP)");
press(SkillType::Fluorescent, in.skill_fluorescent, "U (FLUORESCENT)");
press(SkillType::Push, in.skill_push, "L (PUSH)");
}
void SkillSystem::reset_all() {
@ -334,6 +400,7 @@ void SkillSystem::tick_presentation(float dt, const InputState& in) {
if (in.skill_concrete) press_feedback[static_cast<int>(SkillType::ConcreteCall)] = 0.35f;
if (in.skill_warp) press_feedback[static_cast<int>(SkillType::Warp)] = 0.35f;
if (in.skill_fluorescent) press_feedback[static_cast<int>(SkillType::Fluorescent)] = 0.35f;
if (in.skill_push) press_feedback[static_cast<int>(SkillType::Push)] = 0.35f;
}
void SkillSystem::update(float dt, const InputState& in, Player& player,
@ -353,6 +420,7 @@ void SkillSystem::update(float dt, const InputState& in, Player& player,
const int ci = static_cast<int>(SkillType::ConcreteCall);
const int wi = static_cast<int>(SkillType::Warp);
const int fi = static_cast<int>(SkillType::Fluorescent);
const int pi = static_cast<int>(SkillType::Push);
// A successful cast raises the cooldown; a failed attempt keeps the
// remembered press for its remaining lifetime. Never clear the queue
// before the cast had its chance to fire.
@ -375,6 +443,12 @@ void SkillSystem::update(float dt, const InputState& in, Player& player,
try_cast_fluorescent(*this, player, enemies, buffs, events, true);
if (cooldowns[fi] > before) queued[fi] = false;
}
if (in.skill_push || queued[pi]) {
manual_tried[pi] = true;
const float before = cooldowns[pi];
try_cast_push(*this, player, enemies, events, floor, true);
if (cooldowns[pi] > before) queued[pi] = false;
}
// Autoplay is per skill: pressing J leaves WARP and FLUORESCENT on their own
// timers. A manual attempt this tick wins even if it found no target, and
@ -397,6 +471,12 @@ void SkillSystem::update(float dt, const InputState& in, Player& player,
try_cast_fluorescent(*this, player, enemies, buffs, events, false);
if (cooldowns[fi] <= before) retry_timer[fi] = kAutoRetry;
}
if (autoplay_active(SkillType::Push) && !manual_tried[pi]
&& retry_timer[pi] <= 0.0f) {
const float before = cooldowns[pi];
try_cast_push(*this, player, enemies, events, floor, false);
if (cooldowns[pi] <= before) retry_timer[pi] = kAutoRetry;
}
for (int i = 0; i < kSkillCount; ++i) {
if (queued[i] && queue_timer[i] <= 0.0f) queued[i] = false;

View file

@ -8,7 +8,7 @@
// Player-triggered active skills (distinct from the always-on OoP weapons).
// Skills can always be cast with their key, and auto-fire when the player is
// not using them — future skills only need a new enum value and a cast rule.
enum class SkillType { ConcreteCall = 0, Warp, Fluorescent, Count };
enum class SkillType { ConcreteCall = 0, Warp, Fluorescent, Push, Count };
constexpr int kSkillCount = static_cast<int>(SkillType::Count);
const char* skill_name(SkillType type);

View file

@ -146,6 +146,7 @@ struct InputFrame {
bool skill_concrete = false;
bool skill_warp = false;
bool skill_fluorescent = false;
bool skill_push = false;
bool toggle_autoplay = false;
bool restart = false;
};
@ -177,7 +178,8 @@ void poll_input(InputFrame& frame) {
frame.skill_concrete = frame.skill_concrete || IsKeyPressed(KEY_J);
frame.skill_warp = frame.skill_warp || IsKeyPressed(KEY_K);
frame.skill_fluorescent = frame.skill_fluorescent || IsKeyPressed(KEY_U);
frame.toggle_autoplay = frame.toggle_autoplay || IsKeyPressed(KEY_L);
frame.skill_push = frame.skill_push || IsKeyPressed(KEY_L);
frame.toggle_autoplay = frame.toggle_autoplay || IsKeyPressed(KEY_TAB);
frame.restart = frame.restart || IsKeyPressed(KEY_R);
if (frame.pad >= 0) {
const bool confirm = IsGamepadButtonPressed(frame.pad, GAMEPAD_BUTTON_RIGHT_FACE_DOWN);
@ -189,6 +191,8 @@ void poll_input(InputFrame& frame) {
|| IsGamepadButtonPressed(frame.pad, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT);
frame.skill_fluorescent = frame.skill_fluorescent
|| IsGamepadButtonPressed(frame.pad, GAMEPAD_BUTTON_RIGHT_FACE_LEFT);
frame.skill_push = frame.skill_push
|| IsGamepadButtonPressed(frame.pad, GAMEPAD_BUTTON_RIGHT_TRIGGER_2);
frame.toggle_autoplay = frame.toggle_autoplay
|| IsGamepadButtonPressed(frame.pad, GAMEPAD_BUTTON_MIDDLE_LEFT);
frame.restart = frame.restart || confirm
@ -222,6 +226,7 @@ InputState read_input(const Game& game, bool bot, const InputFrame& frame) {
in.skill_concrete = false;
in.skill_warp = false;
in.skill_fluorescent = false;
in.skill_push = false;
in.toggle_autoplay = false;
return in;
}
@ -251,6 +256,7 @@ InputState read_input(const Game& game, bool bot, const InputFrame& frame) {
in.skill_concrete = frame.skill_concrete;
in.skill_warp = frame.skill_warp;
in.skill_fluorescent = frame.skill_fluorescent;
in.skill_push = frame.skill_push;
in.toggle_autoplay = frame.toggle_autoplay;
in.restart = frame.restart;
return in;
@ -447,8 +453,8 @@ int main(int argc, char** argv) {
float accumulator = 0.0f;
float aoe_clock = 0.0f;
int aoe_seq = 0;
float skill_clock = 3.0f; // fire CALL on the first fixed tick, then alternate
bool skill_flip = false;
float skill_clock = 3.0f; // fire CALL on the first fixed tick, then rotate
int skill_stage = 2; // CALL -> WARP -> PUSH for VFX captures
bool screenshot_taken = false;
InputFrame input;
while (!WindowShouldClose()) {
@ -465,17 +471,20 @@ int main(int argc, char** argv) {
skill_clock += kFixedDt;
if (skill_clock >= 3.0f) {
skill_clock = 0.0f;
skill_flip = !skill_flip;
skill_stage = (skill_stage + 1) % 3;
// Rebuild the frozen crowd and arm the next skill so
// every capture starts from the same staging.
stage_skill_crowd();
const SkillType next = skill_flip
const SkillType next = skill_stage == 0
? SkillType::ConcreteCall
: SkillType::Warp;
: (skill_stage == 1
? SkillType::Warp
: SkillType::Push);
const int idx = static_cast<int>(next);
game.skill_system.cooldowns[idx] = 0.0f;
if (skill_flip) in.skill_concrete = true;
else in.skill_warp = true;
if (skill_stage == 0) in.skill_concrete = true;
else if (skill_stage == 1) in.skill_warp = true;
else in.skill_push = true;
}
}
if (in.restart) presenter.reset();
@ -490,6 +499,7 @@ int main(int argc, char** argv) {
input.skill_concrete = false;
input.skill_warp = false;
input.skill_fluorescent = false;
input.skill_push = false;
input.toggle_autoplay = false;
input.restart = false;
}

View file

@ -210,6 +210,34 @@ void ConcreteDebris::burst(Vec2 center, float radius, int count,
}
}
void ConcreteDebris::burst_ring(Vec2 center, float radius, int count,
Color tint) {
const float step = 6.2831853f / std::max(1, count);
for (int i = 0; i < count && static_cast<int>(chunks_.size()) < kCapacity;
++i) {
ConcreteChunk c;
const float a = step * static_cast<float>(i)
+ range(-step * 0.35f, step * 0.35f);
const float d = range(0.25f, 0.75f) * radius;
c.pos = {center.x + std::cos(a) * d, 0.12f,
center.y + std::sin(a) * d};
const float spread = range(5.0f, 9.5f) * (1.0f + radius * 0.06f);
c.vel = {std::cos(a) * spread, range(2.2f, 5.4f),
std::sin(a) * spread};
c.yaw = range(0.0f, 360.0f);
c.pitch = range(-60.0f, 60.0f);
c.roll = range(-60.0f, 60.0f);
c.spin_y = range(-540.0f, 540.0f);
c.spin_x = range(-420.0f, 420.0f);
c.age = 0.0f;
c.life = range(1.1f, 1.8f);
c.size = range(0.30f, 0.70f);
c.shade = static_cast<unsigned char>(range(120.0f, 200.0f));
c.tint = tint;
chunks_.push_back(c);
}
}
void ConcreteDebris::update(float dt) {
for (std::size_t i = 0; i < chunks_.size();) {
ConcreteChunk& c = chunks_[i];
@ -245,8 +273,14 @@ void ConcreteDebris::draw(Vector3 camera_pos) const {
const float dz = c.pos.z - camera_pos.z;
if (dx * dx + dz * dz > 62.0f * 62.0f) continue;
const float fade = 1.0f - c.age / c.life;
Color tint{c.shade, c.shade, static_cast<unsigned char>(c.shade + 4),
static_cast<unsigned char>(255.0f * std::min(1.0f, fade * 2.5f))};
const unsigned char alpha = static_cast<unsigned char>(
255.0f * std::min(1.0f, fade * 2.5f));
const Color tint = c.tint.a > 0
? Color{c.tint.r, c.tint.g, c.tint.b, alpha}
: Color{c.shade, c.shade,
static_cast<unsigned char>(
std::min(255, static_cast<int>(c.shade) + 4)),
alpha};
batch_.add(c.pos, {c.size, c.size * 0.55f, c.size * 0.8f},
c.yaw, c.pitch, c.roll, tint);
}

View file

@ -61,6 +61,9 @@ struct ConcreteChunk {
float life = 1.0f;
float size = 0.30f;
unsigned char shade = 90;
// a == 0 keeps the plain monochrome concrete shade; skills can override
// with a tint (e.g. PUSH's warm charged rubble) without a second pool.
Color tint{255, 255, 255, 0};
};
class ConcreteDebris {
@ -77,6 +80,10 @@ public:
// of erupting from the floor at the blast centre.
void burst(Vec2 center, float radius, int count,
const Vector3* origins, int origin_count);
// PUSH shockwave: an evenly spaced outward ring of charged rubble. Same
// chunks, same batched draw — only the spawn pattern and tint differ.
void burst_ring(Vec2 center, float radius, int count,
Color tint = Color{228, 198, 156, 255});
void update(float dt);
void draw(Vector3 camera_pos) const;

View file

@ -52,6 +52,13 @@ float actor_flash(float timer, float scale) {
return timer <= 0.0f ? 0.0f : std::min(1.0f, timer * scale);
}
// A genuine PUSH stagger holds the actor in a recoil for longer than a hit
// flash; ordinary hits still feed the same shader uniform at a lower weight.
float enemy_stagger(const Enemy& e) {
return std::max(actor_flash(e.hit_flash, 6.0f),
std::min(1.0f, e.stagger_timer * 2.5f));
}
} // namespace
class ViewCull {
@ -336,6 +343,32 @@ void Presenter::spawn_skill_ring(Vec2 pos, float radius, float end_radius,
spin, color});
}
void Presenter::spawn_push_shards(Vec2 center, float radius) {
// Eight pieces of the CALL rubble GLB sweep outward with the shockwave.
// Warm tint + tumbling spin make the shove read at tactical distance; the
// sim only owns the knockback, so this pool is purely cosmetic.
constexpr int kCount = 8;
for (int i = 0; i < kCount && push_shards_.size() < 16; ++i) {
const float a = 6.2831853f * static_cast<float>(i) / kCount
+ (static_cast<float>(GetRandomValue(-25, 25)) / 100.0f);
const float speed = 5.0f
+ static_cast<float>(GetRandomValue(0, 45)) / 10.0f;
const float lift = 2.4f
+ static_cast<float>(GetRandomValue(0, 30)) / 10.0f;
const float life = 0.7f
+ static_cast<float>(GetRandomValue(0, 40)) / 100.0f;
push_shards_.push_back(PushShard{
{center.x + std::cos(a) * 0.6f, 0.18f,
center.y + std::sin(a) * 0.6f},
{std::cos(a) * speed, lift, std::sin(a) * speed},
a,
(static_cast<float>(GetRandomValue(-100, 100)) / 100.0f) * 9.0f,
0.26f + static_cast<float>(GetRandomValue(0, 25)) / 100.0f,
0.0f,
life});
}
}
void Presenter::shed_surface_debris(Vec2 center, float radius) {
Vector3 origins[12];
const int n = dressing_.surface_sources_in_radius(
@ -507,6 +540,7 @@ void Presenter::init(float arena_half, const Floor& floor) {
scorch_.clear();
damage_numbers_.reserve(64);
sparks_.reserve(160);
push_shards_.reserve(16);
}
void Presenter::apply_graphics_settings() {
@ -525,6 +559,7 @@ void Presenter::reset() {
muzzle_flash_ = 0.0f;
trails_.clear();
skill_rings_.clear();
push_shards_.clear();
player_running_ = false;
}
@ -1248,7 +1283,7 @@ void Presenter::draw_shadow_map(const Game& game, bool enabled) {
: ActorModel::HissStaff));
models_.draw_shadow(model, {e.pos.x, bob, e.pos.y}, yaw, 1.0f,
std::min(1.0f, e.speed / 4.5f),
actor_flash(e.hit_flash, 6.0f), e.bob_phase);
enemy_stagger(e), e.bob_phase);
}
shadow_pass_ = false;
concrete_.set_depth_pass(false);
@ -1273,6 +1308,7 @@ void Presenter::draw_scene(Game& game) {
const bool concrete = (e.flags & kCastConcrete) != 0;
const bool warp = (e.flags & kCastWarp) != 0;
const bool fluorescent = (e.flags & kCastFluorescent) != 0;
const bool push = (e.flags & kCastPush) != 0;
// Keep the landing marker alive until the heap actually lands
// (~0.38 s gather + travel at 17 m/s from skills.cpp).
const float flight = 0.38f + distance(game.player.pos, e.pos) / 17.0f;
@ -1291,6 +1327,24 @@ void Presenter::draw_scene(Game& game) {
aura_.spawn_ground({e.pos.x, 0.09f, e.pos.y},
std::max(1.0f, e.magnitude), 1.2f, anim_time_,
Color{78, 201, 176, 255});
} else if (push) {
// PUSH reads as one outward shockwave: charged rubble sweeps a
// ring off the floor, two expanding dust rings and a warm ground
// pulse travel with it. The same debris pool as CALL is reused.
concrete_debris_.burst_ring(
e.pos, e.magnitude, 28, Color{228, 198, 156, 255});
spawn_push_shards(e.pos, e.magnitude);
spawn_sparks(e.pos, 0.35f, Color{236, 214, 170, 255}, 30, 6.0f);
spawn_skill_ring(e.pos, e.magnitude * 0.18f,
e.magnitude * 1.25f, 0.55f,
Color{226, 198, 150, 235}, 0.0f, 0.16f);
spawn_skill_ring(e.pos, e.magnitude * 0.06f,
e.magnitude * 0.95f, 0.38f,
Color{252, 238, 208, 200}, 0.0f, 0.36f);
aura_.spawn_ground({e.pos.x, 0.09f, e.pos.y},
e.magnitude * 1.35f, 0.9f, anim_time_,
Color{224, 198, 150, 255});
shake_ = std::max(shake_, 0.34f);
} else {
concrete_debris_.burst(game.player.pos, 1.2f, 8);
spawn_sparks(game.player.pos, 0.35f, Color{195, 190, 178, 255},
@ -1304,12 +1358,12 @@ void Presenter::draw_scene(Game& game) {
// All three skills shake nearby surfaces loose: paper + rock
// debris flies off shelves, tables and garbage cans while the
// props themselves stay put.
shed_surface_debris(game.player.pos, 5.0f);
shed_surface_debris(game.player.pos, push ? e.magnitude : 5.0f);
if (distance(e.pos, game.player.pos) > 1.0f) {
shed_surface_debris(e.pos, std::max(4.0f, e.magnitude));
}
// Fluorescent already placed its own ground pulse above.
if (!fluorescent && !warp && !concrete) {
// Fluorescent and PUSH already placed their own ground pulse above.
if (!fluorescent && !warp && !concrete && !push) {
aura_.spawn_ground({e.pos.x, 0.09f, e.pos.y},
std::max(1.0f, e.magnitude), 0.55f, anim_time_);
}
@ -1454,6 +1508,24 @@ void Presenter::draw_scene(Game& game) {
std::remove_if(skill_rings_.begin(), skill_rings_.end(),
[](const SkillRing& r) { return r.age > r.life; }),
skill_rings_.end());
for (PushShard& s : push_shards_) {
s.age += frame_dt;
s.pos.x += s.vel.x * frame_dt;
s.pos.y += s.vel.y * frame_dt;
s.pos.z += s.vel.z * frame_dt;
s.vel.y -= 11.0f * frame_dt;
s.vel.x *= 0.98f;
s.vel.z *= 0.98f;
if (s.pos.y < 0.10f) {
s.pos.y = 0.10f;
s.vel.y = 0.0f;
}
s.yaw += s.spin * frame_dt;
}
push_shards_.erase(
std::remove_if(push_shards_.begin(), push_shards_.end(),
[](const PushShard& s) { return s.age > s.life; }),
push_shards_.end());
debris_.update(frame_dt, game.corruption.value());
concrete_debris_.update(frame_dt);
@ -1598,7 +1670,8 @@ void Presenter::draw_scene(Game& game) {
const float flash = actor_flash(e.hit_flash, 6.0f);
const float walk = std::min(1.0f, e.speed / 4.5f);
models_.draw(model, {e.pos.x, bob, e.pos.y}, yaw, 1.0f, WHITE,
flash, !mold, walk, flash, e.bob_phase, enemy_hiss(e));
flash, !mold, walk, enemy_stagger(e), e.bob_phase,
enemy_hiss(e));
}
// CONCRETE CALL: a rough heap of slabs gathered around the agent, then
@ -1685,6 +1758,18 @@ void Presenter::draw_scene(Game& game) {
static_cast<unsigned char>(110 + 110 * t)});
}
// PUSH: pieces of the same shattered-concrete GLB the CALL heap uses,
// tumbling outward with the shockwave before fading into the dust.
for (const PushShard& s : push_shards_) {
if (!cull.visible(s.pos.x, 0.5f, s.pos.z, 0.8f)) continue;
const float t = std::clamp(s.age / std::max(0.01f, s.life),
0.0f, 1.0f);
const float fade = 1.0f - t * t;
models_.draw(ActorModel::Debris, s.pos, s.yaw, s.size,
Color{228, 198, 156, 255}, 0.0f, false, 0.0f, 0.0f,
0.0f, 0.0f, {0.0f, 0.0f, 0.0f}, fade);
}
// Telegraphs, dust puffs and post-collapse implosions.
for (const SkillRing& r : skill_rings_) {
if (!cull.visible(r.pos.x, r.height, r.pos.y, r.radius)) continue;

View file

@ -53,6 +53,18 @@ struct SkillRing {
Color color{};
};
// PUSH's GLB rubble: the same shattered-concrete model the CALL heap uses,
// flung outward as a one-shot presentation effect (no simulation state).
struct PushShard {
Vector3 pos{};
Vector3 vel{};
float yaw = 0.0f;
float spin = 0.0f;
float size = 0.0f;
float age = 0.0f;
float life = 0.0f;
};
class ViewCull;
class Presenter {
@ -95,6 +107,7 @@ private:
void spawn_skill_ring(Vec2 pos, float radius, float end_radius, float life,
Color color, float spin = 0.0f,
float height = 0.14f);
void spawn_push_shards(Vec2 center, float radius);
// Skills shake nearby shelves/tables/garbage cans into paper + rock debris
// without destroying the props (presentation-only).
void shed_surface_debris(Vec2 center, float radius);
@ -138,4 +151,5 @@ private:
std::vector<Spark> sparks_;
std::vector<RoundTrail> trails_;
std::vector<SkillRing> skill_rings_;
std::vector<PushShard> push_shards_;
};

View file

@ -30,7 +30,9 @@ void draw_skill_icon(const Game& game, SkillType type, float x, float y,
? Color{226, 220, 206, 250}
: (type == SkillType::Warp
? Color{78, 201, 176, 250}
: Color{245, 197, 24, 250});
: (type == SkillType::Push
? Color{228, 198, 156, 250}
: Color{245, 197, 24, 250}));
const Color stamp = ready >= 1.0f ? accent : Color{150, 148, 142, 220};
constexpr float size = 58.0f;
DrawRectangle(x, y, size, size, Color{14, 14, 16, 230});
@ -56,6 +58,21 @@ void draw_skill_icon(const Game& game, SkillType type, float x, float y,
static_cast<int>(x) + 19, static_cast<int>(y) + 34, stamp);
DrawLine(static_cast<int>(x) + 39, static_cast<int>(y) + 34,
static_cast<int>(x) + 44, static_cast<int>(y) + 34, stamp);
} else if (type == SkillType::Push) {
// Four outward arrows: an omnidirectional shove from the agent.
DrawCircle(x + 29.0f, y + 34.0f, 3.0f, stamp);
const int dirs[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
for (int i = 0; i < 4; ++i) {
const int ox = static_cast<int>(x) + 29;
const int oy = static_cast<int>(y) + 34;
const int ex = ox + dirs[i][0] * 16;
const int ey = oy + dirs[i][1] * 16;
DrawLine(ox + dirs[i][0] * 5, oy + dirs[i][1] * 5, ex, ey, stamp);
if (dirs[i][0] != 0)
DrawLine(ex, ey, ex - dirs[i][0] * 5, ey - 4, stamp);
else
DrawLine(ex, ey, ex - 4, ey - dirs[i][1] * 5, stamp);
}
} else {
// Concentric collapse rings.
DrawCircleLines(x + 29.0f, y + 34.0f, 16.0f, stamp);
@ -246,20 +263,22 @@ void draw_hud(const Game& game) {
draw_bar(GetScreenWidth() / 2.0f - xp_w / 2.0f, GetScreenHeight() - 44, xp_w, 18,
game.xp / game.xp_to_next, Color{245, 197, 24, 235}, "RESONANCE SHARDS");
// Two active-skill stamps above the XP bar. Both share one autoplay mode
// label, since autoplay drives the whole SkillSystem.
// Active-skill stamps above the XP bar. All share one autoplay mode label,
// since autoplay drives the whole SkillSystem.
{
constexpr float kSize = 58.0f, kGap = 22.0f;
const bool have_fluoro = game.skill_system.fluorescent_unlocked;
const int icon_count = have_fluoro ? 3 : 2;
const int icon_count = have_fluoro ? 4 : 3;
const float total = kSize * icon_count + kGap * (icon_count - 1);
const float x0 = GetScreenWidth() / 2.0f - total / 2.0f;
const float y = GetScreenHeight() - 110.0f;
draw_skill_icon(game, SkillType::ConcreteCall, x0, y, "J");
draw_skill_icon(game, SkillType::Warp, x0 + kSize + kGap, y, "K");
draw_skill_icon(game, SkillType::Push,
x0 + 2.0f * (kSize + kGap), y, "L");
if (have_fluoro)
draw_skill_icon(game, SkillType::Fluorescent,
x0 + 2.0f * (kSize + kGap), y, "U");
x0 + 3.0f * (kSize + kGap), y, "U");
const SkillSystem& skills = game.skill_system;
const char* mode = !skills.autoplay_enabled ? "OFF"

View file

@ -99,7 +99,7 @@ int main() {
InputState in{};
in.toggle_autoplay = true;
game.update(in, kDt);
check(!game.skill_system.autoplay_enabled, "L disables autoplay");
check(!game.skill_system.autoplay_enabled, "Tab disables autoplay");
check(!game.skill_system.autoplay_active(), "disabled autoplay is inactive");
game.events.clear();
@ -305,6 +305,113 @@ int main() {
"CALL steers its landing point toward a moving crowd");
}
// --- PUSH (L): radial shove, stagger and damage ------------------------
{
Game game(17);
game.enemy_system.clear();
game.player.pos = {0.0f, 0.0f};
game.skill_system.autoplay_enabled = false;
game.enemy_system.spawn(EnemyType::HissBrute, {2.0f, 0.0f}, game.corruption);
game.enemy_system.spawn(EnemyType::HissBrute, {-2.5f, 0.5f}, game.corruption);
game.enemy_system.spawn(EnemyType::HissBrute, {0.5f, 2.8f}, game.corruption);
const float hp_before = total_hp(game.enemy_system);
const auto avg_dist = [](const EnemySystem& enemies, Vec2 center) {
float sum = 0.0f;
for (const Enemy& e : enemies.enemies) sum += distance(e.pos, center);
return sum / static_cast<float>(enemies.enemies.size());
};
const float before = avg_dist(game.enemy_system, game.player.pos);
InputState in{};
in.skill_push = true;
game.update(in, kDt);
check(game.skill_system.cooldowns[static_cast<int>(SkillType::Push)] > 0.0f,
"L starts the PUSH cooldown");
check(avg_dist(game.enemy_system, game.player.pos) > before + 1.0f,
"PUSH shoves the crowd outward");
bool staggered = true;
for (const Enemy& e : game.enemy_system.enemies)
if (e.stagger_timer <= 0.0f) staggered = false;
check(staggered, "PUSH staggers every victim");
check(total_hp(game.enemy_system) < hp_before - 100.0f,
"PUSH damages the crowd");
bool tagged = false;
for (int i = 0; i < game.events.count; ++i)
if (game.events.items[i].type == EventType::SkillCast
&& (game.events.items[i].flags & kCastPush))
tagged = true;
check(tagged, "PUSH emits its own cast flag bit");
game.events.clear();
}
// --- A manual L press always fires, even on an empty floor -------------
{
Game game(18);
game.enemy_system.clear();
game.skill_system.autoplay_enabled = false;
game.player.pos = {0.0f, 0.0f};
InputState in{};
in.skill_push = true;
game.update(in, kDt);
check(game.skill_system.cooldowns[static_cast<int>(SkillType::Push)] > 0.0f,
"no-target PUSH still starts its cooldown");
bool cast_event = false;
for (int i = 0; i < game.events.count; ++i)
if (game.events.items[i].type == EventType::SkillCast
&& (game.events.items[i].flags & kCastPush))
cast_event = true;
check(cast_event, "no-target PUSH still emits its telegraph");
}
// --- PUSH autoplay waits for a real crowd ------------------------------
{
Game game(19);
game.enemy_system.clear();
game.player.pos = {0.0f, 0.0f};
game.config.no_player_damage = true;
// Isolate PUSH: CALL/WARP would otherwise spend their cooldowns on the
// same small crowd before PUSH's autoplay scan gets a chance.
game.skill_system.cooldowns[static_cast<int>(SkillType::ConcreteCall)] = 100.0f;
game.skill_system.cooldowns[static_cast<int>(SkillType::Warp)] = 100.0f;
InputState in{};
for (int tick = 0; tick < 60; ++tick) game.update(in, kDt);
check(game.skill_system.cooldowns[static_cast<int>(SkillType::Push)]
<= 0.0f,
"autoplay waits for a crowd before PUSH");
for (int i = 0; i < 4; ++i)
game.enemy_system.spawn(EnemyType::HissBrute,
{2.0f + i * 0.4f, 0.5f}, game.corruption);
bool cast = false;
for (int tick = 0; tick < 60 && !cast; ++tick) {
game.update(in, kDt);
for (int i = 0; i < game.events.count; ++i)
if (game.events.items[i].type == EventType::SkillCast
&& (game.events.items[i].flags & kCastPush))
cast = true;
game.events.clear();
}
check(cast, "PUSH autoplays once enemies are close");
}
// --- A staggered enemy holds position, then resumes ---------------------
{
Game game(20);
game.enemy_system.clear();
game.skill_system.autoplay_enabled = false;
game.config.no_player_damage = true;
game.player.pos = {0.0f, 0.0f};
game.enemy_system.spawn(EnemyType::HissBrute, {3.0f, 0.0f}, game.corruption);
Enemy& e = game.enemy_system.enemies[0];
e.stagger_timer = 1.0f;
const Vec2 start = e.pos;
InputState in{};
for (int tick = 0; tick < 30; ++tick) game.update(in, kDt);
check(distance(e.pos, start) < 0.01f, "stagger stops the chase");
check(e.stagger_timer > 0.0f && e.stagger_timer < 1.0f,
"stagger decays over time");
}
if (failed) return 1;
std::printf("skills: OK\n");
return 0;

View file

@ -11,6 +11,7 @@
import math
import os
import random
import sys
import bpy
@ -32,7 +33,8 @@ K.clear_scene()
P = K.PALETTE
P.update({"plastic": "#2a2d33", "screen": "#10151c", "duck": "#f2c230",
"brass": "#b89348", "glass": "#9fc4cf",
"concrete_lt": "#9d9c96", "concrete_mid": "#6f7072"})
"concrete_lt": "#9d9c96", "concrete_mid": "#6f7072",
"concrete_warm": "#b7a184"})
def place(obj, rot=(0.0, 0.0, 0.0), offset=(0.0, 0.0, 0.0)):
@ -234,47 +236,91 @@ def build_crate():
# -------------------------------------------------------------------- debris
def build_debris():
# A heap of broken concrete, not a single floating slab: the active skill
# CONCRETE CALL reuses this model as its flying pile, so the silhouette has
# to read as rubble at tactical distance. Feet stay at the origin.
# A shattered floor tile, not a smooth boulder. CONCRETE CALL uses this as
# its flying heap and PUSH sheds the same rubble outward in a shockwave, so
# the broken-slab silhouette has to read at tactical distance. Feet at 0.
r = K.new_actor("Debris")
K.blob(r, "slab", (0, 0, 0.42), (0.92, 0.70, 0.30), P["concrete_lt"],
subdiv=3, warp=0.34, seed=7, smooth=False, ao=0.12)
def jagged(rx, ry, seed):
rng = random.Random(seed)
pts = []
for i in range(9):
a = 2.0 * math.pi * i / 9
k = rng.uniform(0.78, 1.12)
pts.append((math.cos(a) * rx * k, math.sin(a) * ry * k))
return pts
# Two broken tiles, one tilted, give the mass a legible broken-slab edge
# instead of the old single smooth blob.
main = K.plate(r, "slab_main", jagged(0.84, 0.60, 41), 0.30, 0.54, 0.93,
P["concrete_lt"], ao=0.14)
place(main, rot=(0.04, -0.06, 0.12))
tilt = K.plate(r, "slab_tilt", jagged(0.50, 0.38, 42), 0.36, 0.64, 0.76,
P["concrete_mid"], shift=(0.16, -0.10), ao=0.12)
place(tilt, rot=(0.42, -0.26, -0.34))
chip = K.plate(r, "slab_chip", jagged(0.32, 0.26, 43), 0.40, 0.62, 0.74,
P["concrete_warm"], shift=(-0.30, 0.18), ao=0.10)
place(chip, rot=(-0.38, 0.22, 0.55))
K.blob(r, "fracture", (0.0, 0.0, 0.26), (0.70, 0.52, 0.24),
P["concrete"], subdiv=1, warp=0.28, seed=9, smooth=False, ao=0.10)
chunks = [
((-0.55, 0.08, 0.22), (0.40, 0.32, 0.22), 11, "concrete_lt"),
((0.50, 0.18, 0.24), (0.38, 0.30, 0.24), 12, "concrete_mid"),
((0.18, -0.48, 0.20), (0.36, 0.28, 0.20), 13, "concrete_lt"),
((-0.34, -0.38, 0.26), (0.30, 0.26, 0.28), 14, "concrete"),
((0.52, -0.36, 0.32), (0.28, 0.26, 0.32), 15, "concrete_lt"),
((0.00, 0.52, 0.24), (0.34, 0.26, 0.24), 16, "concrete_mid"),
((-0.56, 0.10, 0.20), (0.38, 0.30, 0.20), 11, "concrete_lt"),
((0.52, 0.20, 0.24), (0.34, 0.28, 0.22), 12, "concrete_mid"),
((0.16, -0.50, 0.18), (0.34, 0.26, 0.18), 13, "concrete_warm"),
((-0.34, -0.40, 0.24), (0.28, 0.24, 0.26), 14, "concrete"),
((0.50, -0.34, 0.32), (0.26, 0.24, 0.30), 15, "concrete_lt"),
((0.00, 0.54, 0.22), (0.32, 0.24, 0.22), 16, "concrete_mid"),
]
for i, (center, scale, seed, tone) in enumerate(chunks):
K.blob(r, "chunk_%d" % i, center, scale, P[tone],
subdiv=2, warp=0.30, seed=seed, smooth=False, ao=0.10)
K.plate(r, "rebar_plate", K.octagon(0.34, 0.22), 0.68, 0.72, 0.9,
P["steel_dk"], shift=(0.14, 0.0))
for i, (x, y, z, tilt) in enumerate([
(-0.40, -0.14, 0.66, (0.3, -0.2, 0.4)),
(0.30, 0.22, 0.70, (-0.4, 0.3, -0.2)),
(0.46, -0.26, 0.60, (0.2, 0.4, 0.3)),
subdiv=2 if i % 2 == 0 else 1, warp=0.32, seed=seed,
smooth=False, ao=0.10)
# Concrete splinters stand proud of the mass: sharp facets catch the key
# light and break up the top silhouette from every camera angle.
for i, (x, y, z, size, tilt_v) in enumerate([
(-0.52, -0.18, 0.52, 0.30, (0.3, -0.2, 0.5)),
(0.38, 0.30, 0.58, 0.26, (-0.4, 0.3, -0.3)),
(0.18, -0.42, 0.50, 0.24, (0.2, 0.4, 0.6)),
(-0.12, 0.40, 0.54, 0.22, (-0.3, 0.2, 0.4)),
]):
K.crystal(r, "growth_%d" % i, (x, y, z), 0.26, P["hiss"],
sides=5, seed=30 + i, tilt=tilt)
K.crystal(r, "splinter_%d" % i, (x, y, z), size,
P["concrete_warm"] if i % 2 else P["concrete_lt"],
sides=4, seed=50 + i, tilt=tilt_v, ao=0.08)
# Bent rebar pokes out of the broken faces — the detail that sells rubble.
for i, pts in enumerate([
[(-0.42, 0.18, 0.46), (-0.58, 0.34, 0.72), (-0.52, 0.50, 0.80)],
[(0.46, -0.12, 0.40), (0.66, -0.24, 0.62), (0.72, -0.18, 0.74)],
[(0.10, 0.46, 0.44), (0.16, 0.64, 0.66)],
]):
K.tube(r, "rebar_%d" % i, pts, [0.022] * len(pts),
P["steel_dk"], sides=5)
# Hiss corruption stays the accent colour: growths plus glowing fractures.
for i, (x, y, z, tilt_v) in enumerate([
(-0.38, -0.14, 0.68, (0.3, -0.2, 0.4)),
(0.30, 0.22, 0.72, (-0.4, 0.3, -0.2)),
(0.46, -0.26, 0.62, (0.2, 0.4, 0.3)),
]):
K.crystal(r, "growth_%d" % i, (x, y, z), 0.24, P["hiss"],
sides=5, seed=30 + i, tilt=tilt_v)
for i in range(3):
K.tube(r, "crack_%d" % i,
[(-0.5 + i * 0.45, -0.4, 0.58),
(-0.3 + i * 0.45, -0.1, 0.68),
(-0.1 + i * 0.45, 0.2, 0.62)],
[0.018, 0.02, 0.014], P["hiss_hot"], sides=5)
# One chunk dips 3 cm under the origin; lift the whole heap so its feet
# sit exactly on the floor after export.
# A few pieces dip under the origin; lift the heap so its feet sit exactly
# on the floor after export.
for part in r.children:
for v in part.data.vertices:
v.co.z += 0.03
part.data.update()
return r
BUILDERS = [
("hotline", build_hotline, 1200),
("tv", build_tv, 1200),