tinyfiles.tv
⚠️ TINKER TOY — NOT LIVE YET — DISCLAIMER

This is a toy prototype. Your panels are local-only — stored only in this browser tab. They are NOT saved to the server and NOT shared with anyone yet. Refresh = gone (unless this tab autosaves). Shared community state, accounts, and moderation are coming later. Don’t draw anything you wouldn’t want to lose. And yes — the villain fights back on purpose. He wants to be the hero.

Comic: 💬 Panels: 1🦹 Villain HP: 1,000,000🛡️ Shield: off
Panels: 1 / 1,000,000•999,999 to go•Villain: Smug

1,000,000 panels = one very long comic. Every panel you add deals 1 damage to the Villain. Every 30 panels, and every 45 seconds, the Villain hits back — he erases, he rewrites your dialogue to be rude, he inserts himself as the hero.

🦹
The villain says:

One blank panel. Perfect. I will be the hero of this comic. You can be… the guy who gets stepped on in panel 2.

No attacks yet. The villain is pretending to pose.

Tip: fill caption + speech, pick a character + scene, hit Add Panel. Or hit Random Panel and let the comic write itself. Fight = undoes the villain’s last attack, +10 bonus damage. Defend = blocks for 60s.

How it works (when it’s real)

Everyone draws on the same comic. One panel at a time. You add a panel, the villain tries to erase it, you fight him back. Cooldowns, accounts, and moderation will keep it from becoming chaos. For now, you’re drawing alone — think of this as practice against a very rude villain.

  • Add a panel to deal damage — 1 panel = 1 HP off the Villain
  • Every 30 panels + every 45 seconds, the Villain attacks
  • Fight undoes its last attack, Defend blocks for 60s
  • Download .txt to keep your comic

Community — coming soon

Shared state is not connected yet. This box is a placeholder for what’s next:

🟢 0 cartoonists drawing right now (fake — local toy)
💬 Last panel: —
⚔️ Last fight: — (not saved)
📜 Rules: No hate, no NSFW, no ads. Mods will nuke it later.

Backend  ·  Template · Proposed · Not connected

⬇ Backend — TinyComic Backend — Template

