How dtom-ass/rok_combat_game works
1. Overall shape
- This is a Java turn-based combat game built around an MVC split.
- The repo currently contains two presentation paths: a legacy console view and an in-progress JavaFX GUI migration.
- The architecture centers on a small domain model, a set of controllers that drive game flow, and scene-based UI screens.
2. Application entry and bootstrap
- app/Main.java is the main application entry point in the tree.
- The README also mentions a JavaFX test launcher (view/GUI/guitest.java) used during migration, but the file tree shows the GUI work now lives under src/view/scenes and src/controller.
- JavaFX dependencies are vendored locally in lib/, which means the runtime is part of the repository’s operational boundary.
3. Domain model boundary
- src/model contains the game’s core data and combat entities.
- Warrior.java and Culture.java look like the two foundational abstractions: one for combat units, one for faction/selection context.
- Concrete implementations are organized under:
- src/model/Warriors/ for unit types such as Archer, Fighter, Healer, Lancer, Tank
- src/model/Cultures/ for faction variants such as AztecaCulture, IncaCulture, MayaCulture, MuiscaCulture
- This suggests the game builds combatants by combining a culture and a warrior type, with stats/abilities encoded in subclasses.
4. Game flow controllers
- src/controller is the orchestration layer between UI and model.
- SelectionController likely handles initial choice of culture/warrior and feeds the selection into the game state.
- BattleController likely owns turn resolution, attack/heal actions, and win/loss checks.
- PlayerController and PlayerPanel suggest a split between player-specific logic and UI-facing state handling.
- EnemyBot is the AI/opponent decision layer and is part of the battle subsystem rather than the model.
5. Battle subsystem
- The combat loop is probably centered in BattleController, which mediates turns between player and EnemyBot.
- The battle logic depends on the domain objects in model and emits state updates to the view.
- Because the project is turn-based, the controller layer is the critical boundary where domain state changes are validated and propagated to the UI.
6. Scene-based GUI structure
- src/view/scenes contains the JavaFX screens that make up the user journey:
- WelcomeScene
- SelectionScene
- BattleScene
- EndScene
- This indicates a screen-driven flow rather than a single-page UI.
- Each scene likely maps to a distinct phase of the game: start, choose units, fight, then final result.
7. UI components and presentation helpers
- src/controller/indicators/stats.java suggests a small UI helper for showing combat statistics.
- PlayerPanel likely renders player state in the battle screen.
- These components sit at the boundary between controller state and visible scene content, translating model values into screen elements.
8. Legacy console path
- src/view/console/ConsoleLog.java shows the original console interface still exists.
- The README states the console version remains functional while the JavaFX migration proceeds.
- Architecturally, this means the project preserves the combat/game logic while swapping presentation layers, which is a classic MVC migration pattern.
9. Styling and JavaFX assets
- Each scene has its own stylesheet under src/view/scenes/styles/:
- welcome.css
- Selection.css
- Battle.css
- End.css
- Styling is separated from scene logic, so visual design is controlled independently from flow/control code.
10. Data flow through the game
- The expected flow is: app launch → welcome screen → selection screen → battle screen → end screen.
- Player choices are captured by SelectionController, converted into model objects, then consumed by BattleController.
- During combat, state changes from the model are pushed back into scene components like PlayerPanel and stats indicators, while EnemyBot supplies opponent actions.
11. External/runtime dependencies
- The only material external technology here is JavaFX, packaged locally in lib/.
- The .vscode launch config in the README implies the app is run with explicit module-path and JavaFX module flags, so the GUI runtime setup is part of the project’s architecture rather than an external service.
12. Architecture takeaway for diagramming
- Draw three main layers: model at the bottom, controllers in the middle, and views/scenes at the top.
- Show a parallel console view path alongside the JavaFX scenes to reflect the migration state.
- Emphasize the game’s phase-based UI flow and the battle loop, since those are the core runtime behaviors of the repository.
Main entry points: BattleController.java BattleCtrl · SelectionController.java SelectionCtrl · lib JavaFX Lib · WelcomeScene.java Welcome
Components 17
Model
Core combat entities and faction types
Controllers
Game flow, battle orchestration, and UI-state bridging
- SelectionCtrl · Handles initial player choices
src/controller/SelectionController.java - BattleCtrl · Runs turn resolution and combat flow
src/controller/BattleController.java - PlayerCtrl · Player-facing game state coordination
src/controller/PlayerController.java - EnemyBot · Opponent decision layer
src/controller/EnemyBot.java - PlayerPanel · Battle UI state and player display
src/controller/PlayerPanel.java - Stats · Combat statistics indicator helper
src/controller/indicators/stats.java
Views
JavaFX scenes and legacy console presentation
- Welcome · Start screen
src/view/scenes/WelcomeScene.java - Selection · Culture and warrior selection screen
src/view/scenes/SelectionScene.java - Battle · Turn-based combat screen
src/view/scenes/BattleScene.java - End · Result screen
src/view/scenes/EndScene.java - Console · Console presentation path
src/view/console/ConsoleLog.java
Connections 20
- Main → Welcome: launches · Starts the scene-driven UI flow
- Main → Console: also supports · Legacy console presentation path
- Welcome → Selection: next · Moves from start to selection
- Selection → SelectionCtrl: captures input · User choices are handled by controller
- SelectionCtrl → Culture: creates · Builds selected faction context
- SelectionCtrl → Warrior: creates · Builds selected combat unit
- SelectionCtrl → BattleCtrl: starts battle · Hands chosen state into combat flow
- Culture → Cultures: implemented by · Concrete culture variants
- Warrior → Warriors: implemented by · Concrete warrior variants
- BattleCtrl → PlayerCtrl: coordinates · Delegates player-side state handling
- BattleCtrl → EnemyBot: opposes · Uses AI opponent decisions
- BattleCtrl → Battle: updates · Pushes combat state to the UI
- PlayerCtrl → PlayerPanel: renders · Feeds player state into battle panel
- PlayerPanel → Stats: shows · Displays combat statistics
- Battle → End: finishes to · Transitions after combat ends
- Welcome → JavaFX Lib: runs on · JavaFX scene runtime
- Selection → JavaFX Lib: runs on · JavaFX scene runtime
- Battle → JavaFX Lib: runs on · JavaFX scene runtime
- End → JavaFX Lib: runs on · JavaFX scene runtime
- Console → BattleCtrl: reuses · Shares combat/game logic through MVC boundary