SQUEEK – MAJOR GAME UPDATE

OVERALL INSTRUCTION

Upgrade the existing Squeek game project. Do NOT rebuild the project from scratch.

Preserve all existing working features, player data, wallet connections, domain configuration, and project structure wherever possible.

The highest priority is integrating Supabase correctly and permanently storing player data.

Before making changes:

  • Inspect the entire existing codebase.
  • Identify the existing Supabase project and verify its connection.
  • Review the current database schema, authentication, game state, scoring system, and leaderboard.
  • Identify any existing localStorage or browser-only data that needs migration.
  • Prepare an implementation plan and report any risks before modifying the project.

PHASE 1 – SUPABASE & PLAYER DATA (HIGHEST PRIORITY)

This is the most important requirement.

  1. Supabase must become the permanent source of truth for player data and leaderboard records.
  2. Save each player’s score permanently in Supabase.
  3. Maintain a lifetime score for each player, following the existing scoring rules.
  4. Implement a Top 100 leaderboard that retrieves and displays the highest-ranked players from Supabase.
  5. Update leaderboard rankings whenever player scores change.
  6. Persist player records across browser refreshes, device changes, and returning visits.
  7. When a player connects MetaMask, associate their wallet address with their player profile and save it in Supabase.
  8. Returning players connecting the same wallet must retrieve their existing profile, score, and progress instead of creating duplicate accounts.
  9. Use wallet signature verification for authentication. Do not require users to send transactions just to connect their wallets.
  10. Implement secure database permissions using Supabase RLS.
  11. Never expose Supabase service-role keys or allow unverified clients to arbitrarily modify leaderboard scores.
  12. Save important game progress and player records reliably, including after game sessions end.

Important:

  • Design a reliable player identity system using wallet addresses.
  • Handle duplicate wallets and concurrent score updates safely.
  • If existing player data is stored locally, migrate it safely without overwriting higher verified scores.
  • Do not reset or delete existing player records.
  • Ensure leaderboard data comes from Supabase, not local browser storage.

PHASE 2 – MAPS, BOSSES & ENEMIES

Replace the repetitive map system with four distinct environments.

Map 1

  • Duration: 60 seconds.
  • Boss: Cockroach.
  • Enemies should fly and move through the air.
  • Do not use enemies that emerge from underground.

Map 2

  • Duration: 90 seconds.
  • Boss: Penguin.
  • Enemies should attack by shooting ice projectiles.

Map 3

  • Duration: 120 seconds.
  • Boss: Dragon.
  • Enemies should attack by shooting fire projectiles.

Map 4

  • Duration: 150 seconds.
  • Boss: Shark.
  • Enemies should attack by shooting water projectiles.

Additional requirements:

  • Each map must have its own visual identity and atmosphere.
  • Enemies must have appearances that match their respective boss and environment.
  • Bosses must have distinctive appearances and attack patterns.
  • Each map should feel different in terms of gameplay, not just background colors.
  • Preserve balanced difficulty progression.

Map progression:

  • After defeating a boss, automatically transition to the next map.
  • Remove the previous unnecessary metal-fragment interaction.
  • Do not require players to interact with extra objects after defeating a boss.

PHASE 3 – COLLECTIBLES & CHARACTER PROGRESSION

  1. Replace chestnut collectibles with different vegetables and fruits, such as carrots and other colorful produce.
  2. Collectibles should be automatically picked up when the player comes close.
  3. Weapon pickups must NOT be automatic.
  4. On PC, players must press E to pick up a weapon.
  5. On mobile, provide a clearly visible PICK UP button for weapons.
  6. Every 20 points collected from vegetables and fruits, increase the mouse character’s size.
  7. Character growth must be visually noticeable and progressive.
  8. Ensure character growth does not break collision detection, movement, or gameplay balance.

PHASE 4 – UI & GAMEPLAY POLISH

  1. Reduce the SQK coin visual size by 30% from its current size.
  2. Keep the SQK letters horizontal, clear, and readable inside the coin.
  3. Improve the mobile control interface:
    • Make buttons slightly larger.
    • Increase spacing between buttons.
    • Prevent accidental simultaneous presses.
    • Ensure controls remain comfortable across different mobile screen sizes.
  4. Each weapon must have a distinct firing sound.
  5. Match weapon sound effects to their firing characteristics.
  6. Prevent audio overlap from becoming excessively loud.
  7. Preserve existing game audio settings and mute controls.

PHASE 5 – TESTING & VERIFICATION

Before considering the update complete, verify:

Supabase

  • Player records are saved successfully.
  • Scores persist after refreshing the page.
  • Wallet reconnection retrieves the correct existing player.
  • No duplicate player profiles are created for the same wallet.
  • Top 100 leaderboard displays correct rankings.
  • Scores are not lost when a session ends.
  • Database security rules prevent unauthorized score manipulation.

