
Icy tower
Prompt
# Game Specification: âTower Climberâ (Icy Towerâlike) â **Pure HTML5/JS, Serverless** > Goal: a faithful IcyâTowerâstyle vertical platformer for the web, implemented **entirely clientâside**. No servers, no databases, no thirdâparty backends. All persistence uses the browser (LocalStorage/IndexedDB). Features that normally need a backend are **redesigned** for a zeroâinfrastructure setup. --- ## 0) Feature checklist (what ships) * â Infinite tower, fixedâstep physics, combos, score, increasing autoâscroll. * â Keyboard controls (â â, Space). Identical feel across platforms via fixedâtimestep and fixedâpoint math. * â Pixelâart vibe with your own assets (no original IP). * â Sound effects and music loops (clientâside only). * â **Leaderboards (local)**: perâdevice high scores, perâday/weekly views, **export/import** JSON to share. * â **Replays (deterministic)**: record inputs + PRNG seed; export as file or share via URL hash (no server). * â **Ghost runs**: race against your own best replay or an imported replay file. * â **Achievements (local)**: \~20 unlocks stored locally; export/import with the same mechanism. * â **Skins/characters**: clientâside sprite sheets + JSON manifests; unlock rules stored locally. * â Optional PWA: offline install, caching of assets via service worker. > Out of scope by design: true global online leaderboards or cloud sync. These require a backend; we replace them with import/export and shareable replays. --- ## 1) Core loop (GDD) * Start at floor 0; climb by landing on higher platforms while camera scrolls upward. * Platform generation is procedural with guaranteed reachability; difficulty ramps with height. * Score = floors reached + combo bonuses. Lose if the camera overtakes the player from above or the player falls out of view. --- ## 2) Scoring and Combo System **Final Score:** ``` finalScore = 10 * highestFloorReached + ÎŁ( comboTotalFloors^2 ) ``` * A **multiâfloor jump** is a landing at least **2 floors above** the previous floor (Îfloor â„ 2). * A **combo** is a sequence of consecutive multiâfloor jumps without interruption. * A combo ends if you land with Îfloor < 2, the **combo timer** expires (\~3.0 s), or game over occurs. * A combo contributes to score only if it contains **â„ 2** multiâfloor jumps **and** ends cleanly (i.e., not directly by game over). * UI: a vertical combo meter on the left; refills on multiâfloor landings and decays linearly (tunable 2.5â3.5 s). --- ## 3) Physics & Controls (deterministic) ### 3.1 Simulation timing * **Fixed timestep**: 60 Hz (dt = 1/60 s). Rendering decoupled from simulation. * **Numeric model**: 32âbit **fixedâpoint Q16.16** for all core physics state (positions/velocities) to keep behavior identical across browsers. * **PRNG**: seedable (PCG32 or XorShift128+). The seed is stored in replays for deterministic regeneration. ### 3.2 Units & collisions * World units are pixels; reference resolution **480 Ă 720**. Scale the canvas, not the simulation. * Platforms are oneâway (pass from below, collide from above) with AABB tests. * Platform thickness: **12 px**. ### 3.3 Tunable constants (initial values) * Gravity `g = 2500 px/sÂČ` * Horizontal accel ground/air `ax_ground = 2400`, `ax_air = 1600` * Max horizontal speed `vx_max = 520` * Ground friction (no input) `friction = 3000` * Base jump velocity `vy_jump_base = 900` (up is negative in equations) * Runâup bonus `vy_run_bonus = 420 * clamp(|vx|/vx_max, 0..1)` * Early release (jumpâcut): if jump released while rising â `vy = vy * 0.55` * Coyote time `t_coyote = 80 ms` and input buffer `t_buffer = 100 ms` * Wall bump: on side collision `vx *= -0.88` with a brief stick (\~8 ms) for sharp turns ### 3.4 Controls * **â/â** apply horizontal acceleration (air control is weaker). * **Space** jumps; uses coyote time + input buffer for fairness; holding space allows higher jump unless cut early. --- ## 4) Camera & Autoâscroll * Camera follows with a deadâzone (\~30% of screen height from the bottom). * Autoâscroll speed increases with height: `s(y) = s0 + stepGain * floors/Î`. Start `s0 â 140 px/s`, add \~+10 px/s every \~25 floors. * Antiâcamp: slight speed bump (+5â10%) after \~1.5 s of idling. * Game over if the cameraâs top crosses >8 px above the playerâs head. --- ## 5) Procedural Platforms (guaranteed reachability) **Parameters** * Initial width `w0 = 360 px` with jitter ±20 px; min/max width `w_min = 64 px`, `w_max = 400 px`. * Vertical gap increases with floor: `gap = lerp(72, 132, clamp(floor/500,0..1))` + noise ±8 px. * Horizontal offset per step: uniform in `[-180, +180]` clamped to walls (16 px margins). * Theme swap every 100 floors (visual only). **Algorithm (sketch)** 1. Set candidate `C` at next y using `gap(floor+1)`. 2. Sample width `w` by difficulty ramp and x with jitter. 3. **Reachability test** using worstâcase runâup and jump; if unreachable, reâroll up to K tries. 4. Fallback: insert an easier intermediate platform. --- ## 6) Deterministic Replays (serverless) * **Record**: `{ version, seed, settingsSubset, inputEvents[], startFloor }`, where `inputEvents` are timeâstamped press/release for â, â, Space. * **Storage**: compact binary (deltaâtimes + bitmasks) then Base64 for sharing, or plain JSON for readability. * **Playback**: reâsimulate with the same fixedâstep and PRNG seed. * **Share**: encode replay to Base64 and place it in the **URL hash** (e.g., `#r=<b64>`), or export as a `.tcr` file. Import parses and plays without any network calls. * **Checksum**: optional rolling CRC/XOR every N ticks for quick integrity checks across imports. --- ## 7) Clientâside Persistence * **Local leaderboards**: keep top N (e.g., 50) scores overall + daily/weekly views (computed clientâside by date keys). Stored in LocalStorage/IndexedDB. * **Achievements**: boolean flags + progress counters in LocalStorage. * **Settings/skins**: store selected skin id, audio volumes, accessibility toggles. * **Import/Export**: one consolidated JSON blob (scores, achievements, skins, settings, replays). Users can share or back up this file manually. --- ## 8) Achievements (examples) 1. First Steps â reach floor 25 2. Heights â 100 3. Skyline â 250 4. Stratosphere â 500 5. Warmâup â first valid combo 6. Acrobat â combo â„ 12 total floors 7. Combo King â combo â„ 25 total floors 8. Speedrunner â 100 floors in †45 s 9. Ice Dancer â 5 multiâfloor jumps without touching a wall 10. Wall Wizard â 5 quick wallâturns in one run 11. No Chill â never let the combo meter empty after first activation for â„ 30 s 12. High Roller â score â„ 100,000 13. Perfectionist â no offâscreen falls for 3 min 14. Collector â unlock 5 skins 15. Daily Climber â top 10 **local** daily board 16. Comeback â recover from bottom 15% of the screen to a safe zone 17. Marathon â play 10 minutes in one run 18. OneâTake â no pause from start to game over 19. Tactician â 3 valid combos in a row 20. Artist â use a custom skin --- ## 9) UI/HUD * Left: combo meter (timer) + numeric âcombo total floorsâ. * Top: score, current floor, autoâscroll speed. * Right (optional dev overlay): FPS and simulation tick timing. * Menus: pause, settings, skin picker, replay browser (load/play/export/delete).
A system prompt was added to support web rendering