Skip to content

Tboy450/novice-code-rpg-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ‰ Dragon's Lair RPG - A Retro-Style Adventure Game

๐ŸŽฎ 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.

๐Ÿš€ Quick Start (For Everyone!)

๐ŸŽฏ For Complete Beginners

# 1. Download this folder
# 2. Open a command prompt/terminal in this folder
# 3. Run the game:
python main.py

๐Ÿ› ๏ธ For Developers

# Install the game as a package
pip install -e .

# Run the game
python main.py
# or
dragons-lair-rpg

๐Ÿ‰ How to Set the Dragon Folder Icon

Windows Users:

  1. Right-click on the pygame_organized folder
  2. Select "Properties"
  3. Click the "Customize" tab
  4. Click "Change Icon"
  5. Browse to assets/folder_icon.ico in this folder
  6. Click "OK" and "Apply"

macOS/Linux Users:

  • Use assets/folder_icon.png through your file manager's folder properties

๐Ÿ“ฆ Package Features

  • ๐Ÿ‰ 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

๐Ÿ“ File Guide (What Each File Does)

๐Ÿšช main.py - The Game's Front Door

  • 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

๐Ÿ“– README.md - This File (The Manual)

  • What it does: Explains how to use the game and understand the code
  • For beginners: Read this first to understand what everything does

๐Ÿ“‹ TODO.md - What's Being Worked On

  • What it does: Lists current tasks and future improvements
  • For beginners: Shows what features are planned or being fixed

๐ŸŽจ assets/ - Pictures and Icons

  • What it does: Contains the dragon folder icon and related files
  • For beginners: This is where the folder's dragon icon comes from

๐Ÿ—๏ธ build/ - Package Setup Files

  • What it does: Contains files needed to install the game as a package
  • For beginners: You don't need to touch these files

๐Ÿ“š docs/ - Extra Documentation

  • What it does: Contains detailed technical documentation
  • For beginners: Read these if you want to understand the code deeply

๐Ÿงช tests/ - Testing Files

  • What it does: Contains code that tests if the game works correctly
  • For beginners: These help make sure the game doesn't break

๐Ÿ“œ legacy/ - Old Version

  • What it does: Contains the original 5523-line file (for reference)
  • For beginners: This shows how the code looked before it was organized

๐ŸŽฎ Game Folders (config/, core/, world/, entities/, ui/, audio/, systems/, utils/)

  • 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

What This Game Is

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

For Novice Coders

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

Project Structure

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

๐Ÿš€ Quick Start

Installation

# Install the game
pip install dragons-lair-rpg

# Run the game
dragons-lair-rpg

Development Setup

# Clone and install in development mode
git clone <repository-url>
cd pygame_organized
pip install -e .

# Run directly
python main.py

๐Ÿ‰ Folder Icon Setup

The project includes a custom dragon icon for the folder:

Windows

  1. Run the setup script: setup_folder_icon.bat
  2. Or manually:
    • Copy folder_icon.ico to a permanent location
    • Right-click the folder โ†’ Properties โ†’ Customize โ†’ Change Icon
    • Browse to folder_icon.ico

macOS/Linux

  • Use folder_icon.png through your file manager's folder properties

Current Status

๐ŸŽฏ 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.

How to Run

  1. Navigate to the pygame_organized directory
  2. 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.

Module Descriptions

๐Ÿšช Main Entry Point

  • 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.

โš™๏ธ Config Module

  • 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.

๐Ÿง  Core Module

  • 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 Module

  • 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.

๐Ÿ‘ฅ Entities Module

  • 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.

๐Ÿ–ฅ๏ธ UI Module

  • 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.

๐ŸŽต Audio Module

  • music_system.py: Procedural chiptune music generation. The music changes based on what area you're in and what's happening in the game.

โš™๏ธ Systems Module

  • 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.

๐Ÿ› ๏ธ Utils Module

  • android_utils.py: Android-specific utility functions. Detects if the game is running on Android and adjusts controls accordingly.

Features

  • 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

Game Features

  • 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

Controls

  • Arrow Keys/WASD: Movement in overworld
  • Enter/Space: Confirm actions
  • Escape: Menu navigation
  • M: Toggle world map view

For Developers

Adding New Features

To add a new feature:

  1. Create a new module in the appropriate directory
  2. Import it in the relevant existing modules
  3. Update the documentation

Understanding the Code

  • Start with main.py to see how the game starts
  • Look at core/game.py to understand the main game loop
  • Check config/constants.py to see all the game settings
  • Each module has detailed comments explaining what it does

Code Style

  • 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

About

code I'm working on any contribution is appreciated

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published