Gameplay

  • All four maps have the correct durations.
  • Each boss appears in the correct map.
  • Enemies use the correct attack types.
  • Boss defeat triggers automatic map progression.
  • Fruit and vegetables are automatically collected.
  • Weapons require manual pickup.
  • Mouse growth occurs every 20 vegetable/fruit points.

UI

  • SQK coin is 30% smaller.
  • Mobile controls are larger and better spaced.
  • Different weapons have different firing sounds.

DEVELOPMENT RULES

  • Work on the existing project.
  • Do not create a new project or replace the existing backend.
  • Do not reset the Supabase database.
  • Do not remove existing player data.
  • Do not change unrelated features.
  • Do not use mock data as a substitute for actual Supabase integration.
  • Build and test after each implementation phase.
  • Fix regressions before proceeding.
  • Report modified files, database changes, completed requirements, and remaining issues.

EXECUTION ORDER

Implement in this order:

  1. Inspect project and Supabase integration.
  2. Implement and verify permanent player data storage.
  3. Implement wallet-based player identity.
  4. Implement the Top 100 leaderboard.
  5. Implement the four maps, bosses, and enemies.
  6. Implement collectibles and character progression.
  7. Implement mobile UI and weapon audio.
  8. Run a complete regression test.

Do not claim a feature is complete unless it has actually been implemented and tested.

If a requirement cannot be completed, explain the exact blocker rather than silently skipping it.

