Physics 1:1
Nostalgia lives in the feel of the controls. The physics is rewritten in the same arithmetic and matches the original bit for bit.
Game · Telegram Mini App
The moto-trial from push-button phones — now in Telegram.
A remake of the 2004 J2ME game Gravity Defied as a Telegram Mini App. The original physics is rewritten from scratch and matches it bit for bit, the 30 classic tracks are kept untouched, and the server re-runs every record from its replay.

01 / The idea
Gravity Defied is a 2004 Codebrew Software game for push-button phones: a white screen, a green “3D” ribbon of track, a tiny rider and a timer in the corner. The idea: open the bot and be riding a second later, with the bike behaving exactly as it did then.
Nostalgia lives in the feel of the controls. The physics is rewritten in the same arithmetic and matches the original bit for bit.
The 30 original tracks stay forever and unchanged — a tribute. New chapters only ever appear alongside them.
The physics is deterministic: the server re-runs every submitted ride and checks the time down to the step.
The original code served as a reference: the logic is rewritten in TypeScript from scratch, with clear names and no allocations in the physics step.
Multiplication and division reproduce the original’s 64-bit arithmetic on plain JavaScript numbers. A test checks them against a reference on 200,000 value pairs — 0 mismatches.
The golden trace comes from the original physics, built separately only for the comparison. 16 scenarios, up to 1540 steps, with crashes and a breakdown: the coordinates of all 6 bodies match to the bit on every step.
1 physics unit is 4 pixels, on a 176–320 px screen. Smooth mode anti-aliases and interpolates; pixel mode draws lines pixel by pixel and scales up without smoothing.
Each step records a mask of 4 keys, and repeats are compressed. Time is counted in steps of 20 game ms, so it does not depend on the frame rate. Ghosts are the same replays.
The check is built from the same source as the game. A run counts only if the finish lands exactly on the last step and the time matches.
It searches over inputs for a run that reaches the finish. 530 solutions prove that every track can be finished on every bike it allows; a test re-runs all of them.
Stack TypeScript · Vite · Canvas 2D · Telegram Mini Apps · Supabase (Edge Function, PostgreSQL, RLS, pg_cron) · Vitest · Vercel
10 new training tracks, the 30 original tracks in the Easy, Medium and Pro groups, and 100 tracks from fan mods made in 2007–2012: 28 authors, 10 chapters, each track credited with its author and year.
The original constants. On the classic tracks bikes unlock as in the original — by finishing groups; records are kept separately for each bike.
Medals are awarded by time. A track counts its best medal across the bikes; the maximum is 420 stars. Plus 33 achievements.
One of the 30 original tracks and a bike, the same for everyone: the choice is computed from the day number. The day’s top 3 earn a reward; for now it is only a record on the server.
Overall standings by stars, the top 50 of every track, “Race the leader” against the leader’s ghost, and a challenge to a friend via a link to your run.
Menu, track of the day, profile, top and reminders. In the morning the bot announces the new track of the day to those who allowed it.
04 / Screens
The frames were captured on 21 October 2026 from the live version in a regular browser, outside Telegram, so they show no leaderboard places. The game’s interface is in Russian. The run on “Intro” is a solver-bot solution from the repository, typed in key by key, step by step. Any screenshot opens full size. Swipe sideways
Business analysis artefacts reconstructed from the repository’s code and documentation (last commit: 28 September 2026). Steps and numbers are checked against the files; paths are in the captions and the “As text” blocks.
5.1 · Process in lanes
The lanes run top to bottom: client, server, database, the client again and a separate leaderboard request. The time is never taken on trust: the server receives only the step-by-step input and re-runs the ride with the same physics.
The diagram is simplified: resending after a lost connection, uploading records at sign-in and the message to a challenger are described in “As text”.
Source: src/game/session.ts:71–115 · src/main.ts:278–325 · src/server/core.ts:44–77 · server/gd-api/index.ts:149–222, 273–288 · server/gd-api/verify.js:25
Paths are relative to the gravity_nostalgy repository root.
submit: the track, the bike, the replay and the signed initData. Without a connection the run is queued and sent later. src/main.ts:178–190, 306–325 · src/platform/api.ts:105–113initData signature (HMAC-SHA256 with the bot token, at most a day old) and creates or updates the player. Without a signature submit is refused with 401. server/gd-api/index.ts:149–175, 452–457 · server/gd-api/verify.js:25verifyRun re-runs the ride with physics from the same source (core.js is built from src/) and counts it only if the finish lands exactly on the last input step and the time matches. src/server/core.ts:44–77gd_record stores the time and the replay — the source of the “ghosts” later on. If it is the track and bike of the day, the same goes into gd_daily_run. server/gd-api/index.ts:192–216, 273–288overall request: the SQL function gd_overall sums the stars (gold 3, silver 2, bronze 1 per track; the best medal across the bikes). Ties go to more original tracks, then to a lower total time. The medal thresholds are passed in from the game code. server/gd-api/index.ts:69–71 · src/game/levels/campaign.ts:304–311 · docs/SERVER.mdgd_finalize_daily gives the top 3 of each past day a record in gd_reward with the status earned; it is called lazily, at most once a minute. server/gd-api/index.ts:296–302 · docs/SERVER.md5.2 · Decision log
Six decisions that the project memo says must not be revisited without the owner. The wording is shortened; the reasons come from the same documents.
Nostalgia rests on the feel of the controls: a player will notice a different bike at once.
Bit-exact original physicsFixed-point 16.16 and the original order of operations; any physics change must pass the comparison test.
That very bike — plus determinism: the same input gives the same time on any device, so the server can re-check any record.
The name, sprites and 30 original tracks belong to Codebrew Software.
The classics stay forever and unchangedNew chapters only alongside them. Nothing is sold on the classic tracks; monetisation and prizes only on the project’s own tracks.
A tribute to the classics — and the project’s main legal risk: the rights stand even if the game has not been sold for years.
The design doc listed five leaderboard schemes: per track, stars, a weekly cup, a chat leaderboard, tournaments.
World standings by starsThe chat leaderboard is removed. Gold is 3 stars, silver 2, bronze 1; a track counts its best medal across the bikes.
Stars fold all tracks and bikes into one number. Per-track tables remain; the server remembers which chat a game was launched from, but the game does not show it.
The bot needs a channel to bring players back.
The bot talks only in private chatMenu, track of the day, profile, top and reminders; the bot does not work in groups.
The bot can write first only to those who pressed /start or allowed it in the game. The morning track-of-the-day message goes only to them, at most once a day.
The day’s top 3 earn a reward — what should it turn into?
No own token and no play-to-earnRewards accumulate as a server record with the status “earned”; exchange is “later”, for now it is only a record.
Hamster Kombat, Notcoin, Catizen and Blum saw their tokens fall 75–95% and their audiences 85–95% after the airdrop. Status and cosmetics are safer, legally too.
Stars once diverged: “I have 18, the leaderboard says 5” — the medal thresholds in the game and on the server differed.
Add new things seamlesslyPlayers’ progress, records and stars do not change. Changes to physics, tracks or medals ship only with a server core rebuilt from the same source.
The game and the leaderboard count stars by the same thresholds, and old records stay valid.
Source: CLAUDE.md, “Owner decisions” 1–6 and “Server deployment” · docs/GDD.md §1, §2, §9 · docs/GROWTH.md §0 · docs/SERVER.md
5.3 · Research
Before the growth plan the project gathered open data on Telegram mini-games and the genre. These are market benchmarks from other people’s sources, not results of Gravity Nostalgy.
What went into the plan: no “energy” or attempt limits, no own token; paid promotion only after D1 ≥ 20% and D7 ≥ 8%. D1 and D7 retention is already computed by the SQL function gd_stats; there are no player numbers on this page.
Source: docs/GROWTH.md §0–2 and §6, with the list of sources at the end of the file; docs/SERVER.md (gd_stats)
Based on the repository’s code and documentation (last commit: 28 September 2026); tests run on 21 October 2026: 584 of 584 passing. The diagram is simplified; the full version is in the “As text” block.
The classic tracks are open in a regular browser — no Telegram needed.
Play in the browser Open in Telegram