Skip to content

feat(s6): diegetic polish + light onboarding#152

Merged
LightAxe merged 8 commits into
mainfrom
worktree-s6-polish
May 27, 2026
Merged

feat(s6): diegetic polish + light onboarding#152
LightAxe merged 8 commits into
mainfrom
worktree-s6-polish

Conversation

@LightAxe
Copy link
Copy Markdown
Owner

Summary

S6-Polish render-only pass. No sim version bump.

  • Part A — Polished visualizations: Spider reticle gains sine-wave alpha pulse and scale animation when Hunting/Striking; hunger ring uses linear color gradient from pale to deep red with a secondary faster pulse at ≥80% hunger. Combat tile glow is now per-grid (blue for player underground, orange for enemy underground, yellow for surface contested) with 5-frame fade-out tracking.
  • Part B — New Phase-6 cues: Full-screen red flash on queen HP drop (suppressed first 40 ticks); screen-edge red flash on invasion events with direction inferred from entrance vs. queen chamber position; event cursor (nextEventIndex) drains world.events each render frame to dispatch effects and captions.
  • Part C — Loss-screen attribution: buildOutcomeAttribution() now handles S5 tiebreak events (round_end with TimeoutTiebreak/StalemateTiebreak) before falling through to queen_death narratives. showGameOverOverlay receives narrativeSeed and displays it as a subtitle.
  • Part D — First-occurrence captions: 10-key registry in onboarding-captions.ts; each caption fires exactly once per session (reset per round). Captions are triggered from command dispatch (dig, chamber, food mark, rally) and per-frame checks (spider visible, spider priority, AI invading, spider rampage, queen damage, queen starvation).

Test plan

  • npm run test — 2243 tests passing, 76 files
  • npm run test:coverage — all gates ≥80% (Statements 89.71%, Branches 82.97%, Functions 94.76%, Lines 92.29%)
  • Manual: trigger invasion → screen edge flashes on correct side
  • Manual: let queen take damage → full-screen red pulse; no pulse in first 2 sim-seconds
  • Manual: first dig → caption appears; second dig same session → no caption
  • Manual: loss screen shows narrativeSeed narrative text

Files changed

File Change
src/render/sprites.ts Add 3 glow color constants
src/render/draw-surface.ts Spider reticle pulse + hunger ring gradient; contested glow with per-grid color + fade
src/render/draw-underground.ts Underground home-ground combat tile glow pass
src/render/game-scene.ts Event cursor; queen HP tracking; event dispatch; loss-screen narrative; caption wiring
src/render/ui-scene.ts showCaption(); showGameOverOverlay receives narrativeSeed
src/render/summary-builder.ts Tiebreak + updated queen_death narrative strings; buildOutcomeAttribution exported
src/render/screen-effects.ts (new) Screen-edge flash; queen damage pulse; inferFlashDirection
src/render/onboarding-captions.ts (new) Caption registry + checkAndTrigger + resetCaptions
src/render/summary-builder.test.ts (new) 14 tests: all tiebreak paths, queen_death strings, null fallback
src/render/onboarding-captions.test.ts (new) 16 tests: per-key, suppression, reset, chamber substitution
src/render/screen-effects.test.ts (new) 12 smoke tests: constants + inferFlashDirection

🤖 Generated with Claude Code

S6-Polish pass: polished spider reticle/hunger ring, per-grid combat tile glow
with fade-out, queen damage flash, invasion screen-edge flash, loss-screen
narrative attribution from sim events, and 10 first-occurrence captions.
No sim version bump — render-only per ADR-0011.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a599f8823

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/render/screen-effects.ts
Comment thread src/render/game-scene.ts
Comment thread src/render/game-scene.ts Outdated
- screen-effects: setScrollFactor(0) on edge-flash graphics to pin to
  viewport instead of world coords (P1: flash was off-screen when camera panned)
- game-scene: filter onboarding caption triggers to player colony only;
  AI commands in the same drain pass were consuming first-occurrence captions
  before the player acted (P2)
