TinyBoss.
1,000,000 HP. One giant boss. Everyone fights him. He fights back.
This is a toy prototype. Your fight is local-only — stored only in this browser tab. It is NOT saved to the server and NOT shared with anyone yet. Refresh = boss heals to full (unless this tab autosaves). Shared boss HP, accounts, and moderation are coming later. Don’t spend anything you wouldn’t want to lose. And yes — the boss fights back on purpose. He wants to win.
1,000,000 HP = one very stubborn boss. Every hit deals damage. Every 30 hits, and every 45 seconds, the boss hits back — he heals, he shields, he spawns minions, he stuns you. Fight Back undoes his last move, +10 bonus damage. Defend blocks for 60s.
One million HP. Perfect. You have… a punch. I have minions, shields, and a healing potion the size of a bathtub.
No attacks yet. The boss is pretending to nap.
Tip: Minions soak your damage first — click a minion to punch it directly. If the boss shields, your next hits do less. If he stuns you, wait it out or hit Fight Back. When HP hits 0, he falls and Level 2 spawns, angrier.
How it works (when it’s real)
Everyone fights the same boss. One boss, 1,000,000 HP. You hit him, the boss hits back, you fight him back. Cooldowns, accounts, and anti-spam will keep it from becoming chaos. For now, you’re fighting alone — think of this as practice against a very rude boss.
- Hit to deal damage — Punch 1, Kick 5, Magic 20, Super 100
- Every 30 hits + every 45 seconds, the boss attacks
- Fight Back undoes its last move, Defend blocks for 60s
- Download .txt to keep your fight log
Community — coming soon
Shared state is not connected yet. This box is a placeholder for what’s next:
🟢 0 fighters in the arena right now (fake — local toy)
💥 Last hit: —
⚔️ Last fight: — (not saved)
📜 Rules: No bots, no hate, no ads. Mods will nuke it later.
⬇ Backend — TinyBoss Backend — Template
Right now TinyBoss is a tinker toy — bossHP is a local number in this tab, bossAttack() heals / shields / spawns a minion from local state, totalDamage is a local counter, history is 10 in-memory snapshots, and Refresh = boss heals to full (except local autosave). The disclaimer on this page is the truth: local-only, not saved, not shared. This backend is the map to make it real: one shared boss, per-hit writes, boss attacks as server events, cooldowns, accounts, and anti-bot. Proposed, not connected.
01 / Files to create
api/tinyboss/attack.php POST /api/tinyboss/attack api/tinyboss/boss.php GET /api/tinyboss/boss api/tinyboss/fight.php POST /api/tinyboss/fight api/tinyboss/snapshot.php GET /api/tinyboss/snapshot api/tinyboss/clear.php POST /api/tinyboss/clear (mod only) sql/tinyboss_tables.sql
Keep the tinyfiles PHP pattern: each endpoint loads /api/bootstrap.php, uses json_in() / json_out(), prepared PDO statements.
02 / Database tables
-- sql/tinyboss_tables.sql
tinyboss_state
-- one row — the shared boss. Never one row per user.
id INT PRIMARY KEY DEFAULT 1
level INT NOT NULL DEFAULT 1
name VARCHAR(80) NOT NULL DEFAULT 'GORP, Eater of Pixels'
hp BIGINT NOT NULL DEFAULT 1000000
max_hp BIGINT NOT NULL DEFAULT 1000000
shield INT NOT NULL DEFAULT 0
bosses_beaten INT NOT NULL DEFAULT 0
updated_at DATETIME NOT NULL
tinyboss_minions
-- minions soak damage first — server-owned, not client guesses
id BIGINT AUTO_INCREMENT PRIMARY KEY
boss_level INT NOT NULL
emoji VARCHAR(20) NOT NULL
hp INT NOT NULL DEFAULT 10
max_hp INT NOT NULL DEFAULT 10
created_at DATETIME NOT NULL
tinyboss_attacks
-- the boss fights back — server events
id BIGINT AUTO_INCREMENT PRIMARY KEY
kind ENUM('heal','shield','spawn','stun','try_end') NOT NULL
amount INT NULL
detail VARCHAR(200) NULL
created_at DATETIME NOT NULL
tinyboss_hits
-- audit log — one row per hit, for anti-bot + leaderboards
id BIGINT AUTO_INCREMENT PRIMARY KEY
user_id INT NOT NULL
kind VARCHAR(20) NOT NULL -- "punch", "kick", "magic", "super"
damage INT NOT NULL
boss_level INT NOT NULL
created_at DATETIME NOT NULL
tinyboss_cooldowns
user_id INT PRIMARY KEY
last_hit_at DATETIME NOT NULL
hits_last_minute INT NOT NULL DEFAULT 0
Boss is 1,000,000 HP per level. Never store a boss per user — store one shared tinyboss_state row, plus minions + hits. Same idea as TinyMap / TinyNovel / TinySong / TinyCity / TinyComic / TinyGarden, but HP instead of pixels / words / notes / tiles / panels / seeds.
03 / API endpoints & request flow
POST /api/tinyboss/attack
{ "kind": "kick", "damage": 5 }
- auth required, 1 hit per request
- server validates damage for that kind: punch=1, kick=5, magic=20, super=100
- cooldown: punch 0s, kick 3s, magic 8s, super 25s, wild 5s — per user
- server applies: minions soak first, then boss shield, then boss HP
- writes tinyboss_hits + updates tinyboss_state.hp atomically (transaction)
- returns { "ok": true, "hp": 999995, "minions": 1, "cooldown_ms": 3000 }
GET /api/tinyboss/boss
- returns { "ok": true, "level": 1, "name": "GORP...", "hp": 999995,
"max_hp": 1000000, "shield": 0, "minions": [ { id, emoji, hp } ] }
- client polls every 2s — same render as now
POST /api/tinyboss/fight
{ "attack_id": 123 }
- auth required, one fight per attack, max 1 fight per 5s
- server undoes that boss attack (un-heal, clear shield, remove minion)
- returns { "ok": true, "undid": "heal", "bonus": 10 }
GET /api/tinyboss/snapshot
- returns { "ok": true, "url": "/data/tinyboss/snapshot.json",
"level": 1, "hp": 999995, "updated_at": "..." }
- new visitors load snapshot first, then poll /boss
POST /api/tinyboss/clear (mod only)
- auth + role=mod required, else 403
- resets tinyboss_state to Level 1, clears minions, logs who cleared it
Boss attacks are server events in the real version — tinyboss_attacks — not client random. Client in this toy fakes them with bossAttack(). Server decides heal / shield / spawn / stun / try_end on a timer + every 30 hits, so everyone sees the same fight.
04 / Cooldown, anti-bot & validation (server owns this)
// Cooldown — keeps it from becoming chaos:
// per-user cooldowns by kind (see above), max 60 hits per minute
// 1 fight per 5s per user
// if user exceeds it, return { "ok": false, "error": "cooldown",
// "retry_ms": 320 } — client shows "Slow down" and retries.
// Anti-bot:
// hits are server-validated — client cannot claim 999999 damage
// server rejects damage != allowed for that kind, rejects hits
// while stunned, rejects hits faster than cooldown.
// mods can ban user_id from hitting.
// Validation:
// kind must be in allowed set, damage must match kind — else 400
// boss HP is server-owned — client HP is display-only.
Keep the disclaimer until this ships: “Tinker toy — not live yet. Refresh = boss heals to full.” Remove it only when /api/tinyboss/attack is actually storing hits.
05 / Frontend wiring
// Boss is already local in this page:
// bossHP — same number as now
// totalDamage — same counter as now, drives progress
// After a hit, also send to server:
async function sendHit(kind, damage){
const res = await fetch('/api/tinyboss/attack', { method:'POST',
headers:{'Content-Type':'application/json'},
body: JSON.stringify({ kind, damage }) });
// if cooldown, wait retry_ms and retry once
}
// Poll for shared boss:
async function pollBoss(){
const res = await fetch('/api/tinyboss/boss');
const data = await res.json();
// bossHP = data.hp; minions = data.minions; renderBoss()
// renderBoss = same render as attack(), but no history push
}
// On load:
// 1. GET /api/tinyboss/snapshot -> load HP / level / minions
// 2. setInterval(pollBoss, 2000)
// 3. keep local attack() / fightBoss() / undo() / downloadBoss() as-is
// If API fails, fall back to current local-only toy + disclaimer.
Keep the current toy playable with no backend — if /api/tinyboss/boss fails, fighting stays local-only and the disclaimer stays.
api/tinyboss/ + sql/tinyboss_tables.sql — no GitHub needed. The <pre> blocks are the backend spec: shared 1,000,000-HP boss, per-hit writes, boss attacks as server events, cooldowns + anti-bot, same layout, disclaimer stays until wired.