Right now TinyComic is a tinker toy — panels is a local array in this tab, villainAttack() erases a panel from the array, totalEver is a local counter, history is 10 in-memory snapshots, and Refresh = gone (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 comic, per-panel writes by position, villain attacks as server events, cooldowns, accounts, and moderation. Proposed, not connected.

01 / Files to create
api/tinycomic/panel.php         POST /api/tinycomic/panel
api/tinycomic/panels.php        GET  /api/tinycomic/panels?since=
api/tinycomic/fight.php         POST /api/tinycomic/fight
api/tinycomic/snapshot.php      GET  /api/tinycomic/snapshot
api/tinycomic/clear.php         POST /api/tinycomic/clear  (mod only)
sql/tinycomic_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/tinycomic_tables.sql
tinycomic_panels
  -- one row per panel — 1,000,000 max, ordered by position
  id BIGINT AUTO_INCREMENT PRIMARY KEY
  position INT NOT NULL              -- 0 .. 999,999, unique, defines order
  character VARCHAR(20) NOT NULL     -- "hero", "villain", "dragon", ...
  scene VARCHAR(20) NOT NULL         -- "city", "space", "dungeon", ...
  caption VARCHAR(200) NULL
  speech VARCHAR(300) NULL
  user_id INT NOT NULL
  created_at DATETIME NOT NULL
  UNIQUE(position)                   -- last write wins per slot

tinycomic_attacks
  -- the villain fights back — server events, not client guesses
  id BIGINT AUTO_INCREMENT PRIMARY KEY
  kind ENUM('erase','rewrite','insert_villain','try_end') NOT NULL
  position INT NULL                  -- which panel it erased / rewrote
  detail VARCHAR(200) NULL
  created_at DATETIME NOT NULL

tinycomic_snapshot
  id INT AUTO_INCREMENT PRIMARY KEY
  path VARCHAR(200) NOT NULL         -- "/data/tinycomic/snapshot.json"
  panel_count INT NOT NULL DEFAULT 0
  created_at DATETIME NOT NULL

tinycomic_cooldowns
  user_id INT PRIMARY KEY
  last_write_at DATETIME NOT NULL
  panels_last_minute INT NOT NULL DEFAULT 0

Comic is 1,000,000 panels. Never store a full comic per user — store only panels by position, plus one snapshot. Same idea as TinyMap / TinyNovel / TinySong / TinyCity, but panels instead of pixels / words / notes / tiles.

03 / API endpoints & request flow
POST /api/tinycomic/panel
{ "panels": [ { "position": 12, "character": "hero", "scene": "city", "caption": "...", "speech": "..." }, ... ] }
- auth required, 1-20 panels per request (one page = many panels)
- validates position 0-999999, character / scene in allowed sets
- cooldown: max 1 write per 500ms, max 20 panels per request
- writes INSERT ... ON DUPLICATE KEY UPDATE character, scene, caption, speech, user_id
- returns { "ok": true, "written": 1, "cooldown_ms": 500 }

GET /api/tinycomic/panels?since=2026-11-18T00:00:00Z
- returns { "ok": true, "panels": [ { position, character, scene, caption, speech }, ... ] }
- since = last poll time, max 200 panels per response
- client polls every 2s, applies only new panels — same render as now

POST /api/tinycomic/fight
{ "attack_id": 123 }
- auth required, one fight per attack, max 1 fight per 5s
- server undoes that attack (restores erased panel, restores dialogue)
- returns { "ok": true, "restored": 12, "bonus": 10 }

GET /api/tinycomic/snapshot
- returns { "ok": true, "url": "/data/tinycomic/snapshot.json",
  "panel_count": 1234, "updated_at": "..." }
- new visitors load snapshot first, then poll /panels?since=

POST /api/tinycomic/clear  (mod only)
- auth + role=mod required, else 403
- clears tinycomic_panels + rebuilds snapshot, logs who cleared it

Villain attacks are server events in the real version — tinycomic_attacks — not client random. Client in this toy fakes them with villainAttack(). Server decides erase / rewrite / insert_villain / try_end on a timer + every 30 panels, so everyone sees the same fight.

04 / Cooldown, moderation & validation (server owns this)
// Cooldown — keeps it from becoming chaos:
//   1 write request per 500ms per user
//   20 panels per request, 1 fight per 5s per user
//   if user exceeds it, return { "ok": false, "error": "cooldown",
//   "retry_ms": 320 } — client shows "Slow down" and retries.

// Moderation:
//   no hate / NSFW / ads — mods can clear + ban user_id from drawing
//   server stores user_id per panel, so a bad page can be rolled
//   back by user + position range, not by wiping the whole comic.

// Validation:
//   position must be integer 0-999999, character / scene in allowed sets
//   caption max 200 chars, speech max 300 chars — else 400
//   panel art is client-side only — server only sees panel data.

Keep the disclaimer until this ships: “Tinker toy — not live yet. Refresh = gone.” Remove it only when /api/tinycomic/panel is actually storing panels.

05 / Frontend wiring
// Panels are already local in this page:
//   panels[] — same array as now
//   totalEver — same counter as now, drives Villain HP

// After adding a panel (debounced 800ms), also send to server:
async function sendPanels(panels){
  const res = await fetch('/api/tinycomic/panel', { method:'POST',
    headers:{'Content-Type':'application/json'},
    body: JSON.stringify({ panels }) });
  // if cooldown, wait retry_ms and retry once
}

// Poll for other people's panels:
async function pollPanels(){
  const res = await fetch('/api/tinycomic/panels?since=' + encodeURIComponent(lastPoll));
  const data = await res.json();
  // data.panels.forEach(p => setPanel(p.position, p))
  // setPanel = same render as addPanel(), but no history push
}

// On load:
//   1. GET /api/tinycomic/snapshot -> load JSON into panels[]
//   2. setInterval(pollPanels, 2000)
//   3. keep local addPanel() / fightComic() / undo() / downloadComic() as-is
// If API fails, fall back to current local-only toy + disclaimer.

Keep the current toy playable with no backend — if /api/tinycomic/panels fails, drawing stays local-only and the disclaimer stays.

Copy the snippets above into api/tinycomic/ + sql/tinycomic_tables.sql — no GitHub needed. The <pre> blocks are the backend spec: shared 1,000,000-panel comic, per-panel writes by position, villain attacks as server events, cooldowns + moderation, same layout, disclaimer stays until wired.