๐ฎ A complete Python RPG game with dragon battles, chiptune music, and procedurally generated worlds!
This is a modular version of the Dragon's Lair RPG game, organized into separate packages and modules for better maintainability and code organization. The project is now a proper Python package that can be uploaded and distributed.
# 1. Download this folder
# 2. Open a command prompt/terminal in this folder
# 3. Run the game:
python main.py# Install the game as a package
pip install -e .
# Run the game
python main.py
# or
dragons-lair-rpg- Right-click on the
pygame_organizedfolder - Select "Properties"
- Click the "Customize" tab
- Click "Change Icon"
- Browse to
assets/folder_icon.icoin this folder - Click "OK" and "Apply"
- Use
assets/folder_icon.pngthrough your file manager's folder properties
- ๐ Dragon-themed folder icon - Custom dragon icon for the project folder
- ๐ฆ Upload-ready - Complete Python package structure with setup files
- ๐ฎ Ready to install - Can be installed via pip:
pip install dragons-lair-rpg - ๐ท๏ธ Professional metadata - Proper versioning, licensing, and documentation
- What it does: Starts the game when you run it
- For beginners: This is like the "ON" button for the game
- How to use: Just run
python main.py
- What it does: Explains how to use the game and understand the code
- For beginners: Read this first to understand what everything does
- What it does: Lists current tasks and future improvements
- For beginners: Shows what features are planned or being fixed
- What it does: Contains the dragon folder icon and related files
- For beginners: This is where the folder's dragon icon comes from
- What it does: Contains files needed to install the game as a package
- For beginners: You don't need to touch these files
- What it does: Contains detailed technical documentation
- For beginners: Read these if you want to understand the code deeply
- What it does: Contains code that tests if the game works correctly
- For beginners: These help make sure the game doesn't break
- What it does: Contains the original 5523-line file (for reference)
- For beginners: This shows how the code looked before it was organized
- What they do: Each folder contains a specific part of the game
- For beginners: Think of these like chapters in a book - each chapter has a specific topic
This is a retro-style RPG game built with Python and Pygame. It features:
- A 3x3 world map with different areas (forest, desert, mountain, swamp, volcano, town)
- Turn-based combat with three character classes (Warrior, Mage, Rogue)
- Procedurally generated chiptune music that changes based on where you are
- Particle effects and visual effects
- An opening cutscene and story elements
- Boss battles and a progression system
This project is organized into modules - think of them like chapters in a book:
- Each module has a specific job
- They work together to create the complete game
- This makes the code easier to understand and modify
pygame_organized/
โโโ main.py # ๐ช Main entry point (start the game here)
โโโ README.md # ๐ This documentation file
โโโ TODO.md # ๐ Current to-do list and priorities
โโโ .gitignore # ๐ซ Git ignore rules
โโโ __init__.py # ๐ฆ Package initialization
โโโ build/ # ๐ฆ Build and distribution files
โ โโโ __init__.py
โ โโโ setup.py # ๐๏ธ Package configuration
โ โโโ pyproject.toml # ๐ Modern Python packaging
โ โโโ MANIFEST.in # ๐ Package file inclusion
โ โโโ LICENSE # โ๏ธ MIT license
โ โโโ VERSION # ๐ท๏ธ Version tracking
โ โโโ requirements.txt # ๐ Dependencies
โ โโโ build_package.py # ๐จ Build automation
โโโ docs/ # ๐ Documentation files
โ โโโ __init__.py
โ โโโ PACKAGE_READY.md # โ
Package distribution status
โ โโโ MODULARIZATION_STATUS.md # ๐ Modularization progress
โ โโโ STRUCTURE_COMPLETE.md # โ
Structure completion
โโโ tests/ # ๐งช Test files
โ โโโ __init__.py
โ โโโ test_boss_system.py # ๐ Boss system tests
โ โโโ test_dark_knight.py # โ๏ธ Dark knight tests
โ โโโ test_guard_entities.py # ๐ก๏ธ Guard entity tests
โโโ assets/ # ๐จ Assets and icons
โ โโโ __init__.py
โ โโโ folder_icon.ico # ๐ Windows folder icon
โ โโโ folder_icon.png # ๐ PNG folder icon
โ โโโ dragon_icon.txt # ๐ ASCII dragon art
โ โโโ create_folder_icon.py # ๐จ Icon generation script
โ โโโ setup_folder_icon.bat # โ๏ธ Windows icon setup
โ โโโ desktop.ini # โ๏ธ Windows folder customization
โโโ legacy/ # ๐ Legacy files
โ โโโ __init__.py
โ โโโ organized pycore whole 2.py # ๐ Original 5523-line file
โโโ config/ # โ๏ธ Configuration and constants
โ โโโ __init__.py
โ โโโ constants.py # ๐จ Game constants, colors, fonts
โโโ core/ # ๐ง Core game systems
โ โโโ __init__.py
โ โโโ game.py # ๐ฎ Main Game class (the "brain")
โ โโโ game_events.py # ๐ก Event handling
โ โโโ game_ui.py # ๐ฅ๏ธ UI setup and management
โ โโโ game_state.py # ๐ Game state constants
โ โโโ game_utils.py # ๐ ๏ธ Utility functions
โโโ world/ # ๐ World and area management
โ โโโ __init__.py
โ โโโ world_area.py # ๐๏ธ Individual area management
โ โโโ world_map.py # ๐บ๏ธ 3x3 world grid management
โ โโโ town_layout.py # ๐๏ธ Town layout generation
โโโ entities/ # ๐ฅ Game entities (characters and objects)
โ โโโ __init__.py
โ โโโ enemy.py # ๐น Base enemy class
โ โโโ boss_dragons.py # ๐ Boss dragon classes
โ โโโ item.py # ๐ Item class
โ โโโ dragon.py # ๐ฒ Dragon class
โ โโโ player_characters/ # ๐งโโ๏ธ Player character classes
โ โโโ __init__.py
โ โโโ character.py # ๐ค Base character class
โ โโโ character_actions.py # โ๏ธ Character actions
โ โโโ character_animation.py # ๐ญ Character animations
โ โโโ character_stats.py # ๐ Character stats
โ โโโ warrior.py # โ๏ธ Warrior class
โ โโโ mage.py # ๐งโโ๏ธ Mage class
โ โโโ rogue.py # ๐ก๏ธ Rogue class
โโโ ui/ # ๐ฅ๏ธ User interface components
โ โโโ __init__.py
โ โโโ button.py # ๐ Button UI component
โ โโโ start_screen.py # ๐ Start menu with dragon animations
โ โโโ battle_screen.py # โ๏ธ Battle interface (main)
โ โโโ battle_actions.py # โ๏ธ Battle action logic
โ โโโ battle_effects.py # โจ Battle effects and animations
โ โโโ battle_log.py # ๐ Battle log management
โ โโโ battle_ui.py # ๐ฅ๏ธ Battle UI helpers
โ โโโ opening_cutscene.py # ๐ฌ Story cutscene
โโโ audio/ # ๐ต Audio system
โ โโโ __init__.py
โ โโโ music_system.py # ๐ผ Procedural music generation
โโโ systems/ # โ๏ธ Game systems
โ โโโ __init__.py
โ โโโ particle_system.py # โจ Particle effects
โโโ utils/ # ๐ ๏ธ Utility functions
โโโ __init__.py
โโโ android_utils.py # ๐ฑ Android-specific utilities
# Install the game
pip install dragons-lair-rpg
# Run the game
dragons-lair-rpg# Clone and install in development mode
git clone <repository-url>
cd pygame_organized
pip install -e .
# Run directly
python main.pyThe project includes a custom dragon icon for the folder:
- Run the setup script:
setup_folder_icon.bat - Or manually:
- Copy
folder_icon.icoto a permanent location - Right-click the folder โ Properties โ Customize โ Change Icon
- Browse to
folder_icon.ico
- Copy
- Use
folder_icon.pngthrough your file manager's folder properties
๐ฏ Modularization Progress: 100% Complete
The project has been successfully modularized from a 5523-line monolithic file into a clean, organized structure.
- โ 19/19 classes fully extracted (100%)
- โ 31/31 modules created (100%)
- โ All modules complete and functional
- โ Cross-referenced with main.py and README.md
- โ Character positioning fixed - World coordinate conversion implemented
- โ Town grass fixed - Made grass more dense and larger to look like solid grass instead of particles
- โ Town red dirt texture fixed - Corrected path texture implementation to match original
- โ Town ground base fixed - Added solid ground base color fill for proper solid appearance
- โ Town ground texture enhanced - Added scattered dirt spots for natural texture
- โ Town grass made static - Fixed grass positions to prevent animation/movement
- โ Town background tower spacing fixed - Adjusted tower positions for better visual spacing
- โ Town guard cutscene fixed - Implemented detailed guard cutscene with proper dialogue and animations
- โ Dragon knight guard enhanced - Added dragon-style helmet flares and crest for authentic dragon knight appearance
- โ Item drawing fixed - Proper animations and details for health/mana items
- โ Enemy drawing fixed - Detailed enemy graphics with proper animations and effects
- โ Character visibility improved - Added outlines for better visibility
- โ All game features working - Start screen, cutscene, character selection, overworld
๐ See TODO.md for final testing and cleanup tasks.
- Navigate to the pygame_organized directory
- Run the main.py file:
python main.py
โ Note: All modules have been completed and the game should now be fully functional with the modular structure.
- main.py: The "front door" to the game. This is where you start the game. It's intentionally simple - it just creates a Game object and runs it.
- constants.py: Like a "settings menu" for the entire game. Contains all colors, screen sizes, fonts, and other settings that don't change during gameplay.
- game.py: The "brain" of the game. This is the main Game class that coordinates everything - it manages game states, handles input, updates objects, and draws everything to the screen.
- world_area.py: Manages individual areas in the 3x3 world grid. Each area (forest, desert, town, etc.) has its own terrain, buildings, and visual style.
- world_map.py: Handles the overall world map and area transitions. When you move between areas, this manages the transition.
- character.py: Player character factory - creates Warrior, Mage, or Rogue based on your selection.
- enemy.py: Base enemy class with regular enemy types (fiery, shadow, ice enemies).
- boss_dragons.py: Special boss dragon classes (DragonBoss and BossDragon) with enhanced graphics and abilities.
- dark_knight.py: DarkKnight entity with black armor, red accents, and dark dragon helmet flares.
- guard.py: Original detailed dragon knight guard with complete armor, helmet, sword, and shield.
- item.py: Collectible items in the world (health potions, mana potions).
- dragon.py: Decorative dragon entities used in cutscenes and effects.
- button.py: Reusable button component for menus. Used throughout the game for any clickable elements.
- start_screen.py: Start menu with animated dragon graphics and character selection. This is what you see when you first start the game.
- battle_screen.py: Turn-based combat interface. This handles all the combat mechanics and displays.
- battle_actions.py: Extracted logic for player and enemy actions in battle (attack, magic, items, run).
- battle_effects.py: Extracted logic for battle animations and effects (screen shake, particle effects).
- battle_log.py: Extracted logic for battle log management and message display.
- battle_ui.py: Extracted UI helpers for the battle screen (buttons, health bars, overlays).
- opening_cutscene.py: Story introduction sequence. The cinematic that plays when you start a new game.
- music_system.py: Procedural chiptune music generation. The music changes based on what area you're in and what's happening in the game.
- particle_system.py: Visual effects and particle system. Creates effects like fire, smoke, sparkles, etc.
- boss_system.py: Boss battle management system. Handles boss fight conditions, tracking, and logic.
- android_utils.py: Android-specific utility functions. Detects if the game is running on Android and adjusts controls accordingly.
- Modular Design: Clean separation of concerns with each module handling specific functionality
- Easy Maintenance: Changes to one module don't affect others
- Reusable Components: UI components and systems can be easily reused
- Clear Dependencies: Each module clearly defines its imports and dependencies
- Extensible: New features can be added by creating new modules
- 3x3 world map with different area types (forest, desert, mountain, swamp, volcano, town)
- Turn-based combat system with multiple character classes
- Procedurally generated chiptune music
- Particle effects and visual effects
- Opening cutscene and story elements
- Boss battles and progression system
- Arrow Keys/WASD: Movement in overworld
- Enter/Space: Confirm actions
- Escape: Menu navigation
- M: Toggle world map view
To add a new feature:
- Create a new module in the appropriate directory
- Import it in the relevant existing modules
- Update the documentation
- Start with
main.pyto see how the game starts - Look at
core/game.pyto understand the main game loop - Check
config/constants.pyto see all the game settings - Each module has detailed comments explaining what it does
- All modules have detailed docstrings explaining their purpose
- Functions have clear comments explaining what they do
- Variables have descriptive names
- Constants are defined in
config/constants.py