""" README.md - Documentation for 2D RTS Game """
A 2D Real-Time Strategy game built with Python and Pygame.
- Strategic gameplay with resource management and base building
- Multiple unit types with different abilities and strengths
- Combat system with different attack and defense types
- Advanced AI opponent with adaptive strategies
- Economy system with resource gathering and production
- Inventory system for items and equipment
- Save/load functionality to continue your progress
- Content editor for customizing game elements
- Pathfinding system for intelligent unit movement
- Python 3.6 or higher
- Pygame 2.0.0 or higher
- Clone or download this repository
- Install the required dependencies:
pip install pygame - Run the game:
python main.py
- Left-click: Select units or buildings
- Left-click and drag: Select multiple units
- Right-click: Move selected units or attack enemy units/buildings
- WASD or Arrow keys: Move camera
- Mouse wheel: Zoom in/out
- ESC: Open game menu
- Resource Gathering: Use worker units to gather gold, wood, and stone
- Base Building: Construct buildings to produce units and research upgrades
- Unit Production: Train different types of units from production buildings
- Combat: Command your units to attack enemy forces and structures
- Economy: Manage your resources to sustain your army and expand your base
- Worker: Gathers resources and constructs buildings
- Soldier: Basic combat unit with balanced stats
- Tank: Heavy combat unit with high health and damage
- Helicopter: Fast aerial unit that can fly over obstacles
- Command Center: Main building, produces workers
- Barracks: Produces soldiers
- Factory: Produces tanks and other vehicles
- Mine: Increases gold production
- Lumber Mill: Increases wood production
The game features a comprehensive economy system where players must gather and manage resources:
- Gold: Used for training units and researching technologies
- Wood: Used for constructing buildings and some units
- Stone: Used for advanced buildings and upgrades
The combat system includes:
- Different attack types (melee, ranged, explosive, siege)
- Different defense types (light, medium, heavy, building)
- Attack and defense modifiers based on type matchups
- Visual effects for attacks and unit destruction
The AI opponent features:
- Multiple difficulty levels
- Adaptive strategy based on game state
- Resource gathering and base expansion
- Military unit production and tactical combat
Units and buildings can store and use items:
- Resource items that can be gathered and stored
- Equipment items that provide bonuses when equipped
- Consumable items with one-time effects
The game allows players to:
- Save their progress at any time
- Load previously saved games
- Autosave functionality to prevent progress loss
main.py: Entry point for the gamecore/: Core game systems and logicgame.py: Main game classmap.py: Map generation and renderingentity_manager.py: Entity managementinput_handler.py: User input processingresource_manager.py: Resource managementcombat_system.py: Combat mechanicseconomy_system.py: Economy mechanicsai_controller.py: AI behavioranimation_system.py: Sprite animationsinventory_system.py: Item managementsave_load_system.py: Game state persistencepathfinding_system.py: Unit movement AIgame_tester.py: Automated testinggame_optimizer.py: Performance optimization
ui/: User interface componentsui_manager.py: UI managementresource_display.py: Resource UIbuilding_menu.py: Building selection UIunit_info_panel.py: Unit information UIcontent_editor_panel.py: Game content editor
data/: Game data filesunits.json: Unit definitionsbuildings.json: Building definitionstransport.json: Transport definitionsitems.json: Item definitions
assets/: Game assetssprites/: Game sprites and images
The game is designed to be easily extendable:
- Add new unit types in
data/units.json - Add new building types in
data/buildings.json - Add new items in
data/items.json - Modify game parameters in
config.json
If you encounter any issues:
- Make sure you have the correct Python and Pygame versions installed
- Check the console for error messages
- Try running the game with the
--debugflag for more information:python main.py --debug
This 2D RTS game was created as a demonstration of game development with Python and Pygame.
This project is available for personal and educational use.