TinyTower.
1,000,000 bricks. One giant tower to space. Starts with one brick. Fight the storm.
This is a toy prototype. Your tower is local-only — stored only in this browser tab. It is NOT saved to the server and NOT shared with anyone yet. Refresh = gone (unless this tab autosaves). Shared state, accounts, and moderation are coming later. Don’t build anything you wouldn’t want to lose. And yes — the storm fights back on purpose. It wants the tower down.
1,000,000 bricks = one tower to space. Every brick deals 1 damage to the Storm. Every 30 bricks, and every 45 seconds, the Storm hits back — it knocks bricks off, cracks a floor, tries to topple the whole thing. Fight undoes its last attack, +10 bonus. Reinforce blocks for 60s.
One brick. Adorable. I will blow it over with one sneeze. Watch.
No attacks yet. The storm is pretending to be a breeze.
1 brick = 1 ft. Cracked bricks have a red dashed outline — add another brick on top to repair them, or hit Fight to undo the storm.
How it works (when it’s real)
Everyone builds the same tower. One brick at a time. You stack, the storm tries to knock it down, you fight it back. Cooldowns, accounts, and moderation will keep it from becoming chaos. For now, you’re building alone — practice against a very rude storm.
- Add a brick = 1 damage to the Storm
- Every 30 bricks + every 45s, the Storm attacks
- Fight undoes its last attack, Reinforce blocks for 60s
- Download .txt to keep your tower
Community — coming soon
Shared state is not connected yet.
🟢 0 builders stacking right now (fake — local toy)
🧱 Last brick: —
⚔️ Last fight: — (not saved)
📜 Rules: No hate, no NSFW, no ads.
⬇ Backend — TinyTower Backend — Template
Right now TinyTower is a tinker toy — bricks is a local array in this tab, stormAttack() knocks bricks off the array, totalEver is a local counter, history is 10 in-memory snapshots, and Refresh = gone (except local autosave). Disclaimer is the truth: local-only, not saved, not shared. This backend is the map to make it real: one shared tower, per-brick writes by height, storm attacks as server events, cooldowns, accounts, moderation. Proposed, not connected.
01 / Files to create
api/tinytower/brick.php POST /api/tinytower/brick api/tinytower/bricks.php GET /api/tinytower/bricks?since= api/tinytower/fight.php POST /api/tinytower/fight api/tinytower/snapshot.php GET /api/tinytower/snapshot api/tinytower/clear.php POST /api/tinytower/clear (mod only) sql/tinytower_tables.sql
Keep the tinyfiles PHP pattern: /api/bootstrap.php, json_in() / json_out(), prepared PDO.
02 / Database tables
-- sql/tinytower_tables.sql
tinytower_bricks
id BIGINT AUTO_INCREMENT PRIMARY KEY
height INT NOT NULL -- 0 .. 999,999, unique, defines order
kind VARCHAR(20) NOT NULL -- "red","glass","gold","stone","flower"
cracked TINYINT NOT NULL DEFAULT 0
user_id INT NOT NULL
created_at DATETIME NOT NULL
UNIQUE(height)
tinytower_attacks
id BIGINT AUTO_INCREMENT PRIMARY KEY
kind ENUM('knock','crack','topple','try_collapse') NOT NULL
amount INT NULL
detail VARCHAR(200) NULL
created_at DATETIME NOT NULL
tinytower_snapshot
id INT AUTO_INCREMENT PRIMARY KEY
path VARCHAR(200) NOT NULL
brick_count INT NOT NULL DEFAULT 0
created_at DATETIME NOT NULL
tinytower_cooldowns
user_id INT PRIMARY KEY
last_write_at DATETIME NOT NULL
bricks_last_minute INT NOT NULL DEFAULT 0Tower is 1,000,000 bricks. Never store a full tower per user — store only bricks by height, plus one snapshot. Same idea as TinyMap / TinyCity / TinyGarden, but bricks instead of pixels / tiles / seeds.
03 / API endpoints
POST /api/tinytower/brick
{ "bricks": [ { "height": 12, "kind": "red" } ] }
- auth required, 1-20 bricks per request
- validates height 0-999999, kind in allowed set
- cooldown: 1 write per 500ms, max 20 per request
- INSERT ... ON DUPLICATE KEY UPDATE kind, user_id
GET /api/tinytower/bricks?since=
- returns { "ok": true, "bricks": [ { height, kind, cracked } ] }
- since = last poll, max 200 per response
POST /api/tinytower/fight
{ "attack_id": 123 } — undoes that storm attack, +10 bonus
GET /api/tinytower/snapshot
- returns { "ok": true, "url": "/data/tinytower/snapshot.json", "brick_count": 1234 }
POST /api/tinytower/clear (mod only) — 403 unless modStorm attacks are server events — tinytower_attacks — not client random. Server decides knock / crack / topple / try_collapse on timer + every 30 bricks.
04 / Cooldown, moderation & validation
// Cooldown: 1 write per 500ms, 20 bricks per request, 1 fight per 5s // Moderation: no hate / NSFW / ads — mods can clear + ban user_id // Validation: height int 0-999999, kind in allowed set — else 400
Keep disclaimer until this ships: “Tinker toy — not live yet. Refresh = gone.”
05 / Frontend wiring
// bricks[] is already local. After adding (debounced 800ms): // POST /api/tinytower/brick with new bricks // Poll GET /api/tinytower/bricks?since= every 2s, apply only new bricks // On load: GET /api/tinytower/snapshot -> load into bricks[] // If API fails, fall back to local-only toy + disclaimer.
api/tinytower/ + sql/tinytower_tables.sql — no GitHub needed. Shared 1,000,000-brick tower, per-brick writes by height, storm as server events, cooldowns + moderation.