Thanks to visit codestin.com
Credit goes to github.com

Skip to content

shpaker/tnk9x

Repository files navigation

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.

Development Status

Core Gameplay

  • Game loop with delta time
  • Collision detection system (tank-tank, tank-wall, bullet-wall, bullet-tank, bullet-HQ)
  • Boundary collision handling
  • Tank movement and rotation
  • Tank braking system
  • Bullet shooting mechanics
  • Enemy spawning with delay system
  • Basic surface types (brick, steel)
  • Forest surface type with hiding mechanics
  • Advanced surface types (water, ice)
  • Surface-specific mechanics (ice sliding, water blocking)

Player Features

  • Player tank controls (keyboard input)
  • Player lives system
  • Player respawn mechanism
  • Basic bonuses (grenade, tank)
  • Full bonus implementation (helmet, timer, shovel, star)
  • Player power-up system (bullet speed, armor)

Enemies & AI

  • Enemy spawning system
  • Enemy movement AI
  • Lua-based AI scripting
  • Enemies with bonus indicators
  • Enemy tracking and lifecycle management
  • Different enemy types (fast, armored, heavy)
  • Enemy AI difficulty scaling

HQ Base

  • HQ vulnerability system
  • HQ explosion animation
  • Victory/defeat overlays
  • Separate defeat screen
  • HQ protection mechanics (shovel bonus)

User Interface

  • Level selection screen
  • Pause overlay
  • Result overlays (victory/defeat)
  • Loading screen on game start
  • HUD (lives counter, score display)
  • Main menu screen
  • Game over screen
  • Settings screen

Audio System

  • Sound effects (fire, explosion, brick, steel, bonus, score)
  • Background music (game start, game over)
  • Engine sound with loop
  • Sound adapter implementation
  • Volume configuration in config.yml

Technical Infrastructure

  • Clean Architecture implementation
  • Interface-based dependency injection
  • Repository pattern for data access
  • Unit tests for collision services
  • Unit tests for audio system
  • Extended test coverage (>80%)
  • CI/CD pipeline automation
  • Performance profiling and optimization

Installation and Running

Requirements: Go 1.24+, optionally — Just.

git clone https://github.com/shpaker/tnk25.git
cd tnk25
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/tnk25

# Checks
just fmt
just lint
just test

Architecture

The project follows Clean Architecture principles with clear separation of concerns across four layers. Dependencies point inward: outer layers depend on inner layers through interfaces.

Dependency Flow

┌────────────────────────────────────────────────────────┐
│  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    │  │              │                     │
│  └──────────────┘  └──────────────┘                     │
└─────────────────────────────────────────────────────────┘

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Clone of the classic arcade game Battle City (NES, 1985), built with Go.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published