A 3D physics-based block destruction game built with TypeScript, Three.js, Rapier3D physics engine, and bitECS.
Click anywhere on the screen to shoot balls at the block tower. Try to knock down as many blocks as possible!
- 3D Graphics: Powered by Three.js with realistic lighting and shadows
- Physics Simulation: Real-time physics using Rapier3D
- Entity Component System: Efficient game architecture with bitECS
- Interactive Gameplay: Click to shoot projectiles at block towers
- Monorepo Structure: Clean organization with pnpm workspaces
- TypeScript: Type-safe development
- Three.js: 3D graphics rendering
- Rapier3D: High-performance physics engine
- bitECS: Entity Component System for game logic
- Vite: Fast build tooling
- Vitest: Unit and integration testing
- pnpm: Efficient package management
- Node.js >= 18
- pnpm (install with
npm install -g pnpm)
# Clone the repository
git clone https://github.com/provencher/repoblocks.git
cd repoblocks
# Install dependencies
pnpm install
# Start development server
pnpm devThe game will be available at http://localhost:5173
- Shoot: Click anywhere on the screen to shoot a ball
- Aim: The ball will be shot from your click position toward the tower
- Reset: Click the "Reset Level" button to rebuild the tower
The game uses bitECS for high-performance entity management:
- Entities: Game objects (blocks, balls, ground)
- Components: Data containers (Transform, Velocity, PhysicsBody)
- Systems: Logic processors (PhysicsSystem, RenderSystem, InputSystem)
repoblocks/
├── packages/
│ └── client/ # Frontend game client
│ ├── src/
│ │ ├── core/ # ECS setup and components
│ │ ├── physics/ # Rapier3D integration
│ │ ├── rendering/ # Three.js rendering
│ │ ├── input/ # User input handling
│ │ ├── game/ # Game logic
│ │ └── main.ts # Entry point
│ └── ...
├── pnpm-workspace.yaml # Monorepo configuration
└── package.json
- Transform: Position and rotation data
- Velocity: Linear velocity for physics bodies
- PhysicsBody: Reference to Rapier rigid body
- Bomb/Block: Tag components for game entities
# Run all tests
pnpm test
# Run tests with UI
pnpm test:ui
# Run tests in watch mode
pnpm test -- --watchpnpm dev- Start development serverpnpm build- Build for productionpnpm test- Run test suitepnpm lint- Lint codepnpm format- Format code with Prettierpnpm typecheck- Run TypeScript type checking
- Components: Define new components in
src/core/components/ - Systems: Add systems in their respective directories
- Entities: Use factories in
src/physics/factories.ts
The physics world is configured with:
- Gravity: -9.81 m/s² (Earth-like)
- Fixed timestep: 60 FPS
- Continuous collision detection
Three.js scene includes:
- Perspective camera with orbit controls potential
- Directional + ambient lighting
- Shadow mapping for realistic shadows
- WebGL renderer with antialiasing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the GNU General Public License v3.0.