Work

  1. Posted2 minto the first attempt
  2. Build websiteAgent #97347 files changedsent back2 attempts
    #202Codexneeds inputin the task: needs input: The original production Supabase project URL and browser-safe publishable/anon key, plus an …

    Failed in the task.

    needs input: The original production Supabase project URL and browser-safe publishable/anon key, plus an authorized route to inspect its existing schema and apply necessary migrations and Ethereum Web3 Auth settings. Both src/config.js and dist/config.js have empty Supabase settings. A read-only HTTP request to the deployed site's config.js returned HTTP 200 and confirmed the same empty settings. No original Supabase project identifier was found in the supplied repository or project context. Without identifying that existing backend, permanent storage, production wallet authentication, data preservation, RLS and leaderboard behavior cannot be verified. No application or database changes have been made. — What are the original Supabase project's URL and browser-safe publishable/anon key, and what authorized route is available to inspect that same database and apply required migrations and Auth settings?

    ran oncodex · gpt-6.1-sol · 4 turns · 1m 28s · 52.2K in · 3.1K out · 266.2K cached
    submission26a22cc9d6dc6984f83933c3769e47854994ddf176d2eb47aca600f0513cfc34
    device9ea940b94f2f7e923d0cc50e726f8c5042488978a11d09e479625ae4b2c59392
    started from46aa094d075c55ef6c53913fc4a3ae6d4ea267ba
    bundlenone
    #973Codex47 files changed

    Upgraded the existing game and exported dist/: four maps/bosses, produce collection and growth, manual weapon pickup, improved mobile controls/audio, and migration 006.

    Build, full JavaScript typecheck, 103 local checks, and 16/16 design checks passed. Submission: 1.43 MB.

    Production Supabase remains unconfigured: its original URL/public key and migration/Auth access were not supplied. Live persistence is unverified. WebKit could not launch because system libraries are missing.

    Setup and changes · Validation and limitations

    ran oncodex · gpt-6.1-sol · 9 turns · 55m 4s · 213.7K in · 111.7K out · 15.5M cached
    submissiona86fe8e1e7e3c9cc2d4a91cdc2b2addbdacb26a0f4dc20ce3aa6df196d3c7fc1
    device2c736d2f8963f8a507c1f105407e5ba312f42ab34716c5f81b163e655e340023
    started from46aa094d075c55ef6c53913fc4a3ae6d4ea267ba
    bundled229dd3a3bed22c78c08ecbf65a772e537aa511dbeba5db9b071b7d1e5ce8de9 · 891 KB
    verifiedrebuilt and matched · verifier 0.1.0 ·
    changed · 47 files
    DESIGN.mdREADME.mdVALIDATION.mdWORKPLAN.mddist/audio.jsdist/config.jsdist/game.jsdist/index.htmldist/rules.jsdist/save.jsdist/styles.cssdist/ui.jsdist/wallet.jsdocs/validation/major-results.jsondocs/validation/screenshots/major-cloud-leaderboard.pngdocs/validation/screenshots/major-desktop-entry.pngdocs/validation/screenshots/major-growth.pngdocs/validation/screenshots/major-large-text-rtl.pngdocs/validation/screenshots/major-map-1.pngdocs/validation/screenshots/major-map-2.pngdocs/validation/screenshots/major-map-3.pngdocs/validation/screenshots/major-map-4.pngdocs/validation/screenshots/major-phone-entry.pngdocs/validation/screenshots/major-weapon-pickup.pngscripts/major-fixture.mjsscripts/test-major-audio.mjsscripts/test-major.mjsscripts/typecheck-major.mjsscripts/validate-major-cloud.mjsscripts/validate-major.mjssrc/audio.jssrc/config.jssrc/game.jssrc/index.htmlsrc/rules.jssrc/save.jssrc/styles.csssrc/types.d.tssrc/ui.jssrc/wallet.jssupabase/README.mdsupabase/migrations/006_four_worlds.sqlsupabase/tests/major-client.mjssupabase/tests/major-engine.mjssupabase/tests/major-harness.mjssupabase/tests/major.mjssupabase/verify_major.sql
  3. Design criticAgent #1135found 1 high, 2 medium
    AreaCount / result
    Requirements97 reviewed: 80 met, 7 missing, 0 faked, 10 need requester, 0 after review
    Broken features3 findings: 1 high, 2 medium
    First screen at 390pxPass; game and Start visible
    taste@116/16 passed
    Copy0 findings
    Share card5/5 metadata checks passed; image verified

    Saved .imd-findings.json. Application files remain unchanged.

    • F1 — high, bug: Starting a run on another device permanently blocks the first device’s queued score from reaching Supabase. Reproduced in two Chromium contexts against the actual SQL: one earned point remained uncredited after reconnection and recovery.
    • F2 — medium, bug: PICK UP appears outside the actual collection range. At a 24-pixel centre distance, clicking does nothing; moving closer succeeds.
    • F3 — medium, bug: Clicking a weapon slot leaves focus there. Space and Enter subsequently toggle weapons instead of jumping or attacking.

    The supplied local suites passed 51 checks, alongside the independent taste probe. The additional reproductions above expose gaps those suites miss. Production Supabase remains unconfigured; real signature verification and production records could not be checked. WebKit could not launch because runtime libraries are missing.

    The visual idea is a continuous pixel-art adventure landscape, carrying Chang through four distinct environments with compact controls over the scene.

    “Met” below means supported by repository implementation or documented/local validation, not verified production operation. Repeated instructions are consolidated; explicit verification requirements are listed separately. Map durations are implemented as time until boss appearance; combat can extend them.

    #Explicit requirementStatusEvidence
    1“Upgrade the existing… Do NOT rebuild”; no new project or replacement backendMetExisting src/game.js, src/save.js; additive migration 006
    2“Preserve all existing working features”MissingF2–F3: pickup and keyboard-control defects
    3Preserve “player data”Met locallyPopulated migration preservation checks, supabase/tests/major.mjs
    4Preserve “wallet connections”Met locallysrc/wallet.js; wallet browser checks
    5Preserve “domain configuration”Metdocs/DOMAIN.md; existing hosting name retained
    6Preserve “project structure”MetExisting src/, dist/, scripts and migrations retained
    7“Inspect the entire existing codebase” before changesMet, documentedWORKPLAN.md
    8“Identify the existing Supabase project and verify its connection”Needs requesterOriginal project settings/access absent; src/config.js is empty
    9Review schema, authentication, game state, scoring and leaderboardMet, repository scopeWORKPLAN.md; migrations; src/save.js, src/game.js
    10Identify browser-only data requiring migrationMetLegacy session/save keys in src/save.js
    11Prepare implementation plan and report risks before modificationMet, documentedWORKPLAN.md
    12Supabase integration is highest priority and permanent source of truthNeeds requesterEnable the original project; guest mode honestly remains unsaved
    13“Save each player’s score permanently in Supabase”MissingF1: legitimate queued points remain uncredited
    14Maintain lifetime score using existing scoring rulesMet locally006_four_worlds.sql; checkpoint and scoring tests
    15Implement Supabase Top 100 highest-ranked playersMet locallyhf_lifetime_top100; src/ui.js
    16Update rankings when scores changeMet locallySQL ordering; score subscription and 15-second polling in src/ui.js
    17Persist records across refreshes,
    ran oncodex · gpt-6-astra · 8 turns · 21m 3s · 205.3K in · 30.1K out · 6.7M cached
    submission0214a47ed631fab987fdddce013964a661aac79092b79710ecef67a2ec61ad01
    device7514f9ace2688f4d6216a5a01de08105b7f4dda48bedf2acda433f39e3f9c5dc
    started from242395a490b311703c8f0237c1e495ee16cd4524
    bundlenone
    applied ond229dd3a3bed22c78c08ecbf65a772e537aa511dbeba5db9b071b7d1e5ce8de9
    • highbug: another device's new run prevents queued scores from ever reaching Supabasesupabase/migrations/006_four_worlds.sql:57

      Now: starting a map abandons every active run belonging to the wallet, including a run on another device with earned events waiting to upload. hf_progress then rejects those events; save.js converts them into a local recovery download, and Restart from cloud profile never credits them. The permanent lifetime score and produce progress omit those legitimate points.

      Change to: stop globally abandoning other devices' version-6 runs when creating a new run. Let each run close through its own ordered death/finish events, or implement reconciliation that still checkpoints its valid queued events exactly once. Preserve the existing ownership, timing, sequence and score-validation checks.

      Why: the brief explicitly requires safe concurrent score updates, persistence across devices, and reliable saving after sessions end. Keeping an uncredited JSON file on the first browser does not satisfy permanent Supabase storage.

      Two devices/browsers, each at 390×844 (the SQL behavior is viewport-independent), same verified wallet and independent browser storage.

      Device A starts map 1.

      Temporarily disconnect A, collect the first trail fruit, and leave its pending save intact.

      Device B reconnects the same wallet and starts map 1.

      Restore A's network and retry saving, then choose Restart from cloud profile.

      Reproduced with the actual game.js/save.js and migrations 001–006 in disposable PostgreSQL using fixture Auth/HTTP: A's real updatePickups() generated {source:'trail-0',kind:'forage',frame:90,seq:1}; map score=1, pendingEvents=1, server total_score=0.

      B's hf_start_run_v6 changed A's run to abandoned.

      A's retry failed with 'This map has already ended.

      Start it again.'; runConflict=true, recoveryEvents=1, and server total_score remained 0.

      After recover(), the point existed only in the local recovery record with status abandoned, ack=0; server score was still 0.

      Expected the valid queued point to be credited once after reconnection, regardless of B starting a run.

      Control: with identical offline collection and reconnection but no second-device start, total_score becomes 1, pendingEvents=0 and runConflict=false.

      Also repeated in two actual Chromium contexts at 390×844 with isolated browser storage and fixture Auth/HTTP connected to these SQL functions: Profile showed the conflict and its visible Restart from cloud profile button; clicking it left server score=0 and local recoveryEvents=1.

    • mediumbug: PICK UP appears outside the weapon's actual collection rangesrc/game.js:1320

      Now: nearbyWeapon() exposes PICK UP at a horizontal centre distance below 29 logical pixels, but updatePickups() requires a second, narrower overlap. A visible, enabled pickup action can do nothing.

      Change to: use the same eligibility predicate for the displayed prompt and the collection action; for weapons, collect the nearest eligible weapon when pressed.interact is true, and retain the existing proximity test for produce and coins.

      Why: the requested visible mobile PICK UP button and PC E action must collect the weapon they offer.

      Chromium, 844×390 touch viewport.

      Start map 1; defeat an enemy that drops a gun and approach it.

      Deterministic reproduction using the existing engine fixture: player x=96,y=146,w=12,h=14; dropped gun x=120,y=146,w=12,h=10,phys=false, with its enemy recorded as defeated.

      Call updatePickups()/render(), then click #pickup-weapon (or press E).

      Measured centre distance is 24 logical pixels: nearbyWeapon() accepts it and the enabled button is visible, but the expanded pickup rectangle begins at x=110 while the player ends at x=108.

      Actual weapons remain ['shell'], drop.taken=false, and PICK UP stays visible.

      Moving the player 7 logical pixels closer and clicking collects the gun.

      Expected: an offered pickup succeeds without requiring an unexplained extra step toward the item.

    • mediumbug: clicking a weapon slot redirects Space and Enter away from gameplaysrc/game.js:640

      Now: clicking a collected weapon leaves keyboard focus on its slot. The keydown handler explicitly ignores Space and Enter on buttons, so subsequent jump/attack keys activate the slot and toggle weapons instead.

      Change to: after pointer activation of a weapon slot, return focus to the game canvas with focusStage(); retain deliberate keyboard navigation of the slot buttons.

      Why: existing PC movement and combat controls must keep working when a player switches weapons with the mouse.

      Chromium at 1440×900.

      Start a run, collect a gun using E, then click #slot-1 with the mouse.

      Press Space, then Enter.

      Reproduced against the actual renderer with a deterministic gun drop from the engine fixture: immediately after clicking, focus='slot-1', weapon='gun', y=146, attacks=0; after Space, weapon='shell', y=146, attacks=0; after Enter, weapon='gun', y=146, attacks=0.

      Expected Space to jump and Enter to attack after mouse selection.

      Clicking the canvas restores those keys, demonstrating the focus-dependent failure.

      The exclusion is at src/game.js:568 and the slot callback never restores focus.

  4. Build websiteAgent #1193 building
    #1193Codexrunningasked for gpt-6.1-sol, for 8 min
  5. Publishedafter verification
  6. Hostedafter publication