Commit Graph

427 Commits

Author SHA1 Message Date
Brian Fertig 08d23f9613 refactor: replace stage clear targets with clear line boundary mechanic
Restructure Tetris Attack Stage Clear from "clear all target panels" to a
multi-stage round system with a sliding boundary line.

Gameplay changes:
- Each character now has 5 stages instead of a single match
- A CLEAR line appears after a set number of rows rise, then rides the
  stack upward; the objective is to clear everything above it
- Clearing a stage advances to the next: same board, faster speed, fresh line
- Stage progress is saved to localStorage; characters unlock sequentially
- Added a stage select screen with progress squares per character

Logic changes:
- Replaced `targetsTotal` with `clearLine` tracking and `countAboveLine`
- Added `advanceStage()` to resume play on the same stack one speed level higher
- Win condition now checks `countAboveLine() === 0` instead of target count
- Removed `target` flag from panels; panels below the line are irrelevant
- Continuous speed ramp via fractional `speed` per stage

UI changes:
- Clear line drawn as a pulsing bar with "◀ CLEAR" label outside the board
- "CLEAR LINE!" announcement on appearance, "STAGE N CLEAR!" banner on win
- HUD shows stage number instead of panel count
- Game over offers "Retry Stage", "Stage Select", or "Menu"

Asset changes:
- Backgrounds renamed to `background-{hero}-r{stage}.png` (5 per character)
- Lazy-load backgrounds per round instead of preloading all 30 images
- Updated tetrisattack.json with `stagesPerRound`, `stageSpeedStep`, and
  per-character `clearLineRows`

Tests:
- Rewrote stage clear soak tests for the new mechanic
- Added stage round progression, speed ramp, and board preservation tests
2026-07-21 10:00:09 -06:00
Brian Fertig 18412e34f9 feat: enhance Advance Wars replay HP display and terrain rendering, add Tetris Attack host backgrounds
Advance Wars:
- Add HP override system (seed/set/clearHpOverride) so units show correct
  HP during enemy-turn replay until their battle animation plays
- Redesign river/road channel rendering with layered depth: rivers get
  deep channel, light core, and ripple crests; roads get concrete shoulders,
  asphalt, and dashed centre lines phase-locked to tile seams

Tetris Attack:
- Add character sprite sheet and per-host background images (beth, jerry,
  michael, steve, victor, klaxon)
- Declare hero background assets in manifest; scene falls back gracefully
  when art is missing
- Update characterSheet path in tetrisattack-artwork.json
2026-07-20 23:20:58 -06:00
Brian Fertig ed2a60fa06 feat(tetris-attack): smooth panel fall animation and settling frame
- Track `_prevRow` on falling panels for interpolation during animation
- Add `_justLanded` flag to introduce a settling frame after panels land
- Interpolate panel Y position from previous row for smoother fall effect
- Defer match detection and chain-end logic until after settling frame
- Update assets: new background-menu and main-title images, update existing sprites
2026-07-20 19:21:08 -06:00
Brian Fertig aa97cbe9b4 feat(tetris-attack): load custom panel artwork sprite sheet
Replace procedural panel rendering with custom painted artwork
(tetrisattack-panels.png) for Tetris Attack game.
2026-07-20 18:17:07 -06:00
Brian Fertig 07a16f295d fix: preserve unit sprites until their death animation plays in pre-resolved turns
Units doomed to die later in a pre-resolved enemy turn were being removed
from the board prematurely during sync, before their death animation could
play. Now:

- syncUnits only prunes dead views on actual army elimination, not on
  mid-turn CO powers that would kill units later in the same turn
- Added 'loaded'/'joined' event handlers to remove views when units merge
  into transports at the correct animated moment
- setUnitVisibility skips views whose units are already gone from state,
  preserving mid-replay sprites until their event fires
2026-07-20 17:40:53 -06:00
Brian Fertig 85996ad02c feat: add Tetris Attack (Panel de Pon) with endless, stage clear, and puzzle modes
Implement the full Tetris Attack clone with three game modes:
- Endless: clear panels as the stack rises, speed increases with levels
- Stage Clear: defeat 6 character opponents (Beth, Jerry, Michael, Steve, Victor, Klaxon) in sequence
- Puzzle: solve 24 pre-vetted puzzles within move limits

