Skip to content

"Eldoria is a medieval RPG where players battle mobs and navigate a pixel-art fantasy world. Built with Python and Pygame, it features optimized chunk-based rendering for smooth gameplay."

Notifications You must be signed in to change notification settings

GabrielNat1/RPG-Eldoria

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ RPG Eldoria ๐ŸŽฎ

Introduction ๐ŸŒ

RPG Eldoria is a 2D RPG developed in Python using the Pygame library. Inspired by games like Stardew Valley and Dark Souls, the game combines a pixel art visual style with challenging combat and exploration mechanics. Designed to ensure a smooth and accessible experience, the game implements various optimizations and unique features focused on performance and gameplay depth.


Directory Structure ๐Ÿ“‚

The project directory is organized to separate the different parts of the game, such as audio, graphics, and code. Below is an overview of the directory structure:

RPG-ELDORIA/
โ”œโ”€โ”€ audio/                     # Game audio files ๐ŸŽถ
โ”œโ”€โ”€ code/                      # Game source code ๐Ÿ’ป
โ”œโ”€โ”€ docs/                      # Project documentation ๐Ÿ“„
โ”œโ”€โ”€ graphics/                  # Visual assets for the game ๐ŸŽจ
โ”‚   โ”œโ”€โ”€ dialog/                # Dialogue boxes and fonts for NPCs ๐Ÿ—จ๏ธ
โ”‚   โ”œโ”€โ”€ environment/           # Environment elements and map objects ๐ŸŒฟ
โ”‚   โ”œโ”€โ”€ font/                  # Fonts used in the game ๐Ÿ…ฐ๏ธ
โ”‚   โ”œโ”€โ”€ grass/                 # Grass sprites ๐ŸŒพ
โ”‚   โ”œโ”€โ”€ icon/                  # Game icons ๐Ÿ”‘
โ”‚   โ”œโ”€โ”€ monsters/              # Monster and enemy sprites ๐Ÿ‘น
โ”‚   โ”œโ”€โ”€ npc/                   # NPC sprites and animations ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘
โ”‚   โ”œโ”€โ”€ objects/               # Interactive objects in the map ๐Ÿงณ
โ”‚   โ”œโ”€โ”€ particles/             # Particle effects โœจ
โ”‚   โ”œโ”€โ”€ player/                # Player character sprites ๐Ÿง‘โ€๐ŸŽฎ
โ”‚   โ”œโ”€โ”€ run_right/             # Running animation to the right โžก๏ธ
โ”‚   โ”œโ”€โ”€ test/                  # Test resources ๐Ÿงช
โ”‚   โ”œโ”€โ”€ tilemap/               # Map and tilesets ๐Ÿ—บ๏ธ
โ”‚   โ”œโ”€โ”€ ui/                    # User interface elements ๐Ÿ–ฅ๏ธ
โ”œโ”€โ”€ map/                       # Game map files ๐ŸŒ
โ”œโ”€โ”€ weapons/                   # Weapon sprites ๐Ÿน
โ”œโ”€โ”€ warn.txt                   # Game warnings and logs โš ๏ธ
โ”œโ”€โ”€ .gitignore                 # Git ignored files ๐Ÿšซ
โ”œโ”€โ”€ requirements.txt           # List of project dependencies ๐Ÿ“‘


Key Features โš™๏ธ

1. Optimized Chunk System ๐ŸŒฒ

  • Map based on chunks:

    • The world is divided into small areas called chunks.
    • Only chunks near the player are loaded, optimizing performance and reducing memory usage.
    • Explored chunks are temporarily stored in a folder called chunk.
      • After the player exits the game, the folder is automatically cleared.
      • In the future, the save progress feature will be added to preserve explored areas.
    • Dynamic loading: Chunks are loaded automatically as the player approaches new areas.
  • Benefits:

    • Reduces resource usage on lower-spec machines.
    • Decreases overall game loading times.
    • Ensures previously visited areas don't need to be reloaded during the same session.

2. NPC and Quest System ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘

  • NPC Interactions:

    • NPCs are key elements of the game, offering dynamic dialogues with a typing effect for immersion.
    • NPC responses vary depending on the player's progress and accumulated points.
  • Quest System:

    • NPCs assign missions (quests) to the player.
    • Each completed mission grants an exclusive reward, such as:
      • New weapons โš”๏ธ.
      • Rare items ๐ŸŽ.


3. Full Menu System ๐Ÿ–ฅ๏ธ

