-
Notifications
You must be signed in to change notification settings - Fork 455
Open
Description
Purpose
When launching a nuke, it is unclear where it might land, leading to situations where the player may lose due to accidentally broken alliances. This is irritating.
I will add interactive nuke previews (Atom, Hydrogen, MIRV) to the build & radial menus, and dim the UI while previewing so players can aim with confidence.
Objectives
Implement a NukePreview render layer that visualizes:
- Circle/band preview for Atom & Hydrogen bombs.
- Inner band for area guaranteed to be hit
- Outer band for the area that might be hit
- Distributed mini-warhead previews for MIRV across the target nation.
- Hook previews to both build menu and radial menu:
- Start preview on hover of enabled nuke items; stop on hover leave/close.
- Dim the active menu while previewing; restore afterward.
- Keep previews anchored to a world tile so they remain correct during zoom/pan.
- Only preview when the nuke type in question can be launched
- Add unit tests covering preview paths and radial-menu item behavior.
Description
What’s included
- New render layer: NukePreview
(src/client/graphics/layers/NukePreview.ts)
- Reads from uiState.nukePreview (active + nuke type) and uiState.nukeAnchor (world tile).
- Atom/Hydrogen:
- Draws inner-radius ring + soft fill, probabilistic band to outer radius, and two animated dashed rings outside the band.
- Uses UnitType.AtomBomb / Unit.Type.HydrogenBomb magnitudes (from the config) for ring sizes.
- MIRV: draws mini targets spread across the target nation:
- Uniform sampling within 1500-tile radius (matches MirvExecution.mirvRange).
- Owner-gated (same owner as the anchor) and land-only tiles.
- Min spacing of 25 tiles Manhattan (mirrors proximityCheck).
- Uses UnitType.MIRVWarhead magnitudes (from the config) for ring sizes.
- Deterministic per (type, anchor, owner) with cached results until signature changes.
- UIState
UIState
extended to contain:
nukePreview?: { active: boolean; nukeType: string };
nukeAnchor?: { x: number; y: number };
- Wiring & UX:
- GameRenderer: registers
NukePreview
layer and providesuiState
. - BuildMenu:
- Sets
uiState.nukeAnchor
to the clicked world tile when the menu opens. - On hover over enabled Atom/Hydrogen/MIRV items: sets
uiState.nukePreview
and adds a subtle “dim” state to the menu; clears on leave/close.
- Sets
- RadialMenu:
- Receives
uiState
inMenuElementParams
. createMenuElements
: marks nukes (isNuke
) and providesonHoverEnter
/onHoverLeave
to set/clearuiState.nukePreview
.- Adds a small helper to dim the radial container while previewing.
- Stores
uiState.nukeAnchor
when opening on a tile.
- Receives
- PlayerActionHandler: small helpers to start/stop preview (used internally where helpful).
- GameRenderer: registers
You can see what this looks like here:
Atom
Hydro
MIRV
From the build menu
TheGiraffe3
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Triage