A lightweight, customizable rhythm game built with TypeScript and HTML5 Canvas.
BeatPlay is a 4-lane rhythm game where you hit notes in sync with music. It features precise timing detection, customizable charts, and an easy-to-extend architecture.
- ✅ 4-lane gameplay with tap notes
- ✅ High-precision timing engine (<10ms accuracy)
- ✅ Judgment system (Perfect/Great/Good/Miss)
- ✅ Combo and scoring system
- ✅ Web-based (runs in browser)
- ✅ TypeScript for type safety
- ✅ Modular, extensible architecture
- Language: TypeScript
- Platform: Web (HTML5 Canvas)
- Audio: Web Audio API
- Build Tool: Vite
- Rendering: Canvas 2D API
BeatPlay/
├── src/
│ ├── engine/ # Core game systems
│ ├── gameplay/ # Gameplay logic
│ ├── rendering/ # Visual rendering
│ └── main.ts # Entry point
├── assets/ # Songs, charts, images
├── docs/ # Documentation
└── package.json
- Node.js (v18 or higher)
- npm or yarn
-
Clone or download this repository
-
Install dependencies:
npm install- Start development server:
npm run dev- Open your browser to
http://localhost:3000
npm run buildThe built files will be in the dist/ folder.
- Use D, F, J, K keys for the 4 lanes (left to right)
- Hit notes as they reach the judgment line
- Aim for Perfect timing to maximize your score
- Build combos to increase your score multiplier
| Key | Lane |
|---|---|
| D | Lane 1 |
| F | Lane 2 |
| J | Lane 3 |
| K | Lane 4 |
- Place your audio file in
assets/songs/your-song/ - Create a
chart.jsonfile with note data (see Chart Format below) - Load the song in your game code
{
"metadata": {
"title": "Song Name",
"artist": "Artist Name",
"bpm": 140,
"offset": 0
},
"notes": [
{
"time": 1000,
"lane": 0,
"type": "tap"
}
]
}time: Milliseconds from song startlane: 0-3 (left to right)type: "tap" (more types coming later)
| Judgment | Window | Points |
|---|---|---|
| Perfect | ±30ms | 100 |
| Great | ±60ms | 75 |
| Good | ±100ms | 50 |
| Miss | >100ms | 0 |
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run type-check- Check TypeScript types
See the /docs folder for detailed documentation:
- PRD.md - Product requirements and features
- ARCHITECTURE.md - System architecture and tech decisions
- DESIGN.md - Game design and mechanics
- TODOS.md - Development roadmap
- LOGS.md - Development journal
- Basic project structure
- Core engine systems
- Complete gameplay implementation
- Demo songs and charts
- Long notes (holds)
- Visual effects and polish
- Song selection UI
- Results screen
- Chart editor
- Customizable themes
- More lanes (6, 7, etc.)
- Practice mode
This is a personal project, but suggestions and feedback are welcome!
MIT License - feel free to use and modify for your own projects.
Built with TypeScript, Vite, and Web Audio API.
Note: This is an early MVP. Many features are still in development. Check docs/TODOS.md for the current development status.