| Menu Screen | Gameplay |
|
|
Java RPG Adventure is a 2D top-down RPG built from scratch in Java, using only the standard Java libraries.
This project is primarily a learning project. Its main goal is to strengthen my Java knowledge while learning the fundamentals of game development: game loops, rendering, input handling, collision detection, tile-based worlds, and game states. All implemented manually, without relying on abstractions provided by an engine.
The project is being developed incrementally, starting from core systems and gradually expanding into a complete RPG.
I am developing this project to:
- Improve my Java programming skills through a larger, practical project.
- Better understand object-oriented programming and software architecture.
- Learn how game loops, rendering, input handling, collision detection, and game states work.
- Explore the fundamentals of 2D game development.
- Practice building systems from scratch using Java's standard libraries.
- Gradually experiment with and implement my own ideas and mechanics.
Rather than using a game engine to abstract away the underlying systems, I want to understand what happens behind those abstractions and gain practical experience implementing game mechanics directly in Java.
- 🪟 Game window and game loop
- ⌨️ Keyboard input
- 🚶 Player movement
- 🖼️ Sprite rendering
- 🧱 Tile-based world
- 🎥 Camera system
- 💥 Collision detection
- 📦 Objects and object interaction
- 🎵 Background music and sound effects
- 🔄 Game states (title, play, pause, dialogue)
- 🧾 Basic UI
- 🗺️ World map loading from files
More systems and mechanics will be added as development continues.
- Java
- Java Swing — window, panels and rendering surface
- Java AWT (
Graphics2D,Rectangle,BufferedImage,KeyListener, etc.) — 2D rendering, input handling and geometry - Java ImageIO (
javax.imageio.ImageIO) — loading sprites and tile images - Java Sound API (
javax.sound.sampled) — background music and sound effects - Git
No game engine or external game development framework is used, everything is built with Java's standard libraries.
- Practiced implementing a game loop from scratch using delta time.
- Learned how to structure a 2D game using object-oriented programming.
- Implemented tile-based world rendering and a camera system tied to the player.
- Studied collision detection between the player, tiles, and objects.
- Built a basic entity system shared between the player and NPCs.
- Implemented game state management (title, play, pause, dialogue).
- Learned how to handle keyboard input in Swing applications.
- Practiced loading world/map data from external files.
- Explored audio playback (music and sound effects) in Java.
- Strengthened my understanding of software architecture in a non-trivial project.
- Java JRE/JDK 8 or higher installed
The easiest way to try the game is to download the compiled .jar file from the Releases page and run it with:
java -jar java-rpg-adventure.jar- Clone the repository:
git clone https://github.com/Cauebf/java-rpg-adventure.git cd java-rpg-adventure - Compile the project (from the source folder):
javac -d out src/main/*.java src/entity/*.java src/object/*.java src/tile/*.java
- Run the compiled game:
java -cp out main.Main
💡 Tip: adjust the paths above to match your actual package/folder structure if it differs.
This project is heavily inspired by RyiSnow's excellent How to Make a 2D Game in Java YouTube series.
The series has been an important reference for learning how to structure a 2D game in Java and understanding concepts such as game loops, rendering, tiles, cameras, collision detection, objects, sound, UI, and game states.
- Creator: RyiSnow
- YouTube: RyiSnow
- Playlist: How to Make a 2D Game in Java
This is primarily a personal study project, but suggestions and feedback are welcome! If you find a bug, have an improvement idea, or want to suggest a new mechanic, feel free to:
- Open an issue.
- Submit a pull request.
- Suggest improvements to existing systems.
When contributing, try to keep the code simple, readable, and aligned with the project's learning-focused nature.
For inquiries or collaboration, reach out via:

