A classic 2D role-playing game built with Java featuring medieval fantasy themes, combat mechanics, and exploration 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- Java 17 or higher
- Maven 3.6 or higher
-
Clone the repository:
git clone https://github.com/SEM24/Java-2D-Medieval-RPG.git cd Java-2D-Medieval-RPG -
Build the project:
mvn clean compile
-
Run the game:
mvn exec:java -Dexec.mainClass="com.khomsi.game.GameApplication"
- 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)
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
- 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
The game uses a config.ini file for settings:
- Fullscreen mode toggle
- Music volume (0-10)
- Sound effects volume (0-10)
This project is licensed under the terms specified in the LICENSE file.
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
- Additional enemy types and boss battles
- More complex quest system
- Expanded world areas
- Multiplayer support
- Enhanced graphics and animations