How litance/git-adventure works
Project Type & Purpose
• That this is a client-side, static web game designed as an interactive learning experience.
• RPG elements (character creation, battles, story progression) integrated with Git tutorials.
• Recognize the deployment model is via GitHub Pages — meaning there is no backend server, and it's entirely based on static files.
Main Components
• Entry Point & Frontend:
• index.html acts as the main entry point.
• The css directory (with style.css) handles the styling and layout.
• The js directory houses all the game logic.
• JavaScript Modules (subdividing based on functionality):
• Game Core: js/game.js – orchestrates game state and overall flow.
• User Interface: js/ui.js – manages interactions and UI element updates.
• Audio: js/audio.js – handles game sounds.
• Story & Narrative: js/story.js – controls storyline and dialogue progression.
• Battles: js/battles.js – implements the combat system.
• Characters: js/characters.js – defines player and enemy attributes, possibly character progression.
• Git Command Simulation: js/gitCommands.js – simulates Git commands as game actions.
• Loading & Checks: js/loading-check.js – ensures resources are ready and the game loads correctly.
• Data Persistence:
• localStorage is used to store game progress locally, ensuring that state persists between sessions.
• External Environment:
Relationships & Interactions
• The browser loads index.html, which includes references to the CSS and JavaScript files.
• The UI layer (managed by ui.js) interacts with various game logic modules (game.js, battles.js, characters.js, story.js) to update the screen, handle user inputs, and display game progress.
• The audio.js module is invoked when triggered by events in the game (like battles or story developments).
• The gitCommands.js module translates user actions (picking Git commands) into game mechanics elements, interacting closely with the battle and game logic modules.
• using localStorage, changes made by these components (like game progress) are persisted.
Important Architectural Patterns & Design Principles
• Modular Design – each JavaScript file encapsulates a distinct aspect of the game, making it easier to extend functionality.
• Separation of Concerns – the structure clearly separates UI, game logic, audio, and data persistence.
• Client-Side Rendering – all components run on the client, which simplifies the architecture but requires careful handling of game state on the client side.
• From index.html to CSS and JS.
• From UI module to Game Logic and then to Battle or Story modules.
• From various game modules toward localStorage for saving progress.
• Another for business logic modules,
• And a distinct style for external services (GitHub Pages) and storage components.
Detail Without Overcomplicating
• Break the system into as many granular components as necessary based on the file tree.