Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โš”๏ธ PATTERN QUEST

A gamified exploration of Software Design Patterns โ€” built entirely with programmatic JavaFX.

Java 23+ JavaFX Maven No FXML Design Patterns License

Main Menu


๐Ÿ“ก About the Project

Pattern Quest is a pure Java/JavaFX desktop application that transforms the study of Software Engineering Design Patterns from abstract UML diagrams into a fully interactive, visually immersive experience.

Every screen in the application is a living implementation of a GoF (Gang of Four) Design Pattern โ€” not just a demonstration, but a production-grade UI component that you can click, drag, configure, and navigate.

๐ŸŽจ Architectural Philosophy

Principle Implementation
16-bit Retro-Brutalist Cyberpunk Deep black backgrounds (#111111), crisp 1px borders (#CCCCCC), neon green accents (#00FF41), heavy solid drop shadows
Strictly FLAT UI Zero 3D bevels. Zero gradients on controls. Square corners everywhere.
100% Programmatic UI Every pixel is placed via Java code โ€” new VBox(), new HBox(), setStyle(). Zero FXML files.
Reactive State JavaFX Property bindings (bindBidirectional) drive all UI updates. No manual refresh cycles.
CRT Post-Processing Every screen features a scanline canvas overlay for authentic retro atmosphere.

"Why read about the Builder Pattern when you can literally build a cyberpunk hero with it?"


๐Ÿงฌ The 10 Design Patterns

The core of Pattern Quest. Each pattern is mapped to a specific screen or architectural component.

๐Ÿ—๏ธ 1. Facade โ€” ViewManager (GameFacade)

The Central Orchestrator

GameFacade.java acts as the single entry point for all navigation and overlay management. It hides the complexity of a three-layer StackPane architecture:

  • Layer 0 โ€” BorderPane baseLayer (active screen via setCenter())
  • Layer 1 โ€” StackPane overlayLayer (modals, pause menu, weapon stats)
  • Layer 2 โ€” StackPane consoleLayer (developer console drawer)
// One call to navigate โ€” the Facade handles layer cleanup,
// overlay dismissal, and screen instantiation internally.
GameFacade.getInstance().navigateToDungeon();

All 8+ screens and 6+ modals route through this single class. No screen knows about any other screen.


๐Ÿ”„ 2. State โ€” Pause Menu / UI State Management

Context-Aware Mode Switching

The AppModeState interface and its implementations (BootingState, ActiveState) manage global application mode transitions. The Pause Menu overlay transitions the application between active gameplay and an interrupted state without logic duplication.

BOOTING โ†’ ACTIVE โ†’ PAUSED โ†’ ACTIVE โ†’ ...

Each state defines its own onEnter(), onExit(), and handleInput() behavior.


๐Ÿ”จ 3. Builder โ€” BuilderLabScreen

Step-by-Step Hero Assembly

The Builder Lab allows step-by-step construction of a complex Hero object:

Step Control Options
Hero Class ComboBox WARRIOR_PROTOCOL, STEALTH_ASSASSIN, ARCANE_MAGE
Primary Armament ComboBox IRON_CLAYMORE, PLASMA_WHIP, VOID_DAGGER
Armor Coating ComboBox LEATHER_CHASSIS, HEAVY_TITANIUM, SHADOW_CLOAK
Stats Slider ร—3 STR, AGI, INT (0โ€“100, auto-derives HP/MP)

All selections are bound to PlayerSessionManager and persist across navigation. Clicking FINALIZE_HERO executes the HeroBuilder.build() chain.


๐ŸŽฏ 4. Strategy โ€” StrategyTrainingScreen

Runtime Algorithm Swapping

The Training Arena lets users dynamically swap combat algorithms at runtime:

  • โš”๏ธ Melee Protocol โ€” High damage, close range
  • ๐Ÿ—ก๏ธ Stealth Protocol โ€” Critical multipliers, evasion bonuses
  • ๐Ÿ”ฎ Arcane Protocol โ€” Area damage, mana cost scaling

The active strategy determines damage calculations, animation styles, and combat log output โ€” all without conditional branching in the combat engine.


๐Ÿ‘๏ธ 5. Observer โ€” DungeonScreen & AchievementHall

Real-Time Reactive UI

JavaFX Properties act as the Observable layer:

  • GameState properties (bootProgress, cpuLoad, memAlloc) fire change events
  • HP bars, XP bars, and combat log entries update reactively via property listeners
  • The Achievement Hall's STATS button triggers OperatorStatsModal with live session telemetry
  • Toast notifications propagate from global events to any active screen
session.hpPoolProperty().addListener((obs, old, val) ->
    hpLabel.setText(String.valueOf(val.intValue())));

๐Ÿงช 6. Prototype โ€” CloningScreen

Clone, Don't Instantiate

The Cloning Bay visually represents the Prototype pattern: duplicating an existing entity's configuration (memory mapping, core uploads, DNA sequences) rather than constructing from scratch.

Features an animated chamber visualization, source/target entity panels, and confirmation dialogs for clone initiation and abort.


๐Ÿ”ง 7. Decorator โ€” DecoratorForgeScreen & WeaponStatsModal

Dynamic Behavior Wrapping

The Forge allows runtime decoration of base weapon components:

Base: VOID_REAPER (ATK: 120)
  + Fire Rune Decorator    โ†’ ATK: +45 ๐Ÿ”ฅ
  + Shadow Rune Decorator  โ†’ CRIT: +12% ๐ŸŒ‘
  = Final: ATK 165, CRIT 12%

The WeaponStatsModal renders the delta calculation between base and decorated stats in real-time, showing exactly how each decorator layer contributes.


๐Ÿ‘‘ 8. Singleton โ€” GameState & SettingsManager

One Instance, Global Truth

Three critical singletons ensure consistent state across all 39 source files:

Singleton Responsibility Properties
SettingsManager Engine config (audio, display, controls) 8 JavaFX Properties
PlayerSessionManager Hero config, stats, session data 9 Properties + 3 ObservableLists
GameState Boot progress, telemetry, app mode 4 Properties + State Pattern context
// Guaranteed single instance across entire application
SettingsManager.getInstance().masterVolumeProperty()
    .bindBidirectional(slider.valueProperty());

๐Ÿ“‹ 9. Command โ€” Main Menu & Combat Actions

Requests as Objects

Combat actions in the Dungeon (โš” ATTACK, โœจ SKILLS, ๐Ÿ›ก DEFEND, ๐Ÿ“‹ ITEMS) are encapsulated as command objects. Each click:

  1. Logs the action to the ConsoleOverlay command history
  2. Triggers a CombatResultModal with themed feedback
  3. Can be queued, undone, or replayed

The Main Menu buttons (START NEW JOURNEY, CONTINUE LEGEND, QUIT GAME) follow the same pattern โ€” QUIT triggers a ConfirmActionModal before executing.


๐Ÿ’พ 10. Adapter (+ Memento) โ€” AdapterStorageScreen

Interface Translation & State Snapshots

The Storage terminal adapts between different save data formats:

  • LOAD_SNAPSHOT โ€” Restores a previous game state (Memento)
  • OVERWRITE โ€” Writes current session to an existing slot
  • CREATE_NEW_SAVE โ€” Serializes the active session to a new slot
  • CLOUD_SYNC โ€” Adapts local save format to a remote sync protocol
  • PURGE_SLOT โ€” Destructive deletion with confirmation guard

Each action routes through the GameFacade to display appropriate confirmation modals.


๐Ÿ› ๏ธ Tech Stack

Technology Purpose
Java 23+ Core language (Project compiled with OpenJDK 25)
JavaFX 23 UI framework โ€” 100% programmatic, zero FXML
Maven Build tool & dependency management
CSS Custom retro-brutalist theme (retro-cyber.css)
JavaFX Properties Reactive state management via bindBidirectional()

๐Ÿš€ Getting Started

Prerequisites

  • JDK 17+ (tested with OpenJDK 25)
  • Maven 3.8+ (or use the included mvnw wrapper)

Installation

# 1. Clone the repository
git clone https://github.com/BolaGehad/Pattern-Game.git

# 2. Navigate into the project directory
cd Pattern-Game

Running the App

# Using the Maven wrapper (recommended)
./mvnw clean javafx:run

# Or with a system-installed Maven
mvn clean javafx:run

Windows users: Use mvnw.cmd instead of ./mvnw.


๐Ÿ“‚ Folder Structure

Pattern-Game/
โ”œโ”€โ”€ src/main/java/com/patternquest/
โ”‚   โ”œโ”€โ”€ Main.java
โ”‚   โ”œโ”€โ”€ engine/
โ”‚   โ”‚   โ”œโ”€โ”€ GameFacade.java              # Facade โ€” Central orchestrator
โ”‚   โ”‚   โ””โ”€โ”€ ScreenType.java             # Screen routing enum
โ”‚   โ”œโ”€โ”€ state/
โ”‚   โ”‚   โ”œโ”€โ”€ GameState.java               # Singleton โ€” Global state
โ”‚   โ”‚   โ”œโ”€โ”€ SettingsManager.java         # Singleton โ€” Engine settings
โ”‚   โ”‚   โ”œโ”€โ”€ PlayerSessionManager.java    # Singleton โ€” Player session
โ”‚   โ”‚   โ””โ”€โ”€ app/
โ”‚   โ”‚       โ”œโ”€โ”€ AppModeState.java        # State โ€” Interface
โ”‚   โ”‚       โ””โ”€โ”€ BootingState.java        # State โ€” Boot mode
โ”‚   โ”œโ”€โ”€ ui/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ TopNavBar.java           # Global navigation bar
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SideNavBar.java          # Sidebar navigation
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ConsoleOverlay.java      # Command โ€” Console drawer
โ”‚   โ”‚   โ””โ”€โ”€ screens/
โ”‚   โ”‚       โ”œโ”€โ”€ BootScreen.java          # Animated boot sequence
โ”‚   โ”‚       โ”œโ”€โ”€ MainMenuScreen.java      # Command โ€” Main menu
โ”‚   โ”‚       โ”œโ”€โ”€ BuilderLabScreen.java    # Builder โ€” Hero assembly
โ”‚   โ”‚       โ”œโ”€โ”€ StrategyTrainingScreen.java  # Strategy โ€” Algorithm swap
โ”‚   โ”‚       โ”œโ”€โ”€ DungeonScreen.java       # Observer โ€” Combat arena
โ”‚   โ”‚       โ”œโ”€โ”€ CloningScreen.java       # Prototype โ€” Entity cloning
โ”‚   โ”‚       โ”œโ”€โ”€ DecoratorForgeScreen.java # Decorator โ€” Weapon forge
โ”‚   โ”‚       โ”œโ”€โ”€ AdapterStorageScreen.java # Adapter โ€” Save management
โ”‚   โ”‚       โ”œโ”€โ”€ AchievementHallScreen.java   # Observer โ€” Stats
โ”‚   โ”‚       โ”œโ”€โ”€ EngineSettingsModal.java  # Multi-tab settings
โ”‚   โ”‚       โ”œโ”€โ”€ WeaponStatsModal.java    # Decorator โ€” Stat deltas
โ”‚   โ”‚       โ”œโ”€โ”€ ConfirmActionModal.java  # Confirmation dialogs
โ”‚   โ”‚       โ”œโ”€โ”€ CombatResultModal.java   # Combat feedback
โ”‚   โ”‚       โ”œโ”€โ”€ CloudSyncModal.java      # Sync animation
โ”‚   โ”‚       โ”œโ”€โ”€ HelpModal.java           # Keybinding reference
โ”‚   โ”‚       โ”œโ”€โ”€ OperatorStatsModal.java  # Session telemetry
โ”‚   โ”‚       โ””โ”€โ”€ PauseMenuScreen.java     # State โ€” Pause overlay
โ”‚   โ””โ”€โ”€ util/
โ”‚       โ””โ”€โ”€ ResourceLoader.java          # Local asset loading
โ”œโ”€โ”€ src/main/resources/com/patternquest/
โ”‚   โ”œโ”€โ”€ css/retro-cyber.css              # Brutalist theme stylesheet
โ”‚   โ””โ”€โ”€ images/                          # All local image assets
โ”œโ”€โ”€ pom.xml                              # Maven build configuration
โ””โ”€โ”€ mvnw / mvnw.cmd                      # Maven wrapper scripts

๐ŸŽฎ Screen Navigation Map

BOOT SEQ โ”€โ”€> MAIN MENU
                โ”‚
                โ”œโ”€โ”€ START NEW โ”€โ”€> BUILDER LAB โ”€โ”€> DUNGEON
                โ”œโ”€โ”€ CONTINUE  โ”€โ”€> BUILDER LAB        โ”‚
                โ”œโ”€โ”€ HALL      โ”€โ”€> ACHIEVEMENT HALL    โ”‚
                โ”œโ”€โ”€ SETTINGS  โ”€โ”€> SETTINGS MODAL      โ”‚
                โ””โ”€โ”€ QUIT      โ”€โ”€> CONFIRM MODAL       v
                                  STRATEGY <โ”€โ”€> CLONING
                                  FORGE    <โ”€โ”€> STORAGE

๐Ÿง‘โ€๐Ÿ’ป Author

Bola Gehad โ€” @BolaGehad


Built with โ˜• Java, ๐ŸŽฎ JavaFX, and a deep appreciation for design patterns.

About

Pattern Quest - JavaFX top-down RPG built around 10 GoF design patterns. Spike-trap dungeons, lich king graveyard, gamepad support.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages