Commit Graph

165 Commits

Author SHA1 Message Date
Brian Fertig 01372c1c62
Rebuild Azul as a full tile workshop scene with procedural art, AI, and tests
- Split the monolithic scene into focused modules: layout, art baking, HUD, dialogs, end screen, sound, tile identity tracking, and a verification harness
- Replace the 1-ply greedy AI with an incremental valuation that scores placement points, bonus progress, floor liability, end-timing, denial, exposure, and optional rollouts across a 5-level skill ladder; add free-wall column picking
- Add the free (grey) wall variant end-to-end: per-row/per-column colour constraints, legal-column queries, dump-to-floor when no cell fits, player column choices during scoring, and AI support
- Track all 100 tiles as persistent sprites with stable ids so they slide between bag, plates, centre, lines, walls, floor, and lid instead of being recreated each render
- Bake the Lisbon workshop (azulejo wainscot, oak bench, glazed tiles, plates, tray, bag, lid, panels) into canvas textures with optional colour-blind glyphs; add Web Audio ceramic SFX
- Add quality-of-life UI: hover/keyboard move preview with points and floor cost, drag-to-place, undo until the next player moves, tile tracker, bonus badges, opponent board zoom popover, tooltips, order book, pause/settings, and a detailed end screen with per-round chart
- Extend rules logic with stats, round summaries, placement runs, bonus status, previewMove, tile census, and richer log entries; update sprite and tutorial docs
- Add tools/verifyAzul.js to check rules, preview accuracy, all-AI soak games, the skill ladder, tile-id stability, and screen layout
2026-11-25 01:47:25 -07:00
Brian Fertig 8ef312ef45
Overhaul Catan and Ticket to Ride with procedural art tables, shared 3D dice, skill-scaled AI, end screens, and headless verification tools
- Catan: bake the wooden table, sea frame, caddy, tray, opponent boards and end screen from code; add piece-supply limits, official bank-shortage rule, per-game stats, AI trade reasons, and a felt dice tray using shared 3D dice
- Ticket to Ride: render an antique parchment map with score track, desk pad HUD, dialogs, sound synth, and scoring ceremony; rewrite the AI as a 1–5 skill ladder with network planning and turn-weighted routing; add forced-pass/stall guard, route lock reasons, per-player stats, and face-up market replacement
- Extract the 3D dice cube math and renderer into src/ui/dice/Dice3D.js so Craps and Catan share one implementation
- Add tools/verifyCatan.js and tools/verifyTicketToRide.js for headless rules, soak, AI ladder, dice, and layout checks
- Enable skill selection for Ticket to Ride in the opponent select screen; make MusicPlayer controls positionable for the map corner
2026-11-25 01:09:43 -07:00
Brian Fertig c193d0a4ca
Overhaul Old Maid with card-table kit, AI tells/shuffles, and verification
- Rewrite the game scene on the shared CardTableScene: candlelit Victorian parlour art, oval table, fan hands, drag-to-reorder, dock/pause/rules/scorepad modals, animated deal and pair reveals
- Add shuffle mechanic (applyShuffle) so players can hide the Old Maid's position; AI tracks posKnown and forgets it on shuffles
- Introduce skill-based tells (hopeful/worried) and wantsShuffle bluffing for opponents; lower-skill AIs are honest, high-skill ones mostly bluff
- Allow 1 opponent (minOpponents 1) so Old Maid works as a 2-player game; expose skill selector in OpponentSelectScene
- Track discarded pairs in state and add countCards helper for conservation checks
- Add tools/verifyOldMaid.js covering rules, AI memory/tells, layout collision checks for 2/3/4 players, and an all-AI soak
- Tune Go Fish verification threshold after the no-repeat-target rule change
2026-11-24 21:56:59 -07:00
Brian Fertig 5e7d4bb172
Migrate Go Fish and Hearts to the shared card-table kit
- Rewrite both games on CardTableScene with new table layout (GoFishTable.js,
  HeartsTable.js) and baked room art (GoFishArt.js, HeartsArt.js)
- Add skill-scaled AI for both: Go Fish gains recall/random-ask memory and a
  no-re-ask rule per turn; Hearts tracks voids, the Queen, and moon shots
- Support Go Fish pairs mode, book tracking, and heads-up (minOpponents 1)
- Extend Hearts rules with configurable target score and add/subtract moon modes
- Add headless verification suites (tools/verifyGoFish.js, tools/verifyHearts.js)
  covering rules, AI legality, layout collisions, and all-AI soaks
- Enable skill selection for both games in OpponentSelectScene
2026-11-24 21:53:55 -07:00
Brian Fertig e09986d53f
Rework Uno and Skip-Bo on the shared card-table scene with skill-scaled AIs
- Add `src/ui/cardtable/` kit (CardTableScene base class, TableGeometry,
  TableArt, AITiming) so both games share perspective layout, card sprites,
  ghost hands, plates and opponent pacing.
- Rewrite Uno: official rules plus optional stacking and draw-until-playable,
  UNO! call/catch, Wild +4 bluff/challenge odds, scoring to a target with
  match play, and a 90s-kitchen table with baked card art (UnoArt/UnoTable).
- Rewrite Skip-Bo: skill-scaled AI with stock-chain search and opponent-aware
  discards, match scoring to 500, dining-room table with vintage card art
  (SkipBoArt/SkipBoTable).
- Allow Uno to be played against a single opponent (minOpponents 1).
- Expose the skill slider for uno and skipbo in OpponentSelectScene.
- Add headless `tools/verifyUno.js` and `tools/verifySkipBo.js` covering
  rules, AI legality/skill ordering, layout bounds and all-AI soaks.