- game-scene: surface aiInvading caption on ai_state_transition fallback
  path, not just invasion_start events (P2: caption was marked triggered
  without ever being shown)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LightAxe
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2891ef07e0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/render/game-scene.ts Outdated
Comment thread src/render/game-scene.ts Outdated
- game-scene: replace array-index event cursor with tick-based filtering;
  the index cursor became stale after splice evictions at cap (2000 events),
  causing late-game invasion/rampage cues to stop firing silently
- game-scene: map ChamberType numeric IDs to readable labels before
  substituting into the chamber onboarding caption template; String(0)
  was producing "This one is a 0." instead of "This one is a Queen."

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LightAxe
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59796c8b40

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/render/draw-underground.ts
Comment thread src/render/draw-surface.ts Outdated
- draw-surface: fix 32-bit color literal 0xffeecccc → 0xffeecc; lerpColor
  uses 24-bit bitmasks so the extra byte was silently truncating the red
  channel to 0xee, making the spider tint darker than specified (P3)
- game-scene: clear undergroundGlowFrames on colony view toggle; tile keys
  are not colony-scoped so stale entries from the previous grid were drawing
  false combat glows in the new grid for up to 5 frames (P2)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LightAxe
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1128359d13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/render/summary-builder.ts Outdated
Comment thread src/render/game-scene.ts Outdated
- summary-builder: null queen_death cause now uses gameOutcome to select
  narrative; legacy traces (simVersion < V16) with cause=null no longer
  show a defeat line when the actual outcome was Victory or MutualDestruction
- game-scene: gate spider onboarding caption on Hunting/Striking state;
  spider exists from tick 0 in Patrolling so triggering on mere existence
  was consuming the one-shot caption before any visible encounter
- summary-builder.test: add two new cases for null-cause Victory and
  MutualDestruction paths (2245 tests total)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LightAxe
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 062fd1b7a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/render/summary-builder.ts
Comment thread src/render/draw-underground.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 062fd1b7a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/render/summary-builder.ts
buildPlaytraceSummary in the upload path was called without gameOutcome,
so legacy traces (simVersion < V16) with cause=null queen_death events
would produce "Your colony has fallen." even for Victory uploads.
Thread outcomeToWire(input.outcome) as the third argument, consistent
with the game-over overlay path that already passes it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LightAxe
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb67f341fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/render/summary-builder.ts Outdated
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

queen_death events can describe either queen's death. All S6 narratives
were written from the defeat perspective, so a Victory displayed
"Enemy fighters...reached your queen" under VICTORY and in uploaded
summaries. Select narrative table by gameOutcome: Victory path uses
enemy-queen perspective; Defeat/unknown uses player-queen perspective.
MutualDestruction is symmetric and identical in both tables.

summary-builder.test: cover Victory perspective for all four causes
(2249 tests total).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LightAxe
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35acab474b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/render/game-scene.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35acab474b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/render/onboarding-captions.ts Outdated
- Underground glow cache: scope tile keys by colony ID so stale glows from
  one underground view don't bleed into the other when the player switches
  grids. Uses (colonyId << 24) | (ty << 16) | tx encoding; filter in draw
  loop uses >>> 24 (unsigned) for safe comparison.
- Starvation caption condition: fix > 0 (always true for a living queen) to
  < STARVATION_GRACE_TICKS so the onset caption fires only when at least one
  feeding has failed. Same fix applied to the boot-from-save load guard.
- Boot-from-save: seed lastProcessedEventTick from saved world so historical
  events don't replay as new on resume; seed queenStarvationTriggered when
  queen was already starving at save time.
- ai_state_transition fallback: add screen-edge flash to the Invading fallback
  path, gated on checkAndTrigger so it fires exactly once (when invasion_start
  didn't already consume it).
- Spider caption: remove impossible right-click instruction; replace with
  actionable fighter guidance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LightAxe
Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@LightAxe LightAxe merged commit 67a003a into main May 27, 2026
1 check passed
@LightAxe LightAxe deleted the worktree-s6-polish branch May 27, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant