Tamago Pet - VSCode Extension
A Tamagotchi pet simulator for VSCode! Raise and care for your virtual pet right in your sidebar.
Features
- Pet Care: Feed, water, pet, sleep, exercise, and annoy your Tama
- Evolution: Watch your pet grow through different stages (Baby → Child → Teen → Adult → Elder)
- Achievements: Unlock 20 achievements through gameplay
- Quests: Complete story, daily, and repeatable quests for rewards
- Random Events: 30% chance per tick of random events (11 events total) — auto-resolved with 50% choice each
- Dungeon Adventure: Enter dangerous dungeons to earn XP and treasure (5 floors with boss)
- Biome System: Different biomes affect gameplay (Forest, Icy, Volcanic, Abyssal)
- Persistent Save: Your pet is saved automatically to VSCode's global state
- Offline Degradation: Pet degrades stats slowly while away (max 50 ticks captured)
- Pixel Art Sprites: Adorable Unicode-based pixel art sprites with 8 emotional states
Prerequisites
- Node.js 18.0+ (download)
- pnpm 8.0+ (
npm install -g pnpm)
- VSCode 1.85.0+ (download)
Installation & Running
Option 1: Development Mode (Recommended)
Best for testing and development — reload hot changes with Ctrl+Shift+P → Developer: Reload Window.
# 1. Clone or download the repository
git clone https://github.com/luiz0ar/tamago-vscode-extension.git
cd tamago-extension
# 2. Install dependencies
pnpm install
# 3. Open in VSCode
code .
# 4. Press F5 to launch Extension Development Host
# (A new VSCode window opens with the extension loaded)
# 5. Look for the Tamago icon in the Activity Bar (left sidebar)
# Click it to open your pet in the sidebar
# To reload after code changes:
# Ctrl+Shift+P → "Developer: Reload Window" (in the extension host window)
Option 2: Install as .vsix
Best for distribution or testing the final packaged version.
# 1. From the tamago-extension directory, package it
pnpm run compile
pnpm dlx vsce package
# This generates tamago-extension-0.1.0.vsix
# 2. Install in your VSCode
code --install-extension ./tamago-extension-0.1.0.vsix
# 3. Restart VSCode
# 4. Look for the Tamago icon in the Activity Bar
# Click to open your pet
# To uninstall later:
# code --uninstall-extension tamago-extension
Development Workflow
# Compile TypeScript to JavaScript
pnpm run compile
# Bundle with esbuild (creates dist/extension.js)
npx esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node --minify
# Watch mode (auto-compile on file changes)
pnpm run watch
# Package for distribution
pnpm dlx vsce package
Debugging
When running in Extension Development Host (F5):
- Open DevTools:
Ctrl+Shift+I in the extension window
- Check console logs: Look at the webview console
- Debug extension code: Set breakpoints in
src/extension.ts, src/TamagoViewProvider.ts
- Inspect webview: Use browser DevTools in the extension window
Architecture
- Engine (
src/engine/): Core game logic (Tama stats, evolution, quests, achievements, skills)
- Persistence (
src/persistence.ts): Save/load via VSCode globalState
- UI (
src/TamagoViewProvider.ts): Webview integration and message handling
- Webview (
media/): Frontend HTML/CSS/JS and sprite rendering
Game Loop
- Every 20 seconds: Stats decay based on stage and biome (hunger, thirst, sleepy decrease; happiness/anger adjust)
- Every 500ms: Pet sprite animates (cycles between 2 frames)
- Every 60s: Game auto-saves to VSCode's global state
- 30% chance per tick: Random event triggers and auto-resolves with 50/50 choice selection
Random Events (11 total)
Positive (auto-applied):
- "Comida encontrada!" (+10 hunger, +3 XP)
- "Borboleta!" (+20 happiness, +3 XP)
- "Chuva refrescante" (+15 thirst, +2 XP)
- "Brisa agradável" (+10 happiness, -10 angry, +2 XP)
Negative (auto-applied):
- "Tempestade!" (-15 happiness, +5 angry)
- "Tropeçou!" (-5 happiness, +10 angry)
- "Barulho alto!" (+15 angry, -10 sleepy)
- "Calor intenso" (-10 thirst, -5 happiness)
Interactive (auto-resolved 50/50):
- "Um gato apareceu!" → Make friends OR ignore
- "Fruta na árvore!" → Climb OR leave
- "Outro Tama apareceu!" → Play OR fight
Dungeon RPG System
Once your Tamagotchi reaches Level 3, you can embark on Dungeon Runs (tamago.dungeon).
Classes and Skills
If you start a new run or your pet dies, you can choose from 4 playable classes:
- Guardian (Guardiã): High HP and DEF.
- Shield Wall: Buffs DEF by +25% for 2 turns (CD: 2).
- Shield Slam: Attack dealing 120% ATK (CD: 1).
- Resilience (Passive): Permanent +15% DEF.
- Warrior (Guerreiro): High ATK and LUCK.
- Brutal Strike: Attack dealing 200% ATK (CD: 2).
- Fury: Buffs ATK by +35% for 3 turns (CD: 3).
- Instinct (Passive): Permanent +15 LUCK.
- Mystic (Místico): High MP and DEF.
- Deep Heal: Restores 35% Max HP (CD: 2).
- Mana Barrier: Buffs DEF by +20% for 3 turns (CD: 3).
- Arcane Flow (Passive): Restores +3 MP per turn in combat.
- Swift (Rápida): High VEL and CRIT.
- Swift Cut: Fast strike dealing 110% ATK (CD: 0).
- Dodge: Increases evasion by +30% for 2 turns (CD: 3).
- Reflexes (Passive): Permanent +20 LUCK.
Combat Actions
Combat is turn-based, featuring the following options:
- Attack: Deals damage based on ATK and enemy DEF, with critical hits scaled by LUCK (1.5x damage).
- Defend: Halves incoming damage for the turn.
- Use Skill: Cast active class skills by spending MP.
- Use Item: Drink HP potions or ATK elixirs from your inventory.
- Flee: Attempt to escape combat (unusable against Bosses).
Dungeon Structure
Each run consists of 5 floors populated by scaling enemies:
- Floors 1-4:
[Combat] → [Combat] → [Rest (Store) / Treasure (40%)] → [Combat]
- Floor 5:
[Combat] → [Rest] → [Combat] → [BOSS: Ancient Dragon]
Commands
tamago.feed - Feed your pet (+15 hunger, +2 weight, +5 XP)
tamago.water - Give water (+15 thirst, +5 XP)
tamago.pet - Give affection (+15 happiness, -5 angry, +5 XP; +25 if depressed)
tamago.sleep - Put to sleep (wakes after 10s; +50 sleepy)
tamago.exercise - Exercise (-5 weight, -3 hunger, -3 thirst, +8 XP)
tamago.annoy - Annoy (+15 angry, -happiness; wakes if sleeping)
tamago.reset - Reset (start over with new Tama)
tamago.dungeon - Enter dungeon (requires Level 3+)
Troubleshooting
Extension doesn't appear in Activity Bar
- Make sure you're in the Extension Development Host window (should say "Extension Development Host" in the VSCode title bar)
- Try
Ctrl+Shift+P → "Developer: Reload Window"
- Check the Extension tab in VSCode settings to see if tamago-extension is listed and enabled
- Open DevTools (
Ctrl+Shift+I in the extension window)
- Check the console for errors
- Try reloading with
Ctrl+Shift+P → "Developer: Reload Window"
- Verify
media/script.js is loading (check Network tab in DevTools)
"pnpm command not found"
npm install -g pnpm
pnpm --version
Port 1234 already in use (build error)
# Kill process using port 1234, or just retry the build
pnpm run compile
License
MIT
Inspiration
Inspired by vscode-pets and the classic Tamagotchi virtual pets.