Skip to content

A classic 2D role-playing game built with Java featuring medieval fantasy themes, combat mechanics, and exploration gameplay.

License

Notifications You must be signed in to change notification settings

starsentry/java_medieval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tiny Adventure - Java 2D Medieval RPG

A classic 2D role-playing game built with Java featuring medieval fantasy themes, combat mechanics, and exploration gameplay.

Снимок экрана 2023-09-15 192637 Снимок экрана 2023-09-15 192744

🎮 Game Features

Core Gameplay

  • Character System: Choose between male and female characters with customizable stats
  • Combat Mechanics: Real-time combat with weapons, shields, and magic spells
  • Inventory Management: Collect and manage weapons, armor, consumables, and special items
  • Leveling System: Gain experience points and level up to increase stats
  • Save/Load System: Persistent game progress with configurable settings

World & Exploration

  • Multiple Areas: Explore outdoor environments, indoor locations, dungeons, and boss arenas
  • Interactive Objects: Doors, chests, switches, and environmental puzzles
  • NPCs: Meet various characters including merchants, quest givers, and tutorial guides
  • Day/Night Cycle: Dynamic lighting system with time progression

Combat & Enemies

  • Enemy Types: Fight against various creatures including:
    • Orcs (melee fighters)
    • Slimes (basic enemies)
    • Mushrooms (magical creatures)
    • Bats (flying enemies)
    • Mimics (treasure chest enemies)
    • Boss enemies with multiple phases
  • Combat Features:
    • Attack animations and hit detection
    • Guard/blocking mechanics
    • Knockback effects
    • Magic spells and projectiles

Equipment & Items

  • Weapons: Swords, axes, and hooks with different attack values
  • Shields: Metal and gold shields providing defense bonuses
  • Consumables: Potions, hearts, and mana restoration items
  • Special Items: Keys, lanterns, magic necklaces, and other utility items

🛠️ Technical Details

Technology Stack

  • Language: Java 17
  • Build Tool: Maven
  • UI Framework: Java Swing with FlatLaf look and feel
  • Graphics: 2D sprite-based rendering with custom tile system
  • Audio: WAV sound files for music and sound effects

Game Architecture

  • Screen Resolution: 960x576 pixels (20x12 tiles at 48px each)
  • Tile System: 16x16 pixel tiles scaled 3x for modern displays
  • Game Loop: 60 FPS with separate update and render cycles
  • State Management: Multiple game states (play, pause, dialogue, inventory, etc.)
  • Pathfinding: AI pathfinding system for enemy movement

Key Components

  • GameManager: Main game controller and state management
  • Entity System: Base class for all game objects (player, NPCs, enemies, items)
  • TileManager: Handles world rendering and collision detection
  • Sound System: Music and sound effect management
  • UI System: User interface for inventory, dialogue, and game menus
  • Save System: Serializable data persistence

🎯 Game States

  • Start State: Game initialization
  • Tutorial State: Learning the controls
  • Title State: Main menu
  • Play State: Active gameplay
  • Pause State: Game paused
  • Dialogue State: NPC conversations
  • Character State: Character/inventory management
  • Options State: Settings menu
  • Game Over State: Death screen
  • Transition State: Area transitions
  • Trade State: Merchant interactions
  • Sleep State: Rest mechanics
  • Map State: World map view
  • Cutscene State: Story sequences

🎵 Audio Features

  • Background Music: Multiple themed tracks for different areas
  • Sound Effects: Combat sounds, environmental audio, and UI feedback
  • Volume Controls: Separate music and sound effect volume settings
  • Audio Formats: WAV files for high-quality audio

🎨 Art & Assets

  • Sprite Animations: Multi-frame animations for characters and enemies
  • Tile Graphics: Hand-crafted pixel art tileset
  • Character Sprites: Detailed character animations for walking, attacking, and idle states
  • UI Elements: Custom interface graphics and icons
  • Environmental Art: Varied landscapes and dungeon environments

🚀 Getting Started

Prerequisites

  • Java 17 or higher
  • Maven 3.6 or higher

Installation

  1. Clone the repository:

    git clone https://github.com/SEM24/Java-2D-Medieval-RPG.git
    cd Java-2D-Medieval-RPG
  2. Build the project:

    mvn clean compile
  3. Run the game:

    mvn exec:java -Dexec.mainClass="com.khomsi.game.GameApplication"

Controls

  • Arrow Keys: Move character
  • Enter: Attack/Interact
  • Space: Guard/Block
  • Shift: Run (when available)
  • Escape: Pause game
  • I: Open inventory
  • M: Open map (when available)

📁 Project Structure

src/main/java/com/khomsi/game/
├── GameApplication.java          # Main entry point
├── main/
│   ├── GameManager.java         # Core game logic
│   ├── tools/                   # Utility classes
│   └── logic/                   # Game logic systems
├── entity/                      # Game entities
│   ├── player/                  # Player character
│   ├── mobs/                    # Enemy creatures
│   └── npc/                     # Non-player characters
├── objects/                     # Interactive objects
├── tiles/                       # Tile system
├── data/                        # Save/load system
└── ai/                          # AI and pathfinding

🎮 Gameplay Tips

  • Explore thoroughly to find hidden items and secrets
  • Manage your inventory wisely - some items are stackable
  • Use different weapons for different situations
  • Guard against enemy attacks to reduce damage
  • Save your game regularly at checkpoints
  • Talk to NPCs for quests and story information

🔧 Configuration

The game uses a config.ini file for settings:

  • Fullscreen mode toggle
  • Music volume (0-10)
  • Sound effects volume (0-10)

📝 License

This project is licensed under the terms specified in the LICENSE file.

🤝 Contributing

Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.

🎯 Future Enhancements

  • Additional enemy types and boss battles
  • More complex quest system
  • Expanded world areas
  • Multiplayer support
  • Enhanced graphics and animations

About

A classic 2D role-playing game built with Java featuring medieval fantasy themes, combat mechanics, and exploration gameplay.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages