TinyPet.
1,000,000 hearts. One tiny pet. Everyone takes care of him. Starts as an egg. Don’t let the Grump get him.
This is a toy prototype. Your pet is local-only — stored only in this browser tab. He is NOT saved to the server and NOT shared with anyone yet. Refresh = egg again (unless this tab autosaves). Shared pet, accounts, and moderation are coming later. Don’t love anything you wouldn’t want to lose. And yes — the Grump fights back on purpose. He wants Pip to be sad.
1,000,000 hearts = one very loved pet. Every pat / feed / play / clean / nap deals 1 damage to the Grump. Every 30 actions, and every 45 seconds, the Grump hits back — he makes Pip hungry, sad, dirty, sleepy, tries to make him run away. Comfort undoes its last attack, +10 bonus. Cozy Blanket blocks for 60s.
An egg. Boring. No one will pat an egg. I will make sure it stays an egg forever.
No attacks yet. The Grump is pretending to nap.
…
Tip: Keep all four bars up. If any bar hits 0, Pip gets sad and the Grump gets stronger. Pat is safe anytime. Feed when hungry, Play when bored, Clean when dirty, Nap when tired. Comfort = undoes the Grump’s last attack.
How it works (when it’s real)
Everyone cares for the same pet. One Pip. You pat, the Grump tries to make him sad, you comfort him back. Cooldowns, accounts, and moderation will keep it from becoming chaos. For now, you’re caring alone — practice against a very rude Grump.
- Care = 1 heart = 1 damage to the Grump
- Every 30 actions + every 45s, the Grump attacks
- Comfort undoes its last attack, Cozy Blanket blocks for 60s
- Download .txt to keep Pip’s story
Community — coming soon
Shared state is not connected yet.
🟢 0 caretakers with Pip right now (fake — local toy)
❤️ Last heart: —
⚔️ Last fight: — (not saved)
📜 Rules: Be kind. No hate, no NSFW, no ads.
⬇ Backend — TinyPet Backend — Template
Right now TinyPet is a tinker toy — pet is a local object in this tab, grumpAttack() drops stats from local state, totalHearts is a local counter, history is 10 in-memory snapshots, and Refresh = egg again (except local autosave). Disclaimer is the truth: local-only, not saved, not shared. This backend is the map to make it real: one shared pet, per-care writes, Grump attacks as server events, cooldowns, accounts, moderation. Proposed, not connected.
01 / Files to create
api/tinypet/care.php POST /api/tinypet/care api/tinypet/pet.php GET /api/tinypet/pet api/tinypet/fight.php POST /api/tinypet/fight api/tinypet/snapshot.php GET /api/tinypet/snapshot api/tinypet/clear.php POST /api/tinypet/clear (mod only) sql/tinypet_tables.sql
Keep the tinyfiles PHP pattern: /api/bootstrap.php, json_in() / json_out(), prepared PDO.
02 / Database tables
-- sql/tinypet_tables.sql
tinypet_state
-- one row — the shared pet. Never one row per user.
id INT PRIMARY KEY DEFAULT 1
name VARCHAR(40) NOT NULL DEFAULT 'Pip'
stage VARCHAR(20) NOT NULL DEFAULT 'egg' -- egg,baby,pup,adult,legend
hearts BIGINT NOT NULL DEFAULT 0
hunger INT NOT NULL DEFAULT 50
happy INT NOT NULL DEFAULT 50
energy INT NOT NULL DEFAULT 50
clean INT NOT NULL DEFAULT 50
updated_at DATETIME NOT NULL
tinypet_attacks
-- the Grump fights back — server events
id BIGINT AUTO_INCREMENT PRIMARY KEY
kind ENUM('hungry','sad','dirty','sleepy','try_runaway') NOT NULL
amount INT NULL
detail VARCHAR(200) NULL
created_at DATETIME NOT NULL
tinypet_care_log
-- audit log — one row per care action
id BIGINT AUTO_INCREMENT PRIMARY KEY
user_id INT NOT NULL
kind VARCHAR(20) NOT NULL -- "pat","feed","play","clean","nap"
hearts INT NOT NULL DEFAULT 1
created_at DATETIME NOT NULL
tinypet_cooldowns
user_id INT PRIMARY KEY
last_care_at DATETIME NOT NULL
cares_last_minute INT NOT NULL DEFAULT 0Pet is 1,000,000 hearts. Never store a pet per user — store one shared tinypet_state row, plus care log. Same idea as TinyBoss, but hearts instead of HP damage.
03 / API endpoints
POST /api/tinypet/care
{ "kind": "pat" }
- auth required, 1 care per request
- server validates kind in allowed set, applies stat change:
pat +happy, feed +hunger, play +happy/-energy, clean +clean, nap +energy
- cooldown: 1 care per 500ms, max 60 per minute per user
- writes tinypet_care_log + updates tinypet_state atomically
- returns { "ok": true, "hearts": 123, "hunger": 60, "happy": 62 }
GET /api/tinypet/pet
- returns { "ok": true, "name": "Pip", "stage": "baby", "hearts": 123,
"hunger": 60, "happy": 62, "energy": 48, "clean": 55 }
- client polls every 2s — same render as now
POST /api/tinypet/fight
{ "attack_id": 123 } — undoes that Grump attack, +10 bonus hearts
GET /api/tinypet/snapshot
- returns { "ok": true, "url": "/data/tinypet/snapshot.json", "hearts": 123 }
POST /api/tinypet/clear (mod only) — 403 unless modGrump attacks are server events — tinypet_attacks — not client random. Server decides hungry / sad / dirty / sleepy / try_runaway on timer + every 30 actions + stat decay.
04 / Cooldown, moderation & validation
// Cooldown: 1 care per 500ms, 60 per minute, 1 fight per 5s // Moderation: no hate / NSFW / ads — mods can clear + ban user_id // Validation: kind in allowed set — else 400 // Pet stats are server-owned — client stats are display-only. // Decay: server ticks hunger/happy/energy/clean down slowly, // so Pip needs continuous care, not one big burst.
Keep disclaimer until this ships: “Tinker toy — not live yet. Refresh = egg again.”
05 / Frontend wiring
// pet is already local. After care (debounced 800ms):
// POST /api/tinypet/care with { kind }
// Poll GET /api/tinypet/pet every 2s, apply stats — same render as now
// On load: GET /api/tinypet/snapshot -> load into pet
// If API fails, fall back to local-only toy + disclaimer.api/tinypet/ + sql/tinypet_tables.sql — no GitHub needed. Shared 1,000,000-heart pet, per-care writes, Grump as server events, cooldowns + moderation.