Pixel Art Game Builder
Expert guide for architecting and building pixel art idle/incremental games with procedural sprite generation.
Quick Navigation
| Need |
Go to |
| Start a new project |
Quick Start |
| Copy working code |
templates/ |
| Understand patterns |
patterns/ |
| See full example |
examples/ |
| Deep reference |
references/ |
| CSS/Tailwind setup |
assets/ |
Core Design Philosophy
Three pillars: Minimal. Luminous. Contemplative.
- Constraint = Creativity: Limited palette (12 colors), low resolution (16×16 sprites)
- Space speaks: Dark backgrounds, few elements = immensity feeling
- Light guides: Important elements glow (higher rarities shine more)
- Movement breathes: Slow, organic animations (minimum 500ms cycles)
- Zero pressure: NO timers, NO deadlines, NO FOMO, NO negative messages
Quick Start
npm create vite@latest my-idle-game -- --template react-ts
cd my-idle-game
npm install zustand immer
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
Then copy files from assets/ for CSS and Tailwind config.
Critical Implementation Rules
Pixel Art Sprites (16×16)
// MANDATORY for pixel-perfect rendering
ctx.imageSmoothingEnabled = false;
/* CSS for any sprite element */
.sprite { image-rendering: pixelated; }
- 4 colors max per sprite: base, highlight, shadow, outline
- 12×12 usable zone (2px margin for glow effects)
- Scale 4× when displaying (16×16 → 64×64)
- NO antialiasing, NO gradients
Color Palette (12 colors only)
const PALETTE = {
deepBlack: '#0a0a0f', // Main background
spaceGray: '#1a1a2e', // Panels
borderGray: '#2d2d44', // Borders
neonCyan: '#00fff5', // Primary actions, RARE
softMagenta: '#ff6bcb', // Notifications, EPIC
cosmicGold: '#ffd93d', // Rewards, LEGENDARY
validGreen: '#39ff14', // Success, UNCOMMON
alertRed: '#ff4757', // Alerts (rare use)
mysteryPurple: '#6c5ce7', // Hidden/secret
mainWhite: '#e8e8e8', // Body text, COMMON
secondaryGray: '#a0a0a0', // Disabled
interactiveCyan: '#7fefef' // Links
};
const RARITY_COLORS = {
common: PALETTE.secondaryGray,
uncommon: PALETTE.validGreen,
rare: PALETTE.neonCyan,
epic: PALETTE.softMagenta,
legendary: PALETTE.cosmicGold,
};
Game Loop Pattern (100ms tick)
useEffect(() => {
const interval = setInterval(() => {
const now = Date.now();
const delta = (now - lastTick) / 1000;
// Update resources
addCredits(incomePerSecond * delta);
regenerateEnergy(delta);
setLastTick(now);
}, 100);
return () => clearInterval(interval);
}, [incomePerSecond, lastTick]);
State Management (Zustand + Immer)
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
import { immer } from 'zustand/middleware/immer';
const useGameStore = create<GameState>()(
persist(
immer((set, get) => ({
credits: 0,
energy: 100,
addCredits: (amount) => set((s) => { s.credits += amount }),
})),
{ name: 'game-save' }
)
);
Templates (Copy & Use)
Ready-to-use code in templates/:
| Template |
Description |
game-loop.tsx |
Hook for 100ms game tick with delta time |
save-system.ts |
Zustand persist pattern with migration |
progression.ts |
Scaling formulas (exponential costs, diminishing returns) |
sprite-renderer.tsx |
Canvas component with pixel-perfect rendering |
Patterns (Understand & Adapt)
Conceptual guides in patterns/:
| Pattern |
Description |
resource-system.md |
Structure currencies, caps, regeneration |
upgrade-tree.md |
Linear upgrades, skill trees, prestige unlocks |
prestige-loop.md |
Reset mechanics, meta-progression, permanent bonuses |
procedural-sprites.md |
Generate varied sprites from seeds |
Examples
Working code in examples/:
| Example |
Description |
minimal-idle-game.tsx |
Complete ~150 line idle game with resources, upgrades, save |
Deep References
Detailed documentation in references/:
| Reference |
When to use |
architecture.md |
Full project structure, types, stores |
sprite-system.md |
Canvas API, color derivation, caching |
game-mechanics.md |
Economy, scanning, progression formulas |
ui-patterns.md |
Components, layouts, animations |
content-structure.md |
Data structure for items, sectors, upgrades |
Design Pillars (Non-Negotiable)
- Immediate Clarity: Every button has text label, max 3 actions visible
- Progressive Depth: New content unlocks over time
- Emotional Collection: Every item has narrative description ≤140 chars
- Zero Pressure: NO timers, NO deadlines, NO FOMO
- Mobile First: Touch targets ≥44px, breakpoints 320/768/1024px
Writing Style
- Voice: Calm, melancholic, subtle humor
- Rules: ≤140 chars, NO "!", NO CAPS, NO imperatives
Templates:
- Funny: "[Object]. [Absurd observation]. [Punchline]."
- Tender: "[Object]. [Human detail]. [Universal truth]."
- Weird: "[Object]. [Strange property]. [Acceptance]."
Performance Targets
| Metric |
Target |
| Bundle size |
<200KB gzipped |
| FPS idle |
≥30 |
| Memory |
<100MB |
DO's and DON'Ts
DO ✓
- Pixel-perfect rendering (
imageSmoothingEnabled = false)
- 4-color sprites maximum
- 12-color palette only
- ≥44px touch targets
- Cache generated sprites
- Support reduced-motion
DON'T ✗
- Antialiasing on sprites
- Gradients in pixel art
- Icon-only buttons
- Stats in item descriptions
- Timers or countdowns
- Negative failure messages
- Nested modals
1---2name: pixel-art-game-builder3description: Expert skill for building pixel art idle/incremental games with procedural sprite generation, React/TypeScript/Zustand architecture, and contemplative game design. Use when creating pixel art games, implementing idle game mechanics, generating procedural sprites via Canvas API, building collection-based games, or implementing incremental game economies. Triggers on requests for pixel art, idle games, sprite generation, incremental games, collection games, or contemplative game experiences.4---56# Pixel Art Game Builder78Expert guide for architecting and building pixel art idle/incremental games with procedural sprite generation.910## Quick Navigation1112| Need | Go to |13|------|-------|14| Start a new project | [Quick Start](#quick-start) |15| Copy working code | [templates/](templates/) |16| Understand patterns | [patterns/](patterns/) |17| See full example | [examples/](examples/) |18| Deep reference | [references/](references/) |19| CSS/Tailwind setup | [assets/](assets/) |2021## Core Design Philosophy2223**Three pillars:** Minimal. Luminous. Contemplative.2425- **Constraint = Creativity**: Limited palette (12 colors), low resolution (16×16 sprites)26- **Space speaks**: Dark backgrounds, few elements = immensity feeling27- **Light guides**: Important elements glow (higher rarities shine more)28- **Movement breathes**: Slow, organic animations (minimum 500ms cycles)29- **Zero pressure**: NO timers, NO deadlines, NO FOMO, NO negative messages3031## Quick Start3233```bash34npm create vite@latest my-idle-game -- --template react-ts35cd my-idle-game36npm install zustand immer37npm install -D tailwindcss postcss autoprefixer38npx tailwindcss init -p39```4041Then copy files from [assets/](assets/) for CSS and Tailwind config.4243## Critical Implementation Rules4445### Pixel Art Sprites (16×16)4647```javascript48// MANDATORY for pixel-perfect rendering49ctx.imageSmoothingEnabled = false;50```5152```css53/* CSS for any sprite element */54.sprite { image-rendering: pixelated; }55```5657- **4 colors max per sprite**: base, highlight, shadow, outline58- **12×12 usable zone** (2px margin for glow effects)59- **Scale 4×** when displaying (16×16 → 64×64)60- **NO antialiasing, NO gradients**6162### Color Palette (12 colors only)6364```typescript65const PALETTE = {66 deepBlack: '#0a0a0f', // Main background67 spaceGray: '#1a1a2e', // Panels68 borderGray: '#2d2d44', // Borders69 neonCyan: '#00fff5', // Primary actions, RARE70 softMagenta: '#ff6bcb', // Notifications, EPIC71 cosmicGold: '#ffd93d', // Rewards, LEGENDARY72 validGreen: '#39ff14', // Success, UNCOMMON73 alertRed: '#ff4757', // Alerts (rare use)74 mysteryPurple: '#6c5ce7', // Hidden/secret75 mainWhite: '#e8e8e8', // Body text, COMMON76 secondaryGray: '#a0a0a0', // Disabled77 interactiveCyan: '#7fefef' // Links78};7980const RARITY_COLORS = {81 common: PALETTE.secondaryGray,82 uncommon: PALETTE.validGreen,83 rare: PALETTE.neonCyan,84 epic: PALETTE.softMagenta,85 legendary: PALETTE.cosmicGold,86};87```8889### Game Loop Pattern (100ms tick)9091```typescript92useEffect(() => {93 const interval = setInterval(() => {94 const now = Date.now();95 const delta = (now - lastTick) / 1000;9697 // Update resources98 addCredits(incomePerSecond * delta);99 regenerateEnergy(delta);100101 setLastTick(now);102 }, 100);103 return () => clearInterval(interval);104}, [incomePerSecond, lastTick]);105```106107### State Management (Zustand + Immer)108109```typescript110import { create } from 'zustand';111import { persist } from 'zustand/middleware';112import { immer } from 'zustand/middleware/immer';113114const useGameStore = create<GameState>()(115 persist(116 immer((set, get) => ({117 credits: 0,118 energy: 100,119 addCredits: (amount) => set((s) => { s.credits += amount }),120 })),121 { name: 'game-save' }122 )123);124```125126## Templates (Copy & Use)127128Ready-to-use code in [templates/](templates/):129130| Template | Description |131|----------|-------------|132| `game-loop.tsx` | Hook for 100ms game tick with delta time |133| `save-system.ts` | Zustand persist pattern with migration |134| `progression.ts` | Scaling formulas (exponential costs, diminishing returns) |135| `sprite-renderer.tsx` | Canvas component with pixel-perfect rendering |136137## Patterns (Understand & Adapt)138139Conceptual guides in [patterns/](patterns/):140141| Pattern | Description |142|---------|-------------|143| `resource-system.md` | Structure currencies, caps, regeneration |144| `upgrade-tree.md` | Linear upgrades, skill trees, prestige unlocks |145| `prestige-loop.md` | Reset mechanics, meta-progression, permanent bonuses |146| `procedural-sprites.md` | Generate varied sprites from seeds |147148## Examples149150Working code in [examples/](examples/):151152| Example | Description |153|---------|-------------|154| `minimal-idle-game.tsx` | Complete ~150 line idle game with resources, upgrades, save |155156## Deep References157158Detailed documentation in [references/](references/):159160| Reference | When to use |161|-----------|-------------|162| `architecture.md` | Full project structure, types, stores |163| `sprite-system.md` | Canvas API, color derivation, caching |164| `game-mechanics.md` | Economy, scanning, progression formulas |165| `ui-patterns.md` | Components, layouts, animations |166| `content-structure.md` | Data structure for items, sectors, upgrades |167168## Design Pillars (Non-Negotiable)1691701. **Immediate Clarity**: Every button has text label, max 3 actions visible1712. **Progressive Depth**: New content unlocks over time1723. **Emotional Collection**: Every item has narrative description ≤140 chars1734. **Zero Pressure**: NO timers, NO deadlines, NO FOMO1745. **Mobile First**: Touch targets ≥44px, breakpoints 320/768/1024px175176## Writing Style177178- **Voice**: Calm, melancholic, subtle humor179- **Rules**: ≤140 chars, NO "!", NO CAPS, NO imperatives180181**Templates:**182- Funny: "[Object]. [Absurd observation]. [Punchline]."183- Tender: "[Object]. [Human detail]. [Universal truth]."184- Weird: "[Object]. [Strange property]. [Acceptance]."185186## Performance Targets187188| Metric | Target |189|--------|--------|190| Bundle size | <200KB gzipped |191| FPS idle | ≥30 |192| Memory | <100MB |193194## DO's and DON'Ts195196**DO ✓**197- Pixel-perfect rendering (`imageSmoothingEnabled = false`)198- 4-color sprites maximum199- 12-color palette only200- ≥44px touch targets201- Cache generated sprites202- Support reduced-motion203204**DON'T ✗**205- Antialiasing on sprites206- Gradients in pixel art207- Icon-only buttons208- Stats in item descriptions209- Timers or countdowns210- Negative failure messages211- Nested modals