2026-11-24 20:57:02 -07:00
Brian Fertig a1bf2bf783
Redesign Phase 10 with a rec-room table, skill-scaled AI, and full tooling
- New perspective card-table layout (Phase10Table.js) and baked art module
  (Phase10Art.js): wood-paneled room, chrome-rim vinyl top, placemats,
  ghost hands, glow/spotlight effects, per-player-count backgrounds.
- Phase10Game rewritten around persistent card sprites with pose-based tweens:
  deal animation, staged laydowns on mats, hit/discard fly-ins, skip slams,
  turn spotlight, plate ladders, dock prompts, sort controls, tooltips, and
  keyboard shortcuts.
- AI (Phase10AI.js) now takes a 1-5 skill level: timing scales with hand
  speed and table pace, lower skills miss laydowns/hits, feed opponents,
  and skip randomly; higher skills avoid feeding phases and target real
  threats. Added adviseHand() for live coaching marks.
- Logic (Phase10Logic.js): orderGroupCards normalizes run position so hits
  work after out-of-order laydowns; skipTargets/applyDiscard enforce valid
  skip targets; takes log tracks discard pick-ups to break card loops.
- PhaseSpec gains groupStatus, laidGroupLabel, groupGoalLabel, cardName for
  live staging coaching and plate labels.
- OpponentSelectScene: enable the skill picker for phase10.
- tools/verifyPhase10.js: headless test suite covering rules, staging
  helpers, AI legality/timing, layout collision checks for 2/3/4 players,
  and an all-AI soak with win-rate assertions.
- NertsArt: export ensureGhostHand so Phase 10 shares the baked ghost-hand
  texture.
2026-11-24 19:08:34 -07:00
Brian Fertig 523b946721
Rework Nerts as a real-time table with paced AI and full visual scene
- Replace the timer-based AI with a perception model (read/notice/pounce/chain/scan) so opponents pace like humans, pounce on awaited cards, and skip pointless work-pile shuffles; add ghost-hand reach/carry timing and a "too slow" race loss
- Add NertsTable.js (Phaser-free projection/layout for 2–4 players, hit-testing, drop snapping) and NertsArt.js (baked table felt/rim/placemats/foundation zone, score pad, ghost hand)
- Rewrite NertsGame.js around persistent card sprites that tween to their state positions: deal animation, countdown, drag with live legal-target highlights, smart click/hotkey plays, idle hints, stall detection with stock rotation/auto-resign, pause/settings modals, count-back scoring and a paper score pad
- Support draw-count setting (1 or 3), opponent pace, and stock rotation/reshuffle in NertsLogic.js; add live foundation counts and completion checks
- Add tools/verifyNerts.js headless suite covering rules, layout bounds/clearance for all player counts, AI pacing invariants, and a multi-round AI soak with card conservation and score checks
2026-11-24 11:08:52 -07:00
Brian Fertig 2d1a673b7e
Rework roulette into a full 3D table with both wheel variants
- Add European single-zero and American double-zero wheels with La Partage
  and the full set of inside bets (splits, corners, streets, trios, basket)
- Rebuild the scene around a perspective-projected felt: baked table art,
  3D wheel bowl/head/ball, chip stacks on the layout, and a dealer's rail
- Plan each spin physically (track, diamond strikes, fret hops) so the ball
  lands on the pre-chosen number instead of a tween to a fixed angle
- Add AI personalities (grinder, sprinkler, martingale, chaser, sections),
  late bets, and per-player memory for the Martingale progression
- Introduce table limits, call bets/racetrack with neighbour stepper, history
  board, wheel cam, speed/felt/table toggles, and tooltips with house edges
- Extract geometry and rules into Phaser-free modules and add a headless
  verification suite covering payouts, hit-testing, AI, and the ball planner
2026-11-24 09:59:28 -07:00
Brian Fertig 7a3205799b
Overhaul craps with full table art, 3D dice, expanded bets, and AI
- Add perspective-projected craps tub: baked felt layout, padded rail, diamond-pyramid walls, house bank, dice bowl, ON/OFF puck (CrapsArt.js)
- True 3D die rendering and physics-lite throw that relabels the cube to match the rolled face (CrapsDice.js)
- Table geometry module with zones, seats, bet lanes, hit-testing shared by art and input (CrapsTable.js)
- Expand rules: Buy/Lay/Big/Hardways and all one-roll props; 3-4-5× odds caps, barred 12s, called-on working, contract bets, come-bet travel, plain-English payout explanations (CrapsLogic.js)
- Rewrite the scene: shared casino dock, per-seat chip stacks in the rail, felt click-through hit-testing, learner hints, roll-history board, results card, speed/felt settings (CrapsGame.js)
- AI profiles gain hardway/prop/lay appetite and injectable RNG for deterministic verification (CrapsAI.js)
- Add headless verifier: 36-combo resolution tables, exact Markov house edges, chip-conservation AI soak, geometry and dice-throw checks (tools/verifyCraps.js)
2026-11-24 09:18:11 -07:00
Brian Fertig d33ab09ae0
Redesign Hold'em table with casino oval art and proper betting rules
- New baked table art (HoldemArt.js) on a shared perspective kit
  (CasinoGeometry.makeProjection), plus layout solver in HoldemTable.js
  that fits cards, stacks, bets and buttons around the felt without overlap
- Correct min-raise tracking via lastRaiseSize; pot odds now include
  current street's bets
- All-in runouts: when nobody can act, deal the board out with live
  equity pills instead of stalling on a single actor
- Side-pot logic fixed so players who bust in the hand still claim their
  share; action skips all-in seats
- New HoldemShowdown.js helpers (bestFive, equity, hand labels, raise
  presets, finishing places) and headless test suite tools/verifyHoldem.js
