A gamified exploration of Software Design Patterns โ built entirely with programmatic JavaFX.
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.
| 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 core of Pattern Quest. Each pattern is mapped to a specific screen or architectural component.
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 viasetCenter()) - 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.
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.
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.
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.
Real-Time Reactive UI
JavaFX Properties act as the Observable layer:
GameStateproperties (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
OperatorStatsModalwith 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())));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.
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.
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());Requests as Objects
Combat actions in the Dungeon (โ ATTACK, โจ SKILLS, ๐ก DEFEND, ๐ ITEMS) are encapsulated as command objects. Each click:
- Logs the action to the
ConsoleOverlaycommand history - Triggers a
CombatResultModalwith themed feedback - 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.
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 slotCREATE_NEW_SAVEโ Serializes the active session to a new slotCLOUD_SYNCโ Adapts local save format to a remote sync protocolPURGE_SLOTโ Destructive deletion with confirmation guard
Each action routes through the GameFacade to display appropriate confirmation modals.
| 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() |
- JDK 17+ (tested with OpenJDK 25)
- Maven 3.8+ (or use the included
mvnwwrapper)
# 1. Clone the repository
git clone https://github.com/BolaGehad/Pattern-Game.git
# 2. Navigate into the project directory
cd Pattern-Game# Using the Maven wrapper (recommended)
./mvnw clean javafx:run
# Or with a system-installed Maven
mvn clean javafx:runWindows users: Use
mvnw.cmdinstead of./mvnw.
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
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
Bola Gehad โ @BolaGehad
Built with โ Java, ๐ฎ JavaFX, and a deep appreciation for design patterns.
