diff --git a/Project_Context.md b/Project_Context.md index 3e2c6d5..fd56cfd 100644 --- a/Project_Context.md +++ b/Project_Context.md @@ -4,7 +4,7 @@ A snapshot of **where the project is and how it works** — the authoritative reference for current architecture, implemented systems, conventions, and known debt. It pairs with [`Project_Roadmap.md`](Project_Roadmap.md), which is the forward-looking plan. When the two disagree, this document describes *what exists today*; the roadmap describes *what's planned next*. -Last substantial update: 2026-06-24. +Last substantial update: 2026-07-14. --- @@ -56,10 +56,11 @@ Unity **6.4 (6000.4.4f1)**, URP, IL2CPP, .NET Standard 2.1, Linear color space, - `TowerPlacementManager` (server-validated placement queue) — `SpawnTower` now **seats towers flush on the ground from their mesh bounds** (`SeatOnGround`), so any pivot works (replaced the old hard-coded y=0.5). `Builder` build queue with staged construction/pause/cancel/refund, RTS selection, owner tinting. - **Construction-phase build visuals:** `BuildSiteVisual` swaps between an ordered set of phase prefabs as a tower builds — `ConstructionPhaseSet` SO + optional per-tower `TowerDefinition.ConstructionPhases`, with a project-default set and a legacy cube Y-scale fallback. `BuildSiteVisual` resolves its def via `TowerTypeId` (catalog), like `TowerInstance`. - **Tesla Coil tower:** Electric, `AllInRange` (zaps every enemy in range each 0.5s tick). `TeslaArcVisual` draws arced, crackling, HDR `LineRenderer` bolts that flicker, plus **real point lights** (emitter flash + per-impact lights at struck enemies, capped) so the electricity actually illuminates the scene — emission/bloom alone don't cast light. +- **Tower Sell** (branch `tower-sell`, verified in-engine 2026-07-14): selecting an owned, completed tower shows a **Sell** action in the command grid's **bottom-right** slot (owner-gated; a non-owner sees it disabled). `TowerInstance.RequestSellServerRpc` (owner-validated, like paint) refunds `TowerDefinition.SellRefundPercent` (default 0.75) of the tower's replicated `goldInvested` (placement + any future upgrade spend), except a `FullRefundIfUnupgraded` tower (the **Wall**) refunds 100% while `upgradeCount == 0`. The refund is **not** counted as round income — `PlayerGoldManager.AwardGold(amount, countAsEarned:false)`. Selling despawns the tower (`OnNetworkDespawn` un-stamps the footprint as a **batch** and clears selection) and broadcasts a coin **VFX + rustle SFX** through `SellEffectSpawner` (scene singleton mirroring `FloatingTextSpawner`) via `TowerPlacementManager.PlaySellEffectRpc` (routed off a persistent object because the tower despawns the same frame). `TowerInstance.ServerAddUpgradeInvestment` is the seam the future upgrade system writes to. The coin VFX is an **artist-authored** prefab (`FX_SellTower`: a Shuriken **mesh-particle** burst of the Blender `Coin` model with an **emissive** gold material — emissive so it survives the grimdark grade); `CoinBurstVfx` is the zero-art code-gen fallback, and new reusable `TransientEffect` self-destructs one-shot effect prefabs (for VFX-Graph effects that lack a Stop Action). ### Enemies & pathfinding - `EnemyHealth` (replicated HP, damage types, `IsFlying`, held state), `EnemyStatus` (lingering effects: slow/DoT), `EnemyMovement` (A* path following, zone-leak attribution, death/sink sequence). -- `PathfindingService` (A* on the runtime walkability grid, octile heuristic, corner-cut prevention, line-of-sight path smoothing; re-paths on tower placement/removal). +- `PathfindingService` (A* on the runtime walkability grid, octile heuristic, corner-cut prevention, line-of-sight path smoothing). **Re-paths via a budgeted scheduler:** grounded enemies `RegisterMover`/`UnregisterMover`; on a maze change the service enqueues them and recomputes under a per-frame `recomputeBudgetMs` (default 1.5 ms) drain, spreading the work across frames so a placement/sell with a full wave present no longer spikes a frame (was ~0.5 s). Safe because selling only opens the maze and placement is BFS-guaranteed to leave a route, so a few frames of slightly-stale path is invisible. - **Flying enemies:** path on the **baked terrain grid** (`LevelLoader.IsBaseWalkable`) so they soar over towers; compute once, never re-path; spawn elevated by `EnemyDefinition.FlightHeight`. - Content: ~10 enemy definitions/prefabs (Crystal Golem / Cyclops / Ent variants, Undead Drake = the flying test enemy), 10 wave definitions. @@ -102,4 +103,4 @@ Unity **6.4 (6000.4.4f1)**, URP, IL2CPP, .NET Standard 2.1, Linear color space, - **Catalog index 0 is a reserved sentinel** (valid `TowerTypeId`s start at 1) — easy to forget when wiring the catalog in the inspector. - **Catalog-index identifiers aren't session-stable** — blocks cross-match persistence until a stable ID is added. - **Paint system frozen**; **Race vs Builder** naming unresolved; the gold **"Buy Roll available any time"** rule is provisional and may change. -- **Stubbed/unbuilt:** tower Upgrade/Sell actions (HUD buttons disabled), enemy resistances/weaknesses, in-match race-pick countdown. +- **Stubbed/unbuilt:** tower **Upgrade** action (HUD button still disabled; the `TowerInstance.ServerAddUpgradeInvestment` seam is ready for it), enemy resistances/weaknesses, in-match race-pick countdown. *(Tower **Sell** is now done — see Combat & towers.)* diff --git a/Project_Roadmap.md b/Project_Roadmap.md index a41edbf..aa95f7f 100644 --- a/Project_Roadmap.md +++ b/Project_Roadmap.md @@ -4,7 +4,7 @@ The **forward-looking plan**: what's done, what's next, and the sequencing. Current-state architecture and the full list of implemented systems live in [`Project_Context.md`](Project_Context.md) — read that first for "how things work today." This document focuses on direction and remaining work. -Last substantial update: 2026-06-24. +Last substantial update: 2026-07-14. --- @@ -36,6 +36,8 @@ All players start with the **same three towers** — **Basic Arrow** (ground+air **Done & merged:** functional match loop end-to-end, HUD, lobby + race selection, economy, enemies + A* pathfinding, **flying enemies + air-targeting**, **per-player tower deck** (keystone #1), **draft Slice 1** (spine + "new tower"), **TowerRegistry removal** (towers replicate by `TowerTypeId`), **per-tower construction-phase build visuals**, **ground-seating from mesh bounds**, **Tesla Coil tower** (Electric + AllInRange + arc VFX with real flash/impact lights). +**Done, on branch `tower-sell` (pushed to origin; NOT yet merged to `main`):** **Tower Sell** — owner-gated Sell action, refunds `SellRefundPercent` (default 75%) of invested gold, the **Wall refunds 100% while un-upgraded**, refund excluded from round income, coin **VFX** (artist-authored emissive mesh-particle `FX_SellTower`, with a `CoinBurstVfx` code-gen fallback) + rustle **SFX**. Also a **budgeted enemy re-path scheduler** in `PathfindingService` that removes the ~0.5 s frame hitch on any maze change (sell/placement) with a full wave present, plus a batched footprint un-stamp and the NGO `RequireOwnership`→`InvokePermission` deprecation cleanup. Verified in-engine 2026-07-14. + **In progress (branch `feature/post-processing`):** project-wide **grimdark post-processing** grade + HDR; Tesla arc lighting polish. *(This branch was fast-forwarded onto the Tesla work; commit the post-processing assets + the `TeslaArcVisual` light additions.)* **Paused:** in-match Paint system (overlaps with systemic upgrades). @@ -80,7 +82,8 @@ Player profile saving owned content; **win/loss reward pools** drawn server-side ## Part B — Functional gameplay remainder (not roguelike-specific) -- **Tower Upgrade / Sell actions** — HUD buttons exist but are disabled. Sell first (refund + despawn), then per-tower upgrade if the systemic model leaves room for it. +- **Tower Sell — ✅ DONE** (branch `tower-sell`): refund + despawn + coin VFX/SFX; 75% of invested gold, Wall 100% while un-upgraded, refund not counted as income; `TowerInstance.ServerAddUpgradeInvestment` records upgrade spend for the refund and is the seam the Upgrade system will write to. +- **Tower Upgrade action** — HUD button still disabled. Build it once the systemic-upgrade model (A3) settles whether per-tower upgrade trees are wanted on top of the systemic modifiers. - **Enemy resistances / weaknesses** — `EnemyHealth.TakeDamage` has the stub slot; info panel has the placeholder. - **Terrain architecture decision** — Unity Terrain vs mesh vs ProBuilder. Builder code is terrain-agnostic; decide before heavy art. - **Camera polish** — cursor-anchored zoom near map edges, center-on-builder hotkey, race/phase-aware initial position.