Skip to content
/ rts Public

This repository contains a simple top‑down 2D real‑time strategy mini‑game called “Tanks.”

Notifications You must be signed in to change notification settings

mrsavage/rts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

Tanks (RTS) — Installation and Setup

This repository contains a simple top‑down 2D real‑time strategy mini‑game called “Tanks.” It now uses a graphical interface powered by pygame while keeping the original game logic. The old ASCII/curses interface still exists in the codebase but is not used by default.

Prerequisites

  • Operating Systems: Windows, macOS, or Linux
  • Python: 3.8 or newer recommended (3.10–3.12 tested)
  • Dependencies: pygame
  • Optional for animated unit icons: Pillow (PIL)

Quick Start

  1. Get the source
  • Clone or download this repository. Ensure your shell is at the project root that contains main.py (for example, /path/to/rts).
  1. Create and activate a virtual environment (recommended)
  • macOS/Linux: python3 -m venv .venv source .venv/bin/activate
  • Windows (PowerShell): py -3 -m venv .venv .venv\Scripts\Activate.ps1
  1. Upgrade pip (optional but recommended) python -m pip install --upgrade pip

  2. Install dependencies python -m pip install pygame

  3. Run the game python main.py

Animated unit icons (optional)

  • The pygame version can display animated GIFs for unit icons if the Pillow library is installed and GIF assets are provided.
  • Install Pillow: python -m pip install Pillow
  • Place your GIF assets here (filenames are fixed):
    • tanks/assets/infantry.gif
    • tanks/assets/artillery.gif
    • tanks/assets/tank.gif
  • The game will automatically load these GIFs. If Pillow or the assets are unavailable, it will fall back to simple built-in vector icons.

Controls (summary)

  • Build units: I (Infantry), A (Artillery), T (Tank)
  • Select units: left‑click a unit or drag to box‑select
  • Order attack: left‑click an enemy while you have units selected
  • Unselect: Right‑click or press U/Space
  • Quit: Esc or Q

Notes and Troubleshooting

  • pygame wheels bundle SDL on most platforms; no extra system packages are typically required.
  • On Linux servers or WSL without a display, you need an X11 server or to run the game on a machine with a graphical desktop.
  • macOS Gatekeeper: If you see a security prompt when running Python/pygame, allow it from System Settings (Privacy & Security).
  • If installation fails, try:
    • Ensure you’re using a supported Python version (python --version).
    • Upgrade build tools: python -m pip install --upgrade pip setuptools wheel
    • Reinstall pygame: python -m pip install --force-reinstall pygame

Optional: ASCII (curses) version

  • The legacy ASCII interface (tanks/game.py) uses curses and is kept for reference. The default entry point runs the pygame version. On Windows, curses is not included by default; you’d need the windows-curses package if you ever wire the ASCII version back in.

Uninstall / Clean up

  • Deactivate and remove the virtual environment to remove the installed dependency:
    • macOS/Linux: deactivate; rm -rf .venv
    • Windows: deactivate; rmdir /s /q .venv

License

  • See repository for license details (or update this section accordingly).

About

This repository contains a simple top‑down 2D real‑time strategy mini‑game called “Tanks.”

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages