A modern remake and tribute to the classic arcade game Battle City (NES, 1985), built with Go and Ebiten. This project combines a passion for the original game with learning Go, Clean Architecture principles, and game development.
GitHub: https://github.com/shpaker/tnk9x
- Game loop (delta time)
- Collision detection (tank-tank, tank-wall, bullet-wall, bullet-tank, bullet-HQ)
- Boundary collision
- Tank movement/rotation/braking
- Bullet mechanics
- Enemy spawning
- Surface types (brick, steel, forest)
- Surface types (water, ice)
- Surface mechanics (ice sliding, water blocking)
- Controls (keyboard)
- Lives/respawn
- Tank levels (0-3)
- Damage system (level down on hit)
- Bonuses (grenade, tank, star)
- Power-ups (bullet speed, reinforced bullets, bullet limit)
- Bonuses (helmet, timer, shovel)
- Spawning system
- AI (Lua scripts)
- Level system (probability-based)
- Types (basic, fast, rapid fire, heavy)
- Heavy tank health overlay
- AI difficulty scaling
- Vulnerability/explosion
- Victory/defeat overlays
- Defeat screen
- Protection mechanics
- Level selection
- Pause overlay
- Debug info (FPS, TPS, lives, enemies)
- HUD (lives, score)
- Main menu
- Game over screen
- Settings
- Sound effects
- Background music
- Engine loop
- Volume config
- Clean Architecture
- Dependency injection
- Repository pattern
- Specs system
- Unit tests (collision, audio)
- Test coverage (>80%)
- CI/CD
- Performance profiling
Requirements: Go 1.24+, optionally — Just.
git clone https://github.com/shpaker/tnk9x.git
cd tnk9x
just deps # Install dependencies (or go mod download)
# Run the game
just run # or go run cmd/main.go
# Build binary
just build # binary will be in dist/tnk9x
# Checks
just fmt
just lint
just testThe project follows Clean Architecture principles with clear separation of concerns across four layers. Dependencies point inward: outer layers depend on inner layers through interfaces.
┌────────────────────────────────────────────────────────┐
│ Presentation Layer │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ States │ │ Adapters │ │
│ │ │ │ │ │
│ │ StageState │ │ Renderer │ │
│ │ StageSelect │ │ Input │ │
│ │ │ │ Sound │ │
│ └──────┬───────┘ └───────┬──────┘ │
│ │ │ │
│ └─────────┬────────┘ │
│ │ (depends on) │
│ ▼ │
└────────────────────────────────────────────────────────┘
│
┌───────────────────▼─────────────────────────────────────┐
│ Application Layer │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Use Cases │ │ Services │ │
│ │ │ │ │ │
│ │ TankActions │ │ Collision │ │
│ │ Collision │ │ Animation │ │
│ │ Sound │ │ Coordinate │ │
│ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │
│ └─────────┬───────┘ │
│ │ (manipulates) │
│ ▼ │
└─────────────────────────────────────────────────────────┘
│
┌───────────────────▼─────────────────────────────────────┐
│ Domain Layer │
│ ┌───────────────────────────────────────────────────┐ │
│ │ Entities (Tank, Bullet, Block, HQ, etc.) │ │
│ │ Value Objects (Position, Size, Direction) │ │
│ │ Session Entities (GameSession, StageSession) │ │
│ └───────────────────────────────────────────────────┘ │
│ ▲ │
└───────────────────┼─────────────────────────────────────┘
│ (reads/writes)
┌───────────────────▼─────────────────────────────────────┐
│ Infrastructure Layer │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Repositories │ │ Raw Files │ │
│ │ │ │ │ │
│ │ Game │ │ FileSystem │ │
│ │ Processed │ │ │ │
│ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────┘
This project is licensed under the MIT License - see the LICENSE file for details.