CastleGame is a turn-based strategy game developed in Java, inspired by the classic "Battle for Wesnoth." It features tactical combat with various unit types, each having unique movement, attack, and defense capabilities. Players navigate a randomly generated battlefield with fog of war, line-of-sight mechanics, and resource management through gold-based purchasing.
- Java 21
- Gradle
To build and run the game:
./gradlew build
./gradlew runUnits can move a certain amount of steps. There are different type of units where each has its own attack and defense level. The player can only see enemy units if it's in line of sight. The game features are: a randomly generated game field, fog of war and a battle system.
Its simple to create new games with this code due to the strong "GameController" and the "GUIController" classes.
This game is built in Java using a simple structure to keep things organized.
- Logic: Handles the game rules, like moving units, fighting, and keeping track of players. (Files in
src/logic/) - GUI: Manages the graphics and user interface, like the game board and menus. (Files in
src/gui/) - Controller: Connects the logic and GUI, making sure they work together. (Files in
src/controll/)
- MVC Pattern: Separates the game data (Model), what you see (View), and how they interact (Controller).
- Observer Pattern: The game logic tells the controllers when something happens, like a unit moving.
- Strategy Pattern: Different units (like knights or archers) have their own ways of behaving.
This setup makes it easy to add new features or change how the game looks without breaking other parts.