The main menu offers several customizable options:

  • Performance modes:

    • Optimized: Balances graphics quality and performance.
    • Normal: Standard game configuration.
    • Extreme Performance: For low-performance devices, reducing visual effects for smoother gameplay.
  • Screen settings:

    • Full screen.
    • Borderless window.
    • Manual resolution adjustment.
  • Sound effects:

    • Unique sounds for buttons and interactions in the menu, enhancing the player's experience.
  • Cinematic Intro:

    • Before the game starts, an animated intro tells the backstory of Eldoria, introducing the player to the universe and its challenges.

4. Particle System โœจ

  • Visual Effects:
    • Animated particles for attacks, explosions, spells, and weather effects (such as rain and dust).
    • Optimized effects for different performance modes.

5. Map Creation and Management ๐Ÿ—บ๏ธ

  • Tiled Engine:
    • The game map is designed using the Tiled Map Editor, allowing for:
      • Easy tile editing.
      • Addition of custom layers (such as objects, terrain, and collisions).
    • The chunk system ensures that areas are dynamically loaded:
      • Chunks near the player are rendered.
      • Previously visited areas do not need to be reloaded.

6. Combat and Gameplay โš”๏ธ

  • Dark Souls-inspired style:
    • Challenging battles against enemies and bosses (boss fights).
    • Requires strategy and quick reflexes.
  • Inventory System:
    • Manage items collected throughout the game, such as weapons, potions, and other resources.
    • The inventory allows for equipping weapons and checking quest items.

Technologies Used ๐Ÿ› ๏ธ

  • Python 3.x ๐Ÿ
  • Pygame: For graphical rendering and gameplay control ๐ŸŽฎ.
  • Tiled Map Editor: For map creation and editing ๐Ÿ—บ๏ธ.
  • SQLite (future): For implementing the save system ๐Ÿ’พ.


File Overview ๐Ÿ“‚

Code.py ๐Ÿ“‚

This file is the entry point to the game, containing the main function to initialize and run the game. It also applies the game settings and controls the flow of execution.

code.py/
โ”œโ”€โ”€ debug.py    # Handles debugging features and logs for the game.
โ”œโ”€โ”€ enemy.py    # Contains the logic for enemy behaviors and AI.
โ”œโ”€โ”€ entity.py   # Base class for all entities in the game, including NPCs and players.
โ”œโ”€โ”€ level.py    # Manages the game levels and interactions between entities.
โ”œโ”€โ”€ magic.py    # Handles magical abilities, effects, and spells.
โ”œโ”€โ”€ main.py     # The main script to initialize and run the game.
โ”œโ”€โ”€ npc.py      # Manages NPCs, their dialogue, and quests.
โ”œโ”€โ”€ particles.py# Handles the creation and behavior of particle effects.
โ”œโ”€โ”€ player.py   # Defines the player character, their attributes, and actions.
โ”œโ”€โ”€ settings.py # Configuration file for game settings (resolution, performance modes, etc.).
โ”œโ”€โ”€ support.py  # Provides utility functions to support other modules.
โ”œโ”€โ”€ tile.py     # Manages tiles and map rendering.
โ”œโ”€โ”€ ui.py       # Handles the user interface, including buttons and menus.
โ””โ”€โ”€ upgrade.py  # Handles upgrading systems for player attributes.

Explanation:

The code.py/ folder contains all the essential files for the gameplay mechanics, game flow, and overall functionality. Each file is responsible for specific systems or features that are integral to how the game operates.

  • debug.py ๐Ÿž: Manages debugging tools and logs, which help developers track errors and ensure smooth game development.
  • enemy.py ๐Ÿ‘พ: Contains the logic for enemy behaviors and AI. It determines how enemies react to the player and interact within the game world.
  • entity.py โš™๏ธ: A base class for all entities in the game, such as NPCs and players. This file holds the core properties and methods shared by all entities.
  • level.py ๐Ÿž๏ธ: Manages game levels, including the loading and handling of different areas, and the interactions between entities within these levels.
  • magic.py โœจ: Defines magical abilities, spells, and effects that can be used by the player or enemies to alter the game world and combat dynamics.
  • main.py ๐ŸŽฎ: The entry point to the game. This script initializes and runs the game, managing the game loop and orchestrating the various game systems.
  • npc.py ๐Ÿ—ฃ๏ธ: Manages NPCs, including their behavior, dialogue, and any quests they may give the player, shaping the story and world-building.
  • particles.py ๐ŸŒŸ: Handles particle effects like explosions, sparks, and other visual effects that enhance the game's aesthetic and gameplay.
  • player.py ๐Ÿƒ: Defines the player's character, including attributes, abilities, and actions, determining how the player interacts with the game world.
  • settings.py โš™๏ธ: Contains game configuration options such as resolution, performance modes, and other settings that control how the game runs on different systems.
  • support.py ๐Ÿ› ๏ธ: Provides utility functions that assist other modules by performing repetitive or auxiliary tasks.
  • tile.py ๐Ÿ—บ๏ธ: Manages the gameโ€™s map tiles, including rendering and interactions with the worldโ€™s terrain and obstacles.
  • ui.py ๐Ÿ’ป: Controls the user interface, including menus, buttons, and other interactive elements that the player uses to navigate the game.
  • upgrade.py โฌ†๏ธ: Handles the system for upgrading the player's attributes, such as health, damage, or abilities, allowing for character progression.

