This is a demo repository showcasing how to build a pinball game using the Vibe Compiler (vibec). The Vibe Compiler processes prompt stacks to generate code via LLM integration, and this project demonstrates that workflow with a playable pinball game.
vibe-pinball/
├── stacks/
│ └── core/
│ ├── 001_create_pinball_table.md # Initial table setup
│ ├── 002_add_targets_scoring.md # Add targets and scoring
│ ├── 003_special_features.md # Advanced features
│ └── plugins/
│ └── coding-style.md # Coding style guidelines
├── output/
│ ├── stacks/ # Per-stage outputs
│ └── current/ # Latest game files
├── vibec.json # Configuration
└── README.md # This file
- Node.js and npm: Required to run
vibecand install dependencies. - LLM API Key: An API key for an OpenAI-compatible service (e.g., OpenAI, OpenRouter).
- Python 3: Optional, for serving the game locally.
Follow these steps to build the pinball game using vibec:
Install vibec globally or in your project:
npm install -g @vgrichina/vibecConfigure the LLM API key as an environment variable:
export VIBEC_API_KEY=your_api_key_hereRun vibec to process the stacks/core/ prompts and generate the game files:
vibec- What Happens:
vibecreadsvibec.json, which specifies thecorestack.- It processes each prompt in order:
- Creates pinball table with flippers and physics (
001_create_pinball_table.md) - Adds targets, scoring, and sound effects (
002_add_targets_scoring.md) - Adds special features like multiball and power-ups (
003_special_features.md)
- Creates pinball table with flippers and physics (
- Outputs are saved in
output/stacks/(per stage) and merged intooutput/current/(latest version).
Check the generated files:
ls output/current/You should see index.html, styles.css, and game.js.
Serve the game locally using Python's HTTP server (or any static server):
cd output/current
python3 -m http.server 8000Open http://localhost:8000 in your browser to play the pinball game.
The pinball game implements the following features across three development stages:
-
Basic Pinball Table (Stage 1)
- Portrait-oriented canvas with cosmic background
- Two flippers controlled by A/D keys
- Ball launcher controlled by SPACE key
- Physics simulation with gravity and collisions
- Neon glow effects on table elements
-
Targets and Scoring (Stage 2)
- Various glowing targets with different point values
- Triangle bumpers that bounce the ball
- Score tracking and display
- Particle effects and ball trails
- Synthesized sound effects using Web Audio API
-
Special Features (Stage 3)
- Multiball mode with score multipliers
- Power-ups: slow-motion, magnets, warp tunnels
- Dynamic visuals that respond to gameplay
- Game states: start screen, ball counter, game over
- High score persistence and enhanced audio
- A/D Keys: Control left/right flippers
- SPACE: Launch ball from launcher
- R: Restart game (on game over screen)
MIT