MythicalBeast is a lightweight, single‑player RPG built with Java Swing. Players explore a fantasy world, collect monsters, items, and battle through dungeons. The game demonstrates classic OOP principles, a clean Model‑View‑Controller (MVC)‑inspired architecture, and simple persistence via Java object serialization.
- Rich GUI based on
JLayeredPane,CardLayoutandGridBagLayoutfor a responsive, visually appealing interface. - Dynamic Home Base with buttons for Monster, Dungeon, Item, Game Data, and Exit.
- Save / Load system that serializes the entire
Playerobject (including inventory, monsters, and stats). - Modular design – separate packages for
entity,element,item,gamesettings, and each GUI screen. - Extensible – add new monsters, items, or elements by dropping new classes in the corresponding package.
MythicalBeast/
├─ .git/ # Git repository metadata
├─ .gitignore # Ignored files
├─ .vscode/ # VS Code settings (optional)
├─ README.md # 📖 This file
├─ bin/ # Compiled classes (generated by build)
├─ client/ # Saved game files (e.g., 1.txt, 2.txt)
├─ resources/
│ └─ images/ # Backgrounds, monster sprites, item icons
└─ src/
├─ GUI/ # All Swing UI classes (MainGUI, HomeBaseGUI, …)
└─ Model/ # Core game logic and data models
├─ entity/ # Player, Monster
├─ element/ # Elements (Api, Air, Angin, Es, Tanah)
├─ item/ # Item hierarchy (PotionHP, …)
├─ gamesettings/ # Exception handling utilities
└─ gamedata/ # GameData (save/load) and Main entry point
- Java Development Kit (JDK) 8 or newer installed and added to
PATH. - An IDE (IntelliJ IDEA, Eclipse, VS Code) or command‑line tools.
# Clone the repository
cd d:/Coding/MythicalBeast/MythicalBeast
# Compile all source files
javac -d bin $(find src -name "*.java")
# Run the game
java -cp bin Model.MainTip: You can also run the
MainGUIdirectly from your IDE by executingModel.Main.
- Open the project folder in your favorite IDE.
- Mark
srcas the source root. - Set
Model.Mainas the run configuration. - Run – the splash screen appears, press any key to continue to the main menu.
- Model Layer (
src/Model): Holds all game data structures, element definitions, and persistence logic (GameData). - View Layer (
src/GUI): Pure Swing UI; each screen is a separate class extendingJFrameor usingJPanel. - Controller Logic is embedded in the GUI classes via action listeners that manipulate model objects (e.g.,
MainGUIcreates a newHomeBaseGUI).
The separation keeps UI code independent from business rules, making future refactors (e.g., switching to JavaFX) straightforward.
Feel free to fork the repo and submit pull requests.
- Create a feature branch:
git checkout -b feature/awesome‑feature. - Follow the existing package structure.
- Add unit tests (if you add new logic) under a
test/directory. - Run
javacand ensure the game launches without errors. - Submit a PR with a clear description of your changes.
This project is licensed under the MIT License – see the LICENSE file for details.