These files work together to provide all the necessary mechanics, UI, AI, and configurations that power the game. Each module plays a vital role in making the game function seamlessly.


Graphics.py ๐Ÿ“‚

This directory contains all the visual assets for the game. These resources are dynamically loaded based on gameplay and performance requirements.

# graphics.py/
โ”œโ”€โ”€ # monsters/ # Contains all the visual assets for monsters.
โ”‚   โ”œโ”€โ”€ # bamboo/ # Assets related to the bamboo monster.
โ”‚   โ”œโ”€โ”€ # raccoon/ # Assets related to the raccoon monster.
โ”‚   โ”œโ”€โ”€ # spirit/ # Assets related to the spirit monster.
โ”‚   โ””โ”€โ”€ # squid/ # Assets related to the squid monster.
โ”œโ”€โ”€ # npc/ # Contains visual assets for Non-Playable Characters (NPCs).
โ”‚   โ”œโ”€โ”€ # forger/ # Assets related to the forger NPC.
โ”‚   โ””โ”€โ”€ # oldman/ # Assets related to the oldman NPC.
โ”œโ”€โ”€ # particles/ # Contains visual assets for various particle effects.
โ”‚   โ”œโ”€โ”€ # aura/ # Assets for aura particle effects.
โ”‚   โ”œโ”€โ”€ # bamboo/ # Bamboo particle effects.
โ”‚   โ”œโ”€โ”€ # claw/ # Claw-related particle effects.
โ”‚   โ”œโ”€โ”€ # flame/ # Flame-related particle effects.
โ”‚   โ”œโ”€โ”€ # heal/ # Heal-related particle effects.
โ”‚   โ”œโ”€โ”€ # leaf_attack/ # Leaf attack particle effects.
โ”‚   โ”œโ”€โ”€ # leaf1/ # Various leaf-related particle effects.
โ”‚   โ”œโ”€โ”€ # leaf2/ # More leaf-related particle effects.
โ”‚   โ”œโ”€โ”€ # leaf3/ # More leaf-related particle effects.
โ”‚   โ”œโ”€โ”€ # leaf4/ # More leaf-related particle effects.
โ”‚   โ”œโ”€โ”€ # leaf5/ # More leaf-related particle effects.
โ”‚   โ”œโ”€โ”€ # leaf6/ # More leaf-related particle effects.
โ”‚   โ”œโ”€โ”€ # nova/ # Nova particle effects.
โ”‚   โ”œโ”€โ”€ # raccoon/ # Raccoon-related particle effects.
โ”‚   โ”œโ”€โ”€ # slash/ # Slash-related particle effects.
โ”‚   โ”œโ”€โ”€ # smoke/ # Smoke-related particle effects.
โ”‚   โ”œโ”€โ”€ # smoke_orange/ # Orange smoke particle effects.
โ”‚   โ”œโ”€โ”€ # smoke2/ # Another variation of smoke particle effects.
โ”‚   โ”œโ”€โ”€ # sparkle/ # Sparkle-related particle effects.
โ”‚   โ””โ”€โ”€ # thunder/ # Thunder-related particle effects.
โ”œโ”€โ”€ # player/ # Contains visual assets for the player character's movements and actions.
โ”‚   โ”œโ”€โ”€ # down/ # Downward-facing animations for the player.
โ”‚   โ”œโ”€โ”€ # down_attack/ # Downward-facing attack animations.
โ”‚   โ”œโ”€โ”€ # down_idle/ # Downward-facing idle animations.
โ”‚   โ”œโ”€โ”€ # left/ # Left-facing animations for the player.
โ”‚   โ”œโ”€โ”€ # left_attack/ # Left-facing attack animations.
โ”‚   โ”œโ”€โ”€ # left_idle/ # Left-facing idle animations.
โ”‚   โ”œโ”€โ”€ # right/ # Right-facing animations for the player.
โ”‚   โ”œโ”€โ”€ # right_attack/ # Right-facing attack animations.
โ”‚   โ”œโ”€โ”€ # right_idle/ # Right-facing idle animations.
โ”‚   โ”œโ”€โ”€ # up/ # Upward-facing animations for the player.
โ”‚   โ”œโ”€โ”€ # up_attack/ # Upward-facing attack animations.
โ”‚   โ””โ”€โ”€ # up_idle/ # Upward-facing idle animations.
โ”œโ”€โ”€ # ui/ # Contains visual assets related to the user interface (UI).
โ”‚   โ”œโ”€โ”€ # dialog/ # Dialog-related assets for the UI.
โ”‚   โ””โ”€โ”€ # emote/ # Emote-related assets for the UI.
โ””โ”€โ”€ # weapons/ # Contains visual assets for different weapons in the game.
    โ”œโ”€โ”€ # axe/ # Axe weapon-related assets.
    โ”œโ”€โ”€ # hammer/ # Hammer weapon-related assets.
    โ”œโ”€โ”€ # lance/ # Lance weapon-related assets.
    โ”œโ”€โ”€ # rapier/ # Rapier weapon-related assets.
    โ”œโ”€โ”€ # sai/ # Sai weapon-related assets.
    โ””โ”€โ”€ # sword/ # Sword weapon-related assets.

