-
Notifications
You must be signed in to change notification settings - Fork 0
Project Structure
This page provides an overview of the Adventure-Game repository and explains how the project is organized. Understanding the structure of the codebase makes it easier to navigate the project, locate specific systems, and contribute new features.
Adventure-Game follows a modular, object-oriented design where each gameplay system is implemented as its own class or group of related classes. This separation improves readability, maintainability, and scalability as the project continues to grow.
- Overview
- Project Organization
- Core Systems
- Class Responsibilities
- Source Code Organization
- Relationships Between Systems
- Code Design Philosophy
- Future Improvements
Adventure-Game is divided into several independent gameplay systems.
Each system is responsible for a single area of functionality and communicates with other systems through clearly defined interfaces.
Current major systems include:
- Character System
- Inventory System
- Equipment System
- Weapon System
- Armor System
- Potion System
- Chest System
- Save & Load Framework
- Menu System
This modular approach allows new gameplay mechanics to be added without significantly modifying existing code.
The project can be viewed as a collection of interconnected gameplay modules.
Adventure-Game
│
├── Character
├── Inventory
├── Item
├── Weapon
├── Armory
├── Potion
├── Chest
├── Save & Load
├── Menu System
└── Main Game Loop
Each module focuses on a single responsibility while interacting with the others through object-oriented relationships.
The Character class is the center of the project.
It stores:
- Character information
- Statistics
- Equipment
- Inventory
- Active effects
- Gold
- Level progression
Almost every gameplay system interacts with the Character object.
The inventory manages every item owned by the player.
Responsibilities include:
- Adding items
- Removing items
- Displaying inventory
- Dynamic resizing
- Managing unique item IDs
- Interacting with equipment
The inventory automatically expands when additional storage is required.
All usable game objects inherit from the abstract Item class.
Current item types include:
- Weapons
- Armor
- Potions
Using a common base class allows the inventory to store different item types in the same collection.
Responsible for:
- Weapon generation
- Attack values
- Defense bonuses
- Durability
- Enchantments
- Equipment status
Weapons directly influence the player's total attack and defense values.
The armor system manages defensive equipment.
Features include:
- Defense rating
- Durability
- Enchantments
- Equipment status
- Random generation
Armor contributes to the player's total defense.
Potions temporarily or permanently modify player statistics.
Current supported effects include:
- Health
- Strength
- Defense
- Agility
- Intelligence
- Gold
Potions interact directly with the Character class through the active effect system.
The chest system generates randomized loot.
Supported rarity tiers:
- Common
- Rare
- Epic
- Legendary
Each chest contains randomly generated items that can be transferred into the player's inventory.
The project already contains the structure required for persistent game data.
Currently implemented:
- Menu integration
- Save function placeholder
- Load function placeholder
Future versions will serialize:
- Character data
- Equipment
- Inventory
- Active effects
- Game progress
Each major class has a clearly defined purpose.
| Class | Responsibility |
|---|---|
| Character | Stores player information, statistics, equipment, and active effects. |
| MyInventory | Manages the player's item collection using a dynamically resized array. |
| Item | Abstract base class for all item types. |
| Weapon | Represents offensive equipment with durability and enchantments. |
| Armory | Represents defensive equipment with durability and defense values. |
| Potion | Represents consumable items that modify character statistics. |
| Chest | Generates and stores randomized loot for the player. |
This separation follows the Single Responsibility Principle, making each class easier to maintain and extend.
Each gameplay system is implemented independently.
Main Game Loop
│
▼
Character
│
┌──────┼───────────┐
▼ ▼ ▼
Inventory Equipment Effects
│ │
▼ ▼
Items Weapon / Armor
│
├─────────────┐
▼ ▼
Potion Chest
The Character class acts as the central object connecting nearly every gameplay mechanic.
The following diagram illustrates how the primary classes interact.
classDiagram
Item <|-- Weapon
Item <|-- Armory
Item <|-- Potion
Character --> MyInventory
Character --> Weapon
Character --> Armory
Character --> Chest
MyInventory --> Item
Chest --> Item
Potion --> Character
These relationships allow each subsystem to remain relatively independent while still working together.
Adventure-Game follows several important software engineering principles.
The project makes extensive use of:
- Classes
- Objects
- Inheritance
- Polymorphism
- Encapsulation
These concepts reduce duplicated code and improve maintainability.
Every class has a single primary responsibility.
Examples:
- Character stores player data.
- Inventory manages items.
- Weapon represents offensive equipment.
- Potion applies temporary effects.
This design keeps classes focused and easier to understand.
Each gameplay system can be improved independently.
For example:
- Adding a new potion type does not require changing the inventory implementation.
- Adding new weapons does not affect the chest generation logic.
- Expanding the save system does not require redesigning the Character class.
The project has been designed with future expansion in mind.
New systems such as quests, NPCs, skills, crafting, or trading can be added while reusing the existing architecture.
As Adventure-Game continues to grow, the project structure may expand to include additional modules such as:
- Combat System
- Quest System
- NPC System
- Trading System
- Crafting System
- Skill Trees
- Enemy AI
- World Generation
- Dialogue System
- Save File Serialization
The modular architecture allows these features to be introduced without major changes to the existing codebase.
Adventure-Game is organized around independent gameplay systems connected through a central Character object. Each class has a well-defined responsibility, making the project easier to understand, maintain, and extend.
The current architecture provides a solid foundation for future development while demonstrating object-oriented programming principles and clean software design practices in modern C++.