- Rebuilt UI: casino dock with pre-action toggles, bet slider + pot-size
  presets, tournament panel, TV-style showdown with card glow, busted
  watch/skip flow, and cash-out confirmation on leave
2026-11-23 22:46:40 -07:00
Brian Fertig a103c9ed74
Refactor casino tables to shared perspective geometry and art kit
- Extract table layout into Phaser-free *Table.js modules so headless verify scripts can test projection, hit-testing, payouts, and scoreboard roads
- Add shared casino art pipeline (CasinoArt/CasinoCards/CasinoChips/CasinoDock) that bakes felt, rail, cards, chips, and HUD dock from one perspective model
- Replace per-game hand-drawn tables, betting UI, and chip rendering in Baccarat, Blackjack, and Pai Gow with the shared kit plus game-specific markings
- Add keyboard shortcuts, rebet controls, and a Baccarat bead plate/big road scoreboard
- Extend verifyBaccarat/verifyBlackjack/verifyPaiGowPoker with layout, overlap, and source-lint checks
2026-11-23 20:10:11 -07:00
Brian Fertig d0d412cea9 Add Geometry Wars arcade shooter with warp grid and neon bloom
- Headless sim (GeometryWarsLogic) with evolved and pacifism modes,
  seeded RNG for deterministic replays, and a fixed-tick accumulator loop
- Spring-lattice warp grid that reacts to bullets, explosions and black holes
- Additive neon bloom post pipeline plus a particle field for streaks/rings
- Vector font, title screen with mode cards, HUD, pause and game-over panels
- Register the game in the registry, scene dispatch, soundtrack and assets
- tools/verifyGeometryWars.js: headless checks incl. a bot soak across seeds
2026-10-04 19:56:07 -06:00
Brian Fertig 03d35b0b00 Overhaul boss encounters into distinct escalating profiles per level
- Replace flat kind/secondaryKind model with named BOSS_PROFILES that each carry their own move list, speed multiplier, and attack cooldown, so later fights are harder along every axis at once.
- Add six new attack patterns (ring, spread, spiral, aimed, wall, reinforce) dispatched via round-robin; bosses under half health can swap to a harder phase2Moves set.
- Surface the boss name in the WARNING banner and extend its display time.
- Extend verifyDefender.js with check 10: asserts HP/cooldown monotonicity, valid move names, dual-phase presence, and live-simulates each level's boss to confirm declared move ordering and phase-2 takeover.
2026-09-06 15:54:20 -06:00
Brian Fertig 79fb74d9b2 Add Defender arcade game with wireframe rendering and headless verificat
- Implement full Defender gameplay: boids swarmers, walkers, abductors, boss fights, humanoid rescue/escape state machine, combo multiplier, and overdrive timescale across 5 levels
- Render all entities as procedural Graphics strokes (glow-stroke pair) with a toroidal wraparound world, per-level accent palettes, CRT overlay, and a custom vector font for banners/title
- Register the game in the registry, scene dispatch, asset manifest, and soundtrack overrides so it appears alongside other arcade titles
- Add tools/verifyDefender.js covering wrap math, seam-adjacent boids, every rescue transition, overdrive thresholds, entity leak bounds, boss/level tally, spiral-of-death guard, determinism, and a Monte-Carlo bot soak
2026-09-06 15:14:42 -06:00
Brian Fertig 52eaff8b96 Add word-steered board generation and level-scaled special tiles to Book
- Introduce BookworkSteering with context-aware letter placement: class
  steering, vowel-band control, and a real-word completion boost so boards
  stay playable and avoid dead/vowel-clumped states across refills.
- Make gold/diamond spawn chances configurable per level via a linear ramp
  (specialTiles in bookwork.json), wiring the values through clearAndRefill
  and refillSteered instead of hard-coded constants.
- Add verifyBookwormBoard harness comparing baseline vs steered boards on
  word availability, dead-board rate, and simulated session survival, and
  extend verifyBookwork with special-tile schedule checks.
2026-09-01 23:09:12 -06:00
Brian Fertig 44de2fb049 Rename Bookwork to Bookworm and add dictionary-steered grid generation
- Update display name in registry, scene title, README, and tooling references
- Load ENABLE word list at runtime; fall back to unsteered random on failure
- Introduce makeSteeredGrid/refillSteering helpers for class/vowel-aware letter placement
- Export LETTER_WEIGHTS from BookworkLogic for reuse by the steering module
- Add `steer` tuning block (wordBoostK, classThreshold/damp/boost, vowelBand) to bookwork.json
2026-09-01 22:57:07 -06:00
Brian Fertig 97adfa642d Fix win-screen counter guard and add Playwright browser smoke test
- piecesBig counter guard used .parent (always undefined on container
  children in this Phaser build — they get .parentContainer), so the
  'PIECES' count-up never rendered; drop the dead guard.
- buttonHit() had the same .parent assumption; use .parentContainer.
- Add tools/smokeJigsaw.mjs: headless-Chromium smoke test driving
  menu -> play -> win showcase (camera settle, counter, confetti,
  frame/shine) -> Play Again -> Menu -> play again, asserting zero JS
  errors. Verified pass in browser.