Explanation:

The graphics.py/ folder is where all the visual assets of the game are stored, categorized by different elements of the game. These include monsters, NPCs, particles, player animations, UI elements, and weapons. Each subfolder contains different sets of images, sprites, or animations that represent various in-game objects or effects.

  • monsters/ ๐ŸงŸ: This folder includes all the visual assets for the monsters you encounter in the game. Each subfolder (like bamboo, raccoon, etc.) contains the specific sprites and animations for each monster type.
  • npc/ ๐Ÿ‘ค: This folder contains assets for NPCs, such as forger and oldman, which play important roles in the story or provide services to the player.
  • particles/ โœจ: Here you'll find assets related to particle effects like healing, smoke, flame, and various attack effects used to enhance the visual experience during combat and interaction.
  • player/ ๐Ÿƒ: Contains the different player animations and sprites for movement and actions (e.g., walking, attacking, idling) in various directions (up, down, left, right).
  • ui/ ๐Ÿ’ป: Holds assets for the user interface, including dialogs and emotes that enhance interactions between the player and the game world.
  • weapons/ โš”๏ธ: Stores the assets for weapon animations such as axe, hammer, sword, and more, which are used during combat.

Each of these folders serves a distinct purpose in the game, providing the necessary visuals for gameplay, interactions, and storytelling.


audio/ Directory ๐ŸŽต This directory contains all the audio files for the game, categorized into attack sounds and menu sounds.

audio/
โ”œโ”€โ”€ attack/ # sounds for attacking
โ”œโ”€โ”€ npc/ # sounds for npc speak
โ””โ”€โ”€ menu/ # sounds sonore for menu

Explanation:

  • attack/: Contains sound files related to the player's and enemies' actions during combat. This includes sounds for various attack types, like sword swings, magic casting, and monster roars. These sounds enhance the combat experience by providing audio feedback to the player.

  • menu/: This section contains sound effects for the user interface. These sounds are played when interacting with the menu, such as button clicks, selections, and background music. These auditory cues contribute to the overall user experience and atmosphere of the game.

  • npc/: This section contains sound effects for the npc dialog. These sounds are played when interacting with the npc.


settings.py ๐Ÿ› ๏ธ

This file contains important configuration settings for the game, including screen resolution, FPS (frames per second), and chunk settings. These settings help optimize the game's performance and user experience.

{
  settings.py: {
    "WIDTH": 1280,
    "HEIGHT": 720,
    "FPS": 60,
    "TILESIZE": 64,
    "CHUNKSIZE": 32,
    "VISIBLE_CHUNKS": 3,
    "CHUNKS_FOLDER": "../chunks"
  }
}