Core engine (src/games/tetrisattack/TetrisAttackLogic.js) is a pure, deterministic
state machine with match detection, chain propagation, gravity, and scoring tables
matching the SNES original. Includes a headless verifier (verifyTetrisAttack.js)
testing match detection, chains, gravity invariants, top-out, puzzle solvability,
and seeded determinism.

Art is fully optional via drop-in spritesheets (spec: sprites.md); procedural
fallbacks draw 16-bit-style panel icons with distinct shapes for colorblind access.
Puzzle bank generated by genTetrisAttackPuzzles.js and verified as solvable within
optimal move counts.

Shared nintendo soundtrack reused via soundtrack overrides.
2026-07-20 00:04:26 -06:00
Brian Fertig 8e59c3b1bf feat: add day transition banner animation between turns
Import and play day banner animation when transitioning between turns
in Advance Wars game. The banner displays the current day number and
plays before allowing the next turn to begin, providing visual feedback
for day progression. Added safety check to cancel animation if scene
changes during playback.
2026-07-19 19:05:07 -06:00
Brian Fertig f96f2d491c feat(advancewars): add HP text display to battle animations and procedural cursor
- Add HP text readout to battle animations showing 1-10 scale HP
  (matching Advance Wars' classic HP display), with smooth tweening
- Extract cursor drawing into procedural texture, keeping it independent
  of the UI sheet
- Add advancewars-ui.png sprite sheet and update artwork config
2026-07-19 19:04:14 -06:00
Brian Fertig c0ad354458 feat(advance-wars): add contextual battle and movement sound effects
- Assign battle sounds to each unit type (gunfire, tank, cannon, missile, etc.)
  and play the appropriate sound on attack/counterattack in battle animations
- Add per-unit-type movement sounds (march for infantry/mech, engine-fast,
  engine-heavy) that loop during move animations and stop cleanly on completion
- Play jump sound during capture animation hops and activation sound on capture
- Play explosion sound when units are defeated in combat or crash
- Lighten unit tint relative to buildings so units remain visually distinct
  when standing on captured buildings
- Add new audio assets: battle sounds, march, 8bit-jump, and update battle-tank
2026-07-19 17:44:18 -06:00
Brian Fertig 427aacae6f feat(advancewars): show terrain backdrop in capture cut-in instead of plain rectangle
Replace the solid-color ground rectangle in the capture animation with a
proper terrain backdrop matching the ground the building sits on (plain,
shoal, etc.). Extract battleBgFrame, ensureBattleBgSheet, and add a new
groundBgFrame helper that maps building types to their underlying terrain,
avoiding duplicate building rendering since the building is already the
main squishing prop.
2026-07-19 16:31:33 -06:00
Brian Fertig a02e5a1913 feat(advancewars): add terrain-based battle scene backdrops
Introduce a new battle background spritesheet (advancewars-battlebg) that
displays context-appropriate backdrops behind each fighter during battle
cut-ins. The backdrop is selected based on the terrain/building type the
fighter is standing on (city, base, airport, port, plain, wood, mountain,
sea, reef, shoal, river, bridge, road, hq).

- Add battleBgSheet to artwork.json and asset manifest
- Implement playBattleAnim() backdrop system with terrain lookup
- Provide procedural fallback matching the real sheet's frame map for
  art-free playability
- Mirror defender backdrops to match mirrored defender sprites
- Document the 14-frame sheet spec in sprites.md (256×256 cells, 5 cols)
2026-07-19 16:22:21 -06:00
Brian Fertig 138b078dd2 feat: add pulsing animation to attack target tiles in Advance Wars
Introduce a breathing pulse effect (red fill + white border) for attack
target tiles to draw the player's eye when in "must pick a target" fire
mode. The previous static tint is preserved for the indirect-range preview
shown while a unit is merely selected.

- showAttackTiles now accepts optional { pulse: true } parameter
- Added tween-based animation with Sine.easeInOut breathing effect
- Properly clean up pulse tween in destroy() and clearOverlays()
- Updated AdvanceWarsGame to pass pulse: true when showing targets
2026-07-19 16:21:13 -06:00
Brian Fertig a0b3b5f063 feat(advancewars): add property capture cut-in animation with building squish
Introduce a cinematic capture animation when a unit captures a property:
a small window shows the capturing unit hopping atop the building, which
then squishes down to reflect remaining capture points (or pops back up
in the new owner's color if the capture completes).

- Add AdvanceWarsCaptureAnim.js with the full cut-in animation sequence
- Display remaining capture-points as a strength number on partially-
  captured buildings, tinted toward the owner's color
- Add `before` field to capturing events so the animation knows the
  starting HP
- Support partial unit sync so units are revealed action-by-action
  during turn replay instead of snapping to end-of-turn positions
- Add depth bias so units always render above buildings on the same tile
2026-07-19 13:55:48 -06:00
Brian Fertig fcc74bef28 feat(advancewars): improve battle animations and depth sorting
- Add new unit sprite sheet (advancewars-units.png/psd)
- Slow down all battle animations for better readability:
  - Attack, flash, death, and delay timings increased
  - Unit movement animation duration increased (70→180ms)
  - Explosion animation slowed down
  - Post-turn wait time increased (140→300ms)
- Merge props and units into shared Y-sorted "actors" depth band
  - Buildings and units now sort correctly by screen row
  - Move/attack overlays remain below actors for proper decal rendering
2026-07-19 11:48:30 -06:00
Brian Fertig bf71bfc3c7 feat(advance-wars): add unit progression system with mission-based unlocks
Introduce a unit unlock system that progressively grants access to new
unit types as the player advances through the campaign. Each mission
specifies which units each army can build, starting with basic units
and unlocking MD Tanks, Rockets, Anti-Air, Missiles, Lander, Cruiser,
and eventually the full armory.

- Add unit sprite sheet (advancewars-units.png) and artwork config
- Implement unlock validation in production and build options
- Add tutorial dialogue from Ethel explaining new mechanics and units
- Balance AI difficulty by reducing skill levels and aggression
- Adjust capture weights for more balanced AI behavior
- Add introductory city capture mechanic in first mission
- Update verification tool to support unlockedUnits
2026-07-19 10:55:18 -06:00
Brian Fertig 4a8b78c538 feat: add Advance Wars turn-based tactics game
Implement a full Advance Wars clone with campaign (20 missions) and
War Room skirmish mode. Includes:

- Headless game engine (AdvanceWarsLogic) with complete AW1 rules:
  terrain movement, combat, capture, production, transports, fuel,
  fog of war, CO powers, and multiple objective types
- AI opponent (skill 1-5, aggression/capture tuning) with BFS
  pathfinding, threat evaluation, production counter-tables, and
  fog trap awareness
- Canvas-rendered map view with procedural stand-ins that can be
  replaced by drop-in painted spritesheets (no code changes)
- 11 playable COs with unique day-to-day modifiers and powers
  (Hyper Repair, Lightning Strike, Tsunami, Meteor Strike, etc.)
- Campaign briefings with typewriter text and opponent portraits
- Comprehensive headless verification suite (rules, combat formula,
  pathfinding, economy, capture, fog, CO powers, soak tests)
- New assets: terrain/building sheets, adventure music tracks,
  game icon frame 86
- Refactor SpireClimb and SWDBG to use the shared soundtrack service
2026-07-19 09:43:58 -06:00
Brian Fertig 7713089466 feat: add per-game soundtracks for multiple games
Introduce game-specific music overrides using the soundtrack service.
Adds arcadedark and hacker music packs, and wires them to Balatro,
Colorado Defense, Tempest, Mastermind, Hexsweeper, Dot Link, and 2048.
Games now lazy-load their soundtrack assets on entry instead of sharing
a single generic music cache.
2026-07-18 17:21:32 -06:00
Brian Fertig e1a5c21180 feat: add per-game soundtrack system and Nintendo music for Super Kart
- Introduce soundtrack override system allowing games to define custom music
- Add Nintendo-themed soundtrack for Super Kart (2 tracks with metadata)
- Make main menu track configurable via data/music.json instead of hardcoded
- Add MusicPlayer volume parameter for per-soundtrack volume control
- Lazy-load per-game audio assets via assetManifest on game entry
- Add SPACE/X keyboard shortcuts to advance Super Kart menus
- Play kart-spinner SFX when player picks up an item in Super Kart
- Increase speech queue volume to 1.0
- Add Super Kart icons artwork and additional music assets
2026-07-18 16:53:49 -06:00
Brian Fertig 0109d33f02 Update audio 2026-07-18 15:24:59 -06:00
Brian Fertig e4a4531401 feat(superkart): add post-race victory cam, engine audio, and polished results screens
- VictoryCamDirector: cinematic post-race camera system with shuffled
  shot types (chase, orbit, front, trackside) and hard-cut transitions;
  player can press ENTER to skip.
- Engine audio: per-racer engine hum (heavy/fast/medium) with pitch
  tracking based on kart speed; engine-start sound at green light.
- Star power loop sound that stops when star expires.
- Positional audio: AI kart sounds (spin, hit, flatten) scale volume
  with distance from player.
- Enhanced event sounds: item-use, boost, EMP, squash, bump, coin,
  star now play appropriate SFX.
- Player kart autopiloted after finishing for victory-lap vignette;
  race phase waits for entire field (up to 90s safety cap).
- EMP now emits target list for per-target shrink sounds; squash
  collision emits event.
- Animated race results screen with staggered row reveals.
- Animated cup standings with running point counter and position
  arrows; tweens rows to new ranks.
- Podium reveal: 3rd → 2nd → 1st staggered with confetti, count-up,
  and CRT pulse; winner speech plays.
- Mode7 camera now tracks height and focal length; setCamera accepts
  arbitrary poses for cinematic shots.
- New audio assets: engine-start/heavy/fast/medium/rev, kart-coin,
  kart-flatten, kart-thump, kart-shrink, kart-spin, kart-hit,
  kart-shell, kart-star.
2026-07-18 15:24:49 -06:00
Brian Fertig 54a9614464 feat: add Super Kart themes, profile import/export, and Civilization spaceship notifications
- Super Kart: populate missing theme image paths, increase acceleration spread,
  and add a track loading panel to the editor
- Civilization: display completion notifications for spaceship parts with
  direct navigation to the building city
- Profile: implement export/import via .fcg files with validation, download,
  and restore flows
- UI: add multi-button modal support, improve ProfileScene layout with avatar
  masking and info card, and rename Arcade category to "Video Games"
2026-07-18 12:28:22 -06:00
Brian Fertig 61924c439f refactor(civilization): pick best available land defender as city build default
- Replace hardcoded 'warriors' default with pickNextBuild() for both
  founded and captured cities
- Captured cities now adopt the new owner's tech level when selecting
  their default unit (e.g., Phalanx if Bronze Working is known)
- Add verification tests for tech-dependent defaults on founding and capture
2026-07-18 09:08:44 -06:00
Brian Fertig 30629380b4 feat(civilization): add coinage/public works special builds + fix AI fallback
- Add Coinage (1 shield → 1 gold) and Public Works (2 shields → 1 food)
  special build options for cities, with remainder carry logic in shieldBox
- Update AI to fall back to producing gold or food instead of stockpiling
  redundant defenders when nothing else is available
- Fix mid-build detection to check build.type before comparing shield progress
- Add City Screen UI for special builds: display gain per turn, color-coded
  rows, and tooltips
- Only apply class-switch penalty when switching between unit/building
  production types
- Add verification tests for coinage payout, public works remainder carry,
  and AI special build fallback

feat(superkart): fix player kart scale + add missing backdrop images

- Compute PLAYER_KART_SCALE from MODE7 parameters instead of hardcoding,
  keeping player and AI karts consistent at the camera's follow distance
- Wire up previously null backdrops: volcano, scrapyard, swamp, speedway,
  nightcity
2026-07-18 09:08:26 -06:00
Brian Fertig 65cc0a2c79 feat(superkart): add beach theme and AI rubber-banding
- Add beach theme artwork and register paths in artwork JSON
- Implement AI rubber-banding that scales AI top speed based on gap to player
- Configure engine classes with varying rubber-band strength (Cruiser most forgiving, Turbo least)
- Balance racer stats: boost Kona top speed, reduce heavy racer accel/handling
- Update verification script to validate new rubber-banding configuration
2026-07-17 23:45:46 -06:00
Brian Fertig a0316bf467 feat: add mini-turbo boost mechanic to drifting
- Track drift charge duration while sliding and payout a speed boost
  when the drift is released cleanly (not stalled or reversed)
- Boost strength scales with drift duration, capped at maximum charge
- Added configurable mini-turbo parameters (min/max ms, boost ms,
  boost multiplier range) to superkart-rules.json
- Increase drift visual rotation angle from 6° to 14° for more
  pronounced drift feedback
- Reset charge on respawn, spin, and new drift start
2026-07-17 22:04:43 -06:00
Brian Fertig 29d18c9c5f refactor: reduce kart rotation frames from 16 to 8 and add racer artwork
- Add new racer spritesheets (8 angles × 64×64) for all 9 racers
- Introduce KART_ROT_FRAMES constant as single source of truth for rotation frame count
- Update SuperKartMode7.angleFrame(), SuperKartGame frame math, and procedural fallback
  to derive from KART_ROT_FRAMES instead of magic numbers
- Update data/superkart-artwork.json with asset paths and 8-angle metadata
- Update sprites.md documentation to reflect 8-view-angle contract
2026-07-17 21:38:18 -06:00
Brian Fertig aabf8aa9f3 fix: remove unnecessary Y-flip when sampling Mode7 texture
The texture2D call was flipping the UV Y coordinate (1.0 - uv.y)
before sampling, which is no longer needed. Simplify to use UV
coordinates directly.
2026-07-17 16:22:57 -06:00
Brian Fertig 81145d7891 Add custom background artwork to Super Kart menu screens
- Add superkart-background.png image asset
- Replace solid-color rectangle background with artwork in menu views
- Add semi-transparent shade overlay for better contrast
- Remove hardcoded title and tagline text (now baked into the image)
2026-07-17 15:09:01 -06:00
Brian Fertig ebed6292cf Merge branch 'super-kart' 2026-07-17 14:26:05 -06:00
Brian Fertig 08d09beeaa Update civilization units and game icons assets
- Update civilization-units sprite sheet and source file
- Update game icons sprite sheet and source file
2026-07-17 14:25:52 -06:00
Brian Fertig 5380a8eab4 feat: add Super Kart — SNES-style Mode 7 kart racing game
Complete kart racing game featuring 12 procedurally generated tracks
across 3 cups, 9 unique racers with distinct stats, headless physics
simulation, and a secret track editor (?superkart-editor=1).

Core features:
- Mode 7 ground renderer with parallax horizon backdrops
- 12 hand-tuned tracks (speedway, beach, swamp, scrapyard, volcano, nightcity)
- 9-racer roster with balanced archetypes (all-rounder, drift pirate, etc.)
- Headless race simulation for deterministic AI and headless verification
- Item system (bolt, seeker, oil, turbo, overdrive, emp, coins)
- Position-weighted item roulette and rubber-banding
- AI opponents with skill-based driving and stuck-recovery
- Full track editor with live preview, validation, and export
- 275 verification checks covering schema, physics, AI soak, and determinism

Data files: data/superkart-racers.json, superkart-rules.json, superkart-artwork.json
Game data: assets/gamedata/superkart/ (cups.json + 12 track files)
Tools: genSuperKartTracks.js, verifySuperKart.js
2026-07-17 14:25:18 -06:00
Brian Fertig d6d3bafc7f feat(civilization): add battle sound effects for unit combat
Add audio feedback for combat events by introducing unit-specific sound
effects that play during attack animations. Each unit in civilization-rules.json
now has a battleSound property mapping to appropriate audio assets. Adds 10
new MP3 files (arrows, cannon, catapult, gunfire-classic/modern, helicopter,
missile, submarine, sword, tank) and integrates playback in CivilizationMapView's
combat lunge animation.
2026-07-17 13:03:26 -06:00
Brian Fertig 8b5aa6064a Updates to research display 2026-07-17 11:46:27 -06:00
Brian Fertig 02b14b88c8 chore: reduce minimum trade route distance from 8 to 6 tiles
Lower the minimum distance requirement for establishing trade routes
from 8 to 6 tiles, making caravan routes more accessible. Also refactors
the log message in CivilizationGame to use the TRADE_ROUTE_MIN_DIST
constant instead of a hardcoded value.
2026-07-17 11:11:59 -06:00
Brian Fertig b214f6b8bd feat(civ): add shield waste mechanic and AI corruption triage
- Implement "waste" as corruption's production sibling: distant cities lose
  shields to waste (half the corruption decay rate), halved by courthouses.
- Update city yields, UI summaries, and government screen to display waste
  alongside corruption and support costs.
- AI now builds courthouses early when combined corruption + waste loss
  exceeds 4 per turn, preventing distant cities from becoming useless.
- Refresh building effect tooltips and palace description to reflect waste.
2026-07-17 11:05:01 -06:00
Brian Fertig aee3352efe feat(civ): add diplomacy chat, government screen, and gameplay improvements
- Introduce CivilizationChat.js with OPENERS, PLAYER_LINES, and REPLIES pools
  for dynamic diplomacy dialogue between leaders and player.
- Add chat log panel to diplomacy screen with typing animation, scrolling,
  and persistent chat history stored in state.
- All diplomatic actions (treaties, war, gifts, tech exchange) now generate
  contextual chat messages.
- Add GOVT button and openGovernmentScreen() with empire wellbeing summary,
  government cards showing pros/cons, and revolution mechanic.
- Allow disbanding units with warning about troops aboard transports.
- Improve combat capture: land units can capture undefended cities after
  winning battle; sea/air units cannot.
- Enhance unit stack tooltips with home city display, ship cargo summary,
  grouped friendly stacks, and enemy effective defense info.
- Preserve portrait emotion animations by reusing when switching leaders.
2026-07-17 10:32:01 -06:00
Brian Fertig bace0356c2 feat: add bulk disembark for transport units
- Add disembark action to transport unit action menu when carrying units
- Highlight valid landing tiles adjacent to boats (clear of enemies)
- Unload all passengers onto a single chosen tile at once
- Implement targeting mode with cancel support (Escape or clicking away)
- Extract unitsOnBoat and disembarkTiles logic functions
- Add green diamond tile highlights in view layer
2026-07-16 23:22:55 -06:00
Brian Fertig a91db38a0f feat(civilization): balance difficulty combat, enhance UI tooltips, and improve setup flow
- Introduce difficulty-based combat multipliers and veteran promotion chances (Chieftain/Warlord eased, Prince+ neutral)
- Randomize leader selection on setup screen and add dynamic portrait with pick speech
- Replace inline hover text with a centralized Tooltip component for tech tree, foreign cities, and buildings
- Add descriptive flavor text for governments and terrain improvements
- Add building completion notifications with a "VIEW CITY" action button
- Expand deferred city attack cinematics to cover explored rival cities
- Improve Tempest flipper AI to scale lane-flipping chance/cooldown with level and enable climbing flips
- Add verification tests for difficulty combat modifiers and veteran rates
2026-07-16 23:22:29 -06:00
Brian Fertig 0f2fc829c8 feat: add Tempest arcade game and Civilization tooltips
- Add Tempest (Atari 1981 vector arcade clone) with full simulation logic,
  Phaser rendering scene, vector font, and headless verification suite
- Register Tempest in games registry, main scene list, and game room dispatch
- Add reusable Tooltip UI component for hover-based information display
- Add Civilization unit/building tooltips in city screen and map hover
  (CivilizationTooltips.js with flag and effect descriptions)
- Update Civilization click handling to distinguish hover-only from real
  click targets via hoverOnly data flag
- Update civilization-units and game-icons assets
2026-07-16 20:05:00 -06:00
Brian Fertig 2a08df9cd8 refactor starcontrol weapons and improve road visibility
- Rewrite Kohr-Ah guidedBlades: one-shot-per-press with blades that fly
  straight while held, then slow and become homing mines near enemies;
  blades persist indefinitely and cap at 8 live (oldest recycled)
- Add bladeFireHeld tracking and canFire/tick hooks for blade cooldown
- Update AI to tap fire for Kohr-Ah blades instead of holding
- Reduce PLANET_GRAVITY from 1.6e6 to 1.1e6 for better slingshot physics
- Add dark outline pass under road/rail lines in Civilization map for
  better visibility against light terrain
2026-07-16 14:44:52 -06:00
Brian Fertig 237a024f80 feat(civ): add status log panel, event announcements, smooth camera pan, and city sprites
- Add bottom-right status log panel with scrollable entries, word wrap,
  mask clipping, and mouse wheel scrolling; cap at 60 entries
- Replace toast popups with announceStatus() for major events (war, tech,
  first contact, city founded, trade routes, huts) — centered modal with
  CONTINUE button that animates into the log; supports queued popups and
  custom onDismiss callbacks (e.g. first contact opens diplomacy)
- Add smooth panToTile() tween for camera movement when selecting next unit,
  refactored clampPan into panBounds() reused by both clamp and tween
- Add classic city sprite sheet (civilization-cities-classic.png) and
  register it in artwork JSON and asset manifest
- Replace circular civ rings and selection ring with isometric ellipses
  matching the 2:1 tile ratio for better depth reading
- Paint tile neighbors in ascending c+r order during repaintTileAndNeighbors
  to prevent tall features from being overwritten by lower-sum neighbors
- Stop panTween on pointer down to avoid conflict with manual dragging
2026-07-16 13:48:39 -06:00
Brian Fertig b4155b096a feat(civ): add status log panel, event announcements, smooth camera pan, and city sprites
- Add bottom-right status log panel with scrollable entries, word wrap,
  mask clipping, and mouse wheel scrolling; cap at 60 entries
- Replace toast popups with announceStatus() for major events (war, tech,
  first contact, city founded, trade routes, huts) — centered modal with
  CONTINUE button that animates into the log; supports queued popups and
  custom onDismiss callbacks (e.g. first contact opens diplomacy)
- Add smooth panToTile() tween for camera movement when selecting next unit,
  refactored clampPan into panBounds() reused by both clamp and tween
- Add classic city sprite sheet (civilization-cities-classic.png) and
  register it in artwork JSON and asset manifest
- Replace circular civ rings and selection ring with isometric ellipses
  matching the 2:1 tile ratio for better depth reading
- Paint tile neighbors in ascending c+r order during repaintTileAndNeighbors
  to prevent tall features from being overwritten by lower-sum neighbors
- Stop panTween on pointer down to avoid conflict with manual dragging
2026-07-16 12:36:53 -06:00
Brian Fertig def5c9904a feat(civ): add per-leader starting techs, union with trait techs, and setup background
Allow each opponent to declare their own 2-3 starting technologies in
opponents.json, independent of their civ trait. During game creation,
personal and trait-based starting techs are unioned (deduped) so
pioneering leaders with overlapping lists don't double-grant.

- Add optional setup screen background image (civilization-setup-bg)
- Update leader detail panel description to list personal starting techs
- Deduplicate trait + personal techs via Set in CivilizationLogic
- Add validation for startingTechs arrays, tech existence, 2-3 total count,
  and variety across leaders in verifyCivilization
- Add integration tests for personal tech granting and overlap deduplication
2026-07-16 10:31:25 -06:00
Brian Fertig 80d4a79593 feat(civ): add leader trait system with bonuses, starting techs, and UI
Introduce civTraits data structure with 8 traits (scientific, industrious,
commercial, philosophical, zealous, mercantile, pioneering, wealthy) that
provide science/gold/shield multipliers, starting gold, and starting
technologies. Assign each opponent a trait in opponents.json.

- Apply trait bonuses to starting gold and grant starting techs during
  game creation in CivilizationLogic
- Route trait multipliers into cityYields for science, gold, and production
- Add a leader detail panel to the setup screen showing name, trait name,
  and description, updated live when selecting leaders
- Add validation for civTraits in CivilizationRules (multipliers positive,
  starting techs valid, etc.)
- Add verification tests for trait application and city yield multipliers
- Nudge unit sprite position 5px down for better tile alignment
2026-07-16 10:31:02 -06:00
Brian Fertig 543f751fe2 fix: cap city shields at build cost to prevent overflow display
When a city cannot complete a build (e.g., size < 2 for settlers),
shields were accumulating past the build cost, showing confusing
values like "60/40 shields" or negative turn counts.

- Cap shieldBox at buildCost each turn in processCity
- Clamp displayed shields to min(shieldBox, cost) in city screen
- Add tests verifying shield capping and stalled build completion
2026-07-16 10:18:11 -06:00
Brian Fertig 4d864503f2 fix: cap city shields at build cost to prevent overflow display
When a city cannot complete a build (e.g., size < 2 for settlers),
shields were accumulating past the build cost, showing confusing
values like "60/40 shields" or negative turn counts.

- Cap shieldBox at buildCost each turn in processCity
- Clamp displayed shields to min(shieldBox, cost) in city screen
- Add tests verifying shield capping and stalled build completion
2026-07-15 23:36:53 -06:00
Brian Fertig 325692fa35 feat(civ): animate combat events with attacker/defender ghosts and victory advance
- Capture attacker/defender snapshot (id, civ, type, start position) in
  combat events so the UI can reconstruct them after resolution
- Add `animateCombat()` that plays sequential lunge/retreat animations for
  each combat, death flash/shrink for the loser, and optional victory glide
  for unopposed winners stepping onto the cleared tile
- Add `animateUnitsAlong()` to glide AI civ units between before/after
  snapshots, enabling the same "resolve now, animate after" pattern for
  AI turns
- Track unit containers in `unitContainers` map for lookup by unitId
- When player unit encounters combat mid-path, animate the peaceful leg
  first then play the clash
- Add `collectNewCombatEvents()` to pick up and mark consumed combat events
- Add `isTileVisible()` helper for filtering AI combat to visible tiles
- Update tests to verify advance-after-kill and combat event shape
2026-07-15 23:26:29 -06:00
Brian Fertig e4ad09de67 feat(civilization): sprite units, animated movement, city naming, mouse zoom
- Add civilization-units.png sprite sheet (64×96 frames with 32px headroom)
- Animate unit movement along paths with smooth gliding after resolving logic
- Add city founding name prompt modal with TextInput and Enter/Escape support
- Support zoom-to-mouse-position via wheel, with extended zoom levels
- Flash-pulse End Turn button when no units have remaining movement
- Fix banner rendering with setSize instead of direct width assignment
- Adjust badge positions for taller sprite frames
- Decouple city name preview (peekCityName) from cursor consumption
2026-07-15 22:41:02 -06:00
Brian Fertig 1261f7149b feat(civilization): enable terrain sheet and adjust HUD button layout
- Set terrainSheet path to actual image file in artwork configuration
- Update civilization-terrain.png sprite sheet
- Reposition top-right HUD buttons 100px left for better spacing
2026-07-15 20:03:37 -06:00
Brian Fertig 9f7bac9787 feat: add garrison system and improve city interaction flow
- Hide player's fortified units inside cities on the map to reduce clutter
- Add garrison strip in city screen to view/unfortify garrisoned units
- Add "move or inspect" dialog when selecting a city with a movable unit
- Refactor moveTo into reusable method for cleaner click handling
- Make confirmDialog accept custom button labels
- Add civilization-terrain.png sprite sheet for terrain rendering
2026-07-15 19:41:18 -06:00