2026-08-31 08:26:32 -06:00
Brian Fertig a7ebb67413 Extend jigsaw initial-image test coverage
Test now also asserts the menu is back to its original shape (no random-start button), the initial preview and thumb name match the random pick, Start Puzzle begins exactly that image, and the original 🎲 Random button still randomises the menu preview.
2026-08-30 21:19:11 -06:00
Brian Fertig 25f5e05a96 Start the jigsaw puzzle picker on a random image
The menu always opened on the first artwork; now imageIndex is randomised right after loadArtwork(), so each visit to the picker shows a different initial puzzle. The existing Random/prev/next buttons are unchanged (previous random-start button reverted in 4f2d299). Test page + CDP driver verify 8 fresh page loads all land on a valid in-range image with its preview loaded, with variety across loads.
2026-08-30 21:14:37 -06:00
Brian Fertig 4f2d29942d Revert "Add one-click random start to the jigsaw menu"
This reverts commit 0740c12ffa.
2026-08-30 21:12:44 -06:00
Brian Fertig 0740c12ffa Add one-click random start to the jigsaw menu
New '🎲 Start Random' button picks a random picture (never the current one when there's a choice) and starts the puzzle immediately, keeping the selected difficulty. Menu panel grows 820→890 to fit it. Headless-chromium test page + CDP driver verify: button placement, 8/8 random starts reach playing state, image variety, single-image guard, and difficulty preservation.
2026-08-30 21:11:15 -06:00
Brian Fertig 85fc7c16bf Add piece joining, board locking, and site soundtrack to jigsaw game
- Introduce group-based table assembly: grid-adjacent pieces snap together on the table, drag as one rigid unit, and lock onto the board as a block
- Extract join/lock rules into pure `resolveDrop` in JigsawLogic.js with a headless verification suite (tools/verifyJigsaw.js) covering fit guarantee, joining, locking, and win counting
- Replace the flat top-bar buttons with a "Menu ▾" dropdown panel to free the top-right corner for the shared site music HUD
- Integrate MusicPlayer soundtrack via getGameSoundtrack() and pin it to the fixed HUD camera
2026-08-30 19:49:00 -06:00
Brian Fertig ce14631544 Expand Master of Vega tutorial to cover full gameplay loop
- Add ~25 new steps: nearby stars, pan/zoom lesson, star info, fleet movement, home star/system view, colony management (allocation, focus), end turn, and the full Empire menu tour (Research, Diplomacy, Leaders, Colonies)
- Introduce hotspotAction, starPick, advanceOn modes (starPick/fleetInFlight/external), and advanceAction fields in tutorial data schema with validation
- Add VegaStarMap.fitToWorldBounds and extend pickFitZoomIndex to support a narrowed viewport area so the reachable-stars frame avoids the docked panel
- Bypass openModal gating for System View, Colony View, and Empire screens by calling their open functions directly from VegaTutorial; wire onClose/onColonyOpen callbacks to advance()
- Add tutorialFreePan flag so pan/zoom work during the free-pan step while all other map interactions stay frozen
- Add multi-target resolution (nearbyStars returns an array), invisible-shape holes, and per-star click hotspots in the tutorial overlay
- Update verification script to allow buttonless modal steps that advance via external callbacks
2026-08-29 11:11:25 -06:00
Brian Fertig 4175da2e26 Add guided tutorial to Master of Vega
- New data-driven script (data/mastervega-tutorial.json) with intro modal and three callout steps over the fleet marker and side-panel ship rows/count controls.
- Split into Phaser-free VegaTutorialData.js (schema validation, interpolation, target-id registry) and Phaser VegaTutorial.js (darken overlay, accent rings, callouts, hotspot, skip confirm, state machine).
- Tutorial auto-opens on every brand-new game and is re-triggerable from the menu when the starting fleet is still in orbit; malformed JSON disables the feature with a warning instead of crashing.
- Add D.tutorial depth (just below detail) so an invited ship-detail window layers above the overlay, and expose VegaSidePanel.tutorialRegion() for screen-space panel regions.
- Register the tutorial asset in the manifest and add verifier section 12 covering schema, targets, voice clips, placeholders, and interpolation.
2026-08-28 22:27:04 -06:00
Brian Fertig 58902075e5 Add Tents sound effects and intro jingle
- Add dedicated place, remove, win, and puzzle-start intro audio assets
- Register the new cues in the asset manifest and SFX key map
- Replace generic UI sounds with Tents-specific cues for placement, removal, and win
- Play the intro jingle on startGame, ducking the soundtrack until it completes
- Update smoke tests to assert the new jingles and cues fire
2026-08-28 21:09:04 -06:00
Brian Fertig af6ea98528 Add Tents & Trees logic puzzle game
- Implement full Tents & Trees scene (TentsGame.js) with day-to-night
  sky transition, campfire/ember/firefly effects, hover hints, violation
  feedback, and a win panel
- Add pure board model (TentsLogic.js) with backtracking solver,
  unique-solution puzzle generation across four difficulties, toggle/
  diagnose/solved helpers — all unit-testable in Node
- Register the game in gamesRegistry, main scene list, and slug dispatch
- Update game-icons.png with a new icon frame for Tents & Trees
- Add tools/verifyTents.js (solver + play-state unit tests and generation
  soak) and tools/smokeTents.js (Phaser-stub smoke test driving the full
  select → play → solve → win → restart flow)
2026-08-27 20:51:26 -06:00
Brian Fertig 199bbc40fb Fix Gin Rummy stale-index drag bug and add Pipe Puzzle unhover regressio
- Resolve hand card index from the container at event time instead of
  capturing it when handlers are bound, preventing the "wrong card on
  second drag" bug after a reorder.
- Enable drag-to-arrange in both draw and discard phases; clicking a card
  during draw now shows guidance rather than discarding.
- Add discard-pile click target so a selected card can be discarded by
  clicking the pile, and extract shared `_setupPileClick` helper to reduce
  duplication.
- Add `tools/regressionPipePuzzleUnhover.cjs`, a Playwright regression
  test verifying that Phaser's `killTweensOf(target, 'prop')` no longer
  clobbers in-flight rotation tweens on pointerout/pointerover.
2026-08-26 22:38:46 -06:00
Brian Fertig a4efa5b68a Simplify pipe puzzle to pure spanning-tree boards
- Remove extra-edge generation and cross pieces; board is now a single random spanning tree (one unique route between every pair of cells, no loops)
- Update leak rendering to place droplets on exact open edges using DELTA/EDGE and render water/flash layers above tiles in the container
- Adjust mini preview tiles and difficulty config (drop `extra` param)
- Rework tutorial to explain tree structure, scattered dead ends, and branch-by-branch solving strategy
- Update verification tool: assert tree edge count, no 4-way cells, leaf distribution across rows, faucet row variety, and board randomness; replace cross-based fixture with a valid tree
2026-08-24 22:14:08 -06:00
Brian Fertig d27244ac60 Rework Pipe Puzzle to branching network with no-leak win condition
Replace the single Hamiltonian-path model with a spanning-tree + extra-edges
approach that produces boards full of T-pieces, crosses and dead ends. The
win condition is now simply "zero leaks" — every socket matched to a
neighbour that opens back — instead of requiring one continuous path from
faucet to drain.

Key changes:
- Logic: generate puzzles via randomized Kruskal spanning tree plus tunable
  extra edges per difficulty; add bitCount, countLeaks, and derived
  angleFor/canonical rotation table
- Art: new tile textures for stub (dead end), T-piece, and cross;
  tileKeyFor and angleFor now handle all five piece types
- Game: faucet and drain are fixed anchors (not rotatable); removed the
  CONNECTED counter in favour of a simpler LEAKS stat; updated difficulty
  tiers (6×6 through 10×10) with extra-edge counts; improved water
  rendering contrast
- Tests: rewrite verify script for the new generation model (spanning tree,
  connectivity, piece mix, no-leak solution); update smoke test to skip
  anchor tiles
- Tutorial: updated rules, board reading guide, and tips for the branching
  network variant
2026-08-24 21:04:27 -06:00
Brian Fertig 518818dc1b Add Pipe Puzzle game with Hamiltonian path generation and procedural tile art 2026-08-24 19:42:16 -06:00
Brian Fertig 0940cd7255 feat(wolfenstein): add fists viewmodel, weapon cycling, ammo drops, and campaign carry-over
- Add fists weapon viewmodel with idle/hit animation states (220ms hit pose)
- Implement mouse-wheel weapon cycling that skips unowned weapons
- Add 33% chance for killed guards to drop ammo-clip pickups at death location
- Introduce campaign carry-over system preserving weapons/ammo/health between missions
- Fix stale 'attack' state clearing when enemies lose sight of player
- Extend save/load serialization to persist nextPickupId counter
- Update level-e1m1 with pistol pickup at spawn point
- Add comprehensive test coverage for all new features in verifyWolfenstein.js
2026-08-22 19:07:37 -06:00
Brian Fertig 5d8f51ae49 Bunch of edits 2026-08-22 17:50:40 -06:00
Brian Fertig eab08eede3 Add multiple weapons, pooled ammo, and pickup system to Wolfenstein
- Add shotgun, machine gun, gatling gun, and plasma rifle weapons with
  distinct fire modes (semi-auto, auto, burst) and damage profiles
- Refactor ammo from per-weapon pools to shared pools keyed by ammo type
  (9mm, shells, plasma), allowing multiple weapons to share the same pool
- Add pickup system with 11 item types: 5 weapons, 4 ammo variants, and
  2 health packs, all with spritesheet frames for rendering
- Update level editor with dynamic pickup dropdown populated from rules.json
- Generalize weapon viewmodel rendering to support multiple weapon images
  with per-weapon bob/sway animation
- Add cosmetic pickup animations: vertical bobbing and orbiting sparkle
  effects drawn in screen space around each pickup billboard
- Bump save version to v3 to invalidate old saves with incompatible ammo
  structure
- Update keyboard bindings for weapon switching (keys 1-6)
- Add comprehensive test coverage for new weapons, burst fire mechanics,
  ammo pooling, and pickup behavior
- Rename weapon_gattling.png to weapon_gatling.png to fix spelling
2026-08-22 14:13:03 -06:00
Brian Fertig a5b37038d2 Add object props (solid obstacles) to Wolfenstein E1M1
Introduces a new "Object" entity type that blocks movement but not sight/bullets, distinct from walls and pickups:

- **Data**: New `objects` array in level JSON (`{x, y, frame}`), with `data/wolfenstein-objects.json` as the frame registry (Tall Bush, Gold Eagle)
- **Artwork**: New `objects.png` spritesheet registered in `wolfenstein-artwork.json`; placeholder texture via `paintObject()` in WolfensteinArt.js
- **Logic**: Objects stored in `state.objects`, with a derived `map.objectBlocked` Set checked only by movement collision (`isWallCell`) — raycaster/sight/bullets never read it, so objects are see-through and shoot-through by construction
- **View**: Rendered as billboard sprites in `_drawSprites` with ground-anchored positioning (bottom edge on floor) and asymptotic depth sorting that stays below the weapon viewmodel
- **Editor**: New "Object" tool category with dynamic dropdown; click open floor to place/remove (toggle), click wall is a no-op; teal square indicator on board
- **Validation**: `validateLevel` checks objects sit on open floor; save/load round-trips with graceful degradation for pre-existing saves
- **Tests**: Verifies object blocks player movement but bullets pass through
2026-08-22 12:29:55 -06:00
Brian Fertig aa685dc505 The user wants a git commit message based on the provided diff.
**Analysis of the Diff:**
1.  **Binary Files:** `walls.png` and `walls.psd` are updated. This suggests an asset update, likely related to the "wolfenstein" theme mentioned in the paths.
2.  **JavaScript File:** `tools/verifyWolfenstein.js` is modified.
    *   A new test case is added under `section('4. Enemy AI');`.
    *   The test verifies that an enemy (guard) alerts when hit by a projectile, specifically in a scenario where:
        *   Visual detection (LOS+FOV) is blocked/blind (guard facing away).
        *   "Heard gunfire" alert path is blocked (different room/door logic).
    *   The test sets up a specific level layout, forces a door open, fires a pistol, and checks if the enemy's state changes from 'idle' to something else (alerted) and health drops.
    *   It explicitly mentions fixing an issue with `stepDoors` auto-close countdown underflow by setting `timer`.

**Synthesis:**
The primary functional change is adding a test case to ensure that direct hits alert enemies even when other alert mechanisms (vision, sound through doors) fail. The asset changes are likely incidental or part of the same feature branch (Wolfenstein theme).

**Drafting the Commit Message:**
*   **Subject:** Add test for enemy alert on direct hit bypassing vision/sound checks
*   **Body:**
    *   Update Wolfenstein wall assets (PNG/PSD).
    *   Add verification test in `verifyWolfenstein.js` ensuring enemies alert when shot, even if they cannot see the player or hear gunfire through doors.
    *   Fix door timer initialization in the test to prevent auto-close interference during projectile flight.

**Refining for Conciseness:**
Subject: Add enemy hit-alert test and update Wolfenstein assets

Body:
- Update `walls.png` and `walls.psd`.
- Add a test case in `verifyWolfenstein.js` verifying that direct hits alert enemies unconditionally, independent of vision cone or room-based sound alerts.
- Ensure door state is correctly initialized in the test to prevent auto-close interference with projectile simulation.

Let's make it standard conventional commit style if possible, or just clear and descriptive.

**Final Polish:**
Subject: Add test for unconditional enemy alert on direct hit

Body:
Update Wolfenstein wall assets (`walls.png`, `walls.psd`).

Add a new test case in `verifyWolfenstein.js` to verify that enemies alert when directly hit by a projectile, even when visual detection (LOS/FOV) and sound-based alerts (through doors) are inactive. This ensures the direct-hit alert path works independently.

Also fixes door timer initialization in the test setup to prevent auto-close logic from interfering with the projectile simulation.

This looks good. I will provide just the message as requested.
2026-08-22 10:51:42 -06:00
Brian Fertig a6f6b647da Wolfenstein: Add semi-auto fire modes, ammo types, enemy stun, and editor facing picker
This refactors weapon/enemy combat systems to support per-weapon cooldowns,
fire modes (auto/semi), and data-driven damage rolls via ammo types. Guards
now use the pistol's stats for ranged attacks and can be stunned by non-lethal
hits. The level editor now includes a directional facing picker for newly placed
enemies and displays enemy orientation as arrows instead of dots.

Key changes:
- Logic: Replaced single weaponCooldownMs with per-weapon cooldowns map; added
  prevFireHeld for semi-auto trigger-edge detection; guards now reference real
  weapon definitions via rangedWeapon; projectiles carry ammoType and resolve
  damage at hit time using rollDamage(); non-lethal ranged hits apply stunMs to
  enemies, freezing their AI until it expires.
- Rules: Added ammoTypes array with damageMin/damageMax; weapons now specify
  fireMode and ammoType (projectiles) or damage (melee); enemy definitions
  include stunMs and reference weapon IDs instead of hardcoded projectile stats.
- Editor: Added FACING_DIRS constants and drawFacingPicker() overlay that lets
  users click N/S/E/W neighbor cells to set a just-placed enemy's facing;
  enemies now render as directional arrows showing their spawn orientation;
  pendingFacingEnemy state tracks the in-progress pick across tool switches,
  undo/redo, and level resets.
- View: Added GUARD_FRAME.stunned (frame 9) which takes visual priority over
  all other states when e.stunMs > 0, ensuring the flinch pose displays even if
  the enemy's internal state still reads 'attack' or 'chase'.
- Data: Expanded level-e1m1 to 19x21 grid with repositioned doors/enemies/exit;
  bumped SAVE_VERSION to 2 since player.cooldowns and prevFireHeld are new
  required fields absent from v1 saves.
- Tests: Added coverage for semi-auto trigger-edge behavior, stun application
  and duration, melee non-stun behavior, damage roll range bounds, and guard
  projectile ammo type/cooldown spacing; updated existing tests to use new
  cooldowns/ammoType fields and toggle fireHeld for repeated shots.
2026-08-22 09:39:09 -06:00
Brian Fertig 74f8d0c926 wolfenstein: alert room-mates on gunfire, fix guard side-sprite flip
Add computeRooms + alertEnemiesInPlayerRoom: a gunshot now alerts every
idle guard sharing the player's room regardless of range/LOS/cone. A
door cell is always treated as a room boundary for this purpose, even
when fully open — two rooms joined only by a doorway stay distinct
("gunfire carries through the room, not through doorways").

Fix _guardFacing side-walk/side-idle flip: was `rel > 0`, read
backwards in-game, now `rel < 0`.

Cover with three verifyWolfenstein cases: same-room alert fires,
behind-closed-door does not, through-open-door does not (door forced
slide=1 / wall zeroed to exercise the slide-independent path).
2026-08-21 20:31:39 -06:00
Brian Fertig 9b3dccf4b5 feat(wolfenstein): add enemy vision cone, patrol loop behavior, and weapon sprites
- Implement 90° field-of-view check for idle/patrolling guards (only alerts when player is within cone, in range, and has clear line of sight)
- Change patrol behavior: 0-1 waypoints ping-pong, 2+ waypoints form a one-way loop (home → nodes → home → ...)
- Reduce patrol speed to 50% of chase speed for natural movement
- Update editor to display loop closing line when 2+ patrol nodes exist
- Add new weapon sprite images (gattling, machinegun, plasma, rocket, shotgun)
- Extend map parser to support patrol route definitions via `opts.patrols`
- Add patrol routes to e1m1 (guard at 2.5,18.5) and e1m2 (guard at 9.5,8.5)
- Add comprehensive tests for vision cone (inside/outside edge cases) and patrol loop/ping-pong behavior
2026-08-21 20:23:02 -06:00
Brian Fertig 103bc235a7 Added Wolfenstein 2026-08-18 19:10:44 -06:00
Brian Fertig 625ced5649 TA AI Updates 2026-08-17 21:15:32 -06:00
Brian Fertig 73de46e0f1 Updated with new unit and better AI 2026-08-17 20:27:48 -06:00
Brian Fertig 347957bd84 TAL: smooth obstacle collision push + in-place building upgrades (upgradesFrom)
Movement & collision:
- stepSeparation (TALogic) replaces the hard "snap unit to nearest clear
  tile centre" correction with a circle-vs-blocked-tile push proportional
  to overlap, damped by separationStiffness — no more teleport-yank,
  corner-bouncing, or stalling in exact-width corridors (caught as an
  AI-vs-AI win-rate regression in testing).
- servicePathQueue now routes at a unit's exact required clearance instead
  of padding +1, so traffic spreads across all passable tiles rather than
  funneling into a few wide chokepoint corridors.
- TAArt's structure painter falls back to a generic spinning glyph for
  topperFrame buildings.

Upgrades (new rule: upgradesFrom):
- A building may be placed directly on top of a friendly building it
  names at the same tile/footprint, consuming it for a 50% refund of the
  replaced building's OWN cost (not a price discount) — implemented via
  TALogic.findUpgradeTarget and an army-aware canPlaceAt.
- New definitions: nuclearplant (upgrades energygen, frame 22) and
  advancedmassgen (upgrades massgen, frame 24).
- compileRules (TARules) validates upgradesFrom references and topperFrame;
  sprites.md documents the semantics.
- New map m06 "Annihilation" (medium, snowfields, Klaxon skill 5, seed
  90123 — pre-vetted from the original sweep for early-economy balance).

Tests (tools/verifyTotalAnnihilation.js):
- Section 4d: pathfinding routes around obstacles and a unit threads a
  corridor exactly its own width.
- Section 5b: obstacle push is a bounded per-tick nudge (not a
  teleport), settles clear without oscillation, a unit ordered past an
  obstacle arrives, and no stuck-give-up flagging.
- Upgrade suite: exact 50% refund credited in place, fresh-ground builds
  still work, enemy-owned and mismatched-type targets rejected, reverse
  nuclearplant/energygen pairing, and canPlaceAt without an army never
  grants upgrade placements.
2026-08-16 18:59:30 -06:00
Brian Fertig 3c7184564a totalannihilation: add building upgrades and spinning toppers
- New `upgradesFrom` rule: a building def (Nuclear Power Plant on the
  Energy Generator, Advanced Metal Generator on the Mass Generator) may
  be placed exactly on a friendly, finished building of the named type,
  consuming it for a 50% refund of its build cost instead of needing
  clear ground (TALogic findUpgradeTarget / consumeUpgrade / buildCommand)
- New `topperFrame`: a second sprite stacked on the finished structure
  that spins continuously (the Advanced Metal Generator's centrifuge,
  frame 26), hidden while under construction; TAArt sizes the sheet for
  it and paints a generic spinner-glyph fallback
- New rules: Nuclear Power Plant (frames 22-23) and Advanced Metal
  Generator (frames 24-26) in totalannihilation-rules.json
- TARules: validate topperFrame and upgradesFrom (real building with a
  cost); TAWorldView renders/spins the topper; verifyTotalAnnihilation
  checks topper frames fit and were painted
- Test section covering upgrade placement (ownership, type match, exact
  footprint, refund amount, army-less fallback) and sprites.md updated
  for frames 22-26
2026-08-16 15:35:31 -06:00
Brian Fertig 045327d38a feat(totalannihilation): add Megatank unit with multi-barrel weapons and rebalance combat
- Introduce Megatank: medium commander with Twin 150mm Cannon and Side Rocket Pods
- Implement multi-barrel weapon system (barrels + barrelSpacing) in TALogic and TARules
- Lower DEFENCE_MIN_SKILL from 4 to 3; make first Laser Tower proactive, not reactive
- Rebalance unit triangle: Tank now counters Rocket Tank; rockets weak vs vehicle armour
- Re-seed campaign missions m05 (67890) and m06 (80808) with updated maps and briefings
- Skirmish default theme uses rules default (tropics) instead of hardcoded grasslands
- Add intro video before main menu
- Update sprite docs and verification tests for new balance
2026-08-16 13:42:54 -06:00
Brian Fertig 09a62f12cc feat(mastervega): add morale bonus system and espionage restraint diplomacy
- Add morale bonus from buildings (e.g., Holo Simulator): flat +N% to total
  colony production, uniformly boosting construction, defense, industry,
  ecology, and research
- Add espionage restraint (offDrift): setting Intelligence to 'off' toward
  an empire with neutral-or-better opinion drifts their attitude upward by
  1/turn, giving a way to improve relations without gifting (gated on not
  being at war and their opinion of you being >= 0)
- Display morale bonus in colony view when applicable
- Reduce planetShotDamageMult from 10 to 6
- Add verification tests for both new mechanics
2026-08-16 08:12:16 -06:00
Brian Fertig 46a2979555 fix: starbases cannot attack alone; AI targets correct colony at contested stars
- Starbases no longer count toward attacker power in holdsOrbit(), invade(),
  resolveCombats(), pendingBattlesFor(), and prepareBattleAt(). A starbase
  never leaves its home system, so it must never alone enable orbital
  superiority or pick fights with neighbouring hostile colonies (Brian, 2026-08-15).

- VegaAI manageFleets 2a/2b now uses targetColonyAt() instead of colonyAt()
  to resolve the colony it is actually at war with. At multi-colony stars
  this fixes the bug where an idle fleet sitting on a hostile undefended
  colony would silently check a different (not-at-war) colony sharing the
  star and never bombard/invade (Brian, 2026-08-15).

- Add test suite 5f (starbases cannot attack alone) and 5g (AI bombard/invade
  at contested multi-colony stars).
2026-08-15 10:54:16 -06:00
Brian Fertig 033912bc73 feat: redesign planetary defense as ammo model with range gating
- defenseHp is now a pure per-battle ammo gauge (one full-strength
  shot per planetDefensePerShot points, remainder as fractional shot)
  instead of in-battle damage tracking; no longer written back after
  battle outcome
- Planet now has a real range limit (planetRange, 1200) — previously
  the only entity with no range check at all
- Per-shot damage scales with the defending empire's best known weapon
  tech (weaponAvgDmg) instead of a flat HP-proportion curve
- defenseHp is only wiped to 0 when the planet is actually DESTROYED,
  fixing the bug where a defeated planet could be re-attacked multiple
  times in one turn with full strength each time
- Added combat config: planetDefensePerShot (5), planetShotDamageMult (1)
- Added combatV2 config: planetRange (1200)
- Comprehensive tests for range gating, shot formula, ammo exhaustion,
  multi-battle-same-turn fix, and tech-scaled damage
2026-08-15 09:20:43 -06:00
Brian Fertig d920d8e476 feat(combat): freeze colony defense regen and defensive builds while under siege
Add siegeFreezesDefense mechanic (default true) that stops a colony's
passive defenseHp trickle and blocks defensive building completion at the
front of the build queue while a hostile warship fleet is present.

This fixes the recurring "Under Attack" notification loop reported by Brian
where defenseHp would regenerate each turn, re-arming the pendingBattlesFor
gate and triggering fresh popup notices for an already-beaten colony.

Also adds an AI dispatch throttle in manageFleets: idle fleets no longer
open redundant attack orders against colonies the empire already holds orbit
over with defenseHp beaten to 0. Excluded fleets fall through to rally logic
and naturally join the existing siege or find a fresh front.

New helpers: isDefensiveBuildingId, isHostileWarshipFleet, hasHostileWarshipFleet
— shared across processColony, pendingBattlesFor, and VegaAI to ensure a
single definition of "under active siege".

Includes tests (sections 5d, 5e) covering regen freeze, build queue freeze,
siegeFreezesDefense=false toggle, and AI throttle.
2026-08-15 08:00:40 -06:00
Brian Fertig 869f041b39 feat(master-vega): overhaul bombard/invasion UX, consequences, and battle logic
- **Visual Feedback**: Introduce VegaBombardScreen.js — a two-stage popup for
  bombard/invasion results featuring JIT-loaded videos (per planet type or
  invading species) and animated stat bars showing population, factory, and
  building losses.
- **Expanded Consequences**: Factory and building destruction now scale with
  the population kill ratio. On colony wipeout, weapon Mark gates planetary
  ruin/ruination (toxic/radiated/dead/asteroids) via a weighted probability table.
- **AI & Tactics**: Ursaal now queue troop transports alongside warships for
  invasion fleets. Added `bombardHoldFireChance` trait (0–1) to let species
  defer bombing when invasion troops are staged, preserving intact colonies
  without creating fortress-world stalemates.
- **Battle Logic Fixes**: Correct `prepareBattleAt` and `pendingBattlesFor` to
  properly handle stars with multiple colonies, ignore transport-only fleets,
  and suppress pending battles when planetary defenses are depleted.
- **UI/Reporting**: Wire player-initiated and AI-initiated attacks into the
  new popup queue. Add `bombard` and `invasionFailed` to notable turn report
  events with detailed outcome descriptions.
- **Testing & Tooling**: Add comprehensive verification tests for planet
  destruction distribution, building damage rates, hold-fire chances, and
  battle edge cases. Expose `window.game` for devtools debugging.
2026-08-14 23:17:31 -06:00
Brian Fertig 3bad628968 fix(mastervega): balance planetary defense and improve AI attack logic
- Replace flat planetDefenseBase (20) with proportional planetDefenseScale
  (0.06), so colony defense damage scales purely with current defenseHp.
  A near-depleted colony now barely scratches attackers, while a fully
  tech'd one still tops out ~110 damage — fixing "attacked with the
  strength of a much-better-defended planet" (Brian, 2026-08-14).

- Add AI war memory: track consecutive losses per enemy and escalate
  attackMultiplier up to 3x so repeated losing attacks stop dribbling
  small fleets. A win resets the streak. Prevents permanent phoney wars
  where both sides build to equal strength and nothing moves.

- Show "Under Attack" notice (one-button, no formation picker) when AI
  attacks the player, since formation choice is meaningless for defense.

- Add planetary beam fire SFX for combat view.

- Add event `seq` cursor for war memory to survive event list trimming.

- Full test coverage for planet damage formula and AI escalation behavior.
2026-08-14 14:24:22 -06:00