Explanation:

  • WIDTH: Defines the width of the game window in pixels. Set to 1280, which is a standard width for a smooth gaming experience. ๐ŸŒ
  • HEIGHT: Defines the height of the game window in pixels. Set to 720, giving the game a 16:9 aspect ratio. ๐Ÿ“
  • FPS: Specifies the number of frames per second the game should run at. Set to 60 for a smooth visual experience. ๐ŸŽฎ
  • TILESIZE: Defines the size of each tile in the game world. Set to 64 pixels, which provides a good balance between detail and performance. ๐Ÿ”ฒ
  • CHUNKSIZE: The size of each chunk of the game world that is loaded into memory. Set to 32, this determines how much of the world is actively loaded at once. ๐ŸŒ
  • VISIBLE_CHUNKS: The number of chunks that are visible at any given time. Set to 3 to control how many chunks are rendered around the player. ๐Ÿ‘€
  • CHUNKS_FOLDER: This defines the folder where the chunks are stored. The value "../chunks" points to a directory one level up from the game directory. ๐Ÿ“‚

Chunks and Memory Management ๐Ÿ’พ

The game uses chunks to manage the game world and optimize memory usage. As the player moves through the world, chunks that have been explored are stored in memory to prevent reloading them from scratch each time the player returns to an area. This system reduces loading times and prevents lag, allowing the game to run smoothly. ๐Ÿš€

  • Persistent Chunks: As the player progresses, chunks that have been explored and passed through are saved temporarily. These chunks are not reloaded when the player revisits areas they've already explored, which saves memory and ensures a smooth experience when traveling between locations. ๐Ÿ›ฃ๏ธ
  • Deletion on Exit: Once the player exits the game, the stored chunks are deleted. This prevents unnecessary storage usage, as only the active game data is retained during gameplay. ๐Ÿ—‘๏ธ

By managing chunks this way, the game ensures it only loads necessary data into memory, reducing the risk of performance issues or lag. โšก


Game Settings Logic โš™๏ธ

The apply_game_settings function in main.py is responsible for adjusting the game's settings based on the selected performance mode. There are three modes to choose from: optimized, normal, and extreme performance. Each mode changes certain game parameters to ensure the best performance depending on the player's system. โšก๐ŸŽฎ

{
  main.py: {
    "apply_game_settings": {
      "game_mode": "This function adjusts the game settings based on the selected mode: optimized, normal, or extreme performance.",
      "optimized_mode": {
        "TILESIZE": 32,
        "CHUNKSIZE": 16,
        "VISIBLE_CHUNKS": 1,
        "wind_effect_interval": 30000,
        "wind_effect_duration": 5000
      },
      "normal_mode": {
        "TILESIZE": 64,
        "CHUNKSIZE": 32,
        "VISIBLE_CHUNKS": 3,
        "wind_effect_interval": 10000,
        "wind_effect_duration": 5000
      },
      "extreme_mode": {
        "TILESIZE": 128,
        "CHUNKSIZE": 64,
        "VISIBLE_CHUNKS": 6,
        "wind_effect_interval": 10000,
        "wind_effect_duration": 5000
      }
    }
  }
}

Explanation:

  • Tiles Regeneration:

    • In Optimized Mode ๐Ÿž๏ธ, the tile size (TILESIZE) is smaller, and fewer chunks are loaded, which results in fewer resources being used by the game, helping it run smoothly on lower-performance systems. This reduces the visual detail of the environment, but the player still experiences a playable and optimized version of the game.
    • In Normal Mode ๐ŸŽฎ, the tile size and the number of visible chunks are set to medium values. This strikes a balance between performance and visual quality, allowing the game to run well while providing a good level of detail.
    • In Extreme Mode โšก, larger tiles and more visible chunks are rendered, making the game look more detailed but demanding more resources from the system.
  • Wind Effects ๐ŸŒฌ๏ธ:

    • The wind effects, such as their interval (wind_effect_interval) and duration (wind_effect_duration), are also modified depending on the performance mode.
      • In Optimized Mode ๐Ÿ› ๏ธ, the wind effects appear less frequently and last for a shorter duration to reduce the strain on the system.
      • In Normal Mode ๐ŸŒฟ, the wind effects occur more regularly and last a bit longer, balancing performance and realism.
      • In Extreme Mode ๐ŸŒช๏ธ, wind effects are more frequent and longer, adding to the immersive experience with enhanced visual effects.

By adjusting these settings based on the player's choice, the game optimizes its performance, ensuring it can run efficiently on various systems while providing a suitable visual experience for each mode. ๐ŸŒฌ๏ธ๐Ÿ–ฅ๏ธ๐ŸŽฎ

This ensures that the game runs efficiently on various systems while providing an enjoyable experience.



Credits ๐Ÿ’ก

Developed by

  - GabrielNat1
  - ClearCode

Pack Tile used:

  - NinjaAdventurePack

About

"Eldoria is a medieval RPG where players battle mobs and navigate a pixel-art fantasy world. Built with Python and Pygame, it features optimized chunk-based rendering for smooth gameplay."

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages