How nicejjss/dots works
Main Components
• Game Entry Point: index.html serves as the starting point for the game.
• Assets: This includes the “assests” directory used for styles (CSS) and audio (music). Also note the “view/assests” duplication that organizes assets for the view layer.
• Model: Contains files like Model.js and Player.js which store game state and persist data similarly to Laravel models.
• View: Contains HTML files (gameStart.html, gamePlay.html, gamePause.html, gameOver.html) along with corresponding CSS and JavaScript that render each game scene.
• Controller: Organized into subdirectories for managing game logic:
• GameManager.js handles overarching game control.
• The “scene” folder holds the different scene controllers (GameStartScene.js, GamePlayScene.js, etc.).
• The “dot” and “music” subdirectories manage specific game elements, leveraging static methods via the Singleton pattern.
• Traits: Contains shared behavior (e.g., SceneTraits.js) to be used across various components.
• Constants and Configuration: constants.js manages game constants and configuration values.
Relationships and Interactions
• The Entry Point (index.html) initializes the game and invokes the GameManager.
• The GameManager in the Controller acts as the mediator between Model and View:
• It receives user input (clicks/interactions) on the View.
• It updates and retrieves game state from the Model.
• It transitions between different game scenes (Start, Play, Pause, GameOver) by invoking appropriate Scene controllers.
• The View layer is in charge of rendering visual components:
• HTML and CSS define the layout and style.
• JavaScript in the view (found under view/assests/js) handles UI interactions before delegating control to the Controller.
• The Controller’s “music” subdirectory manages audio playback:
• The design must respect Google’s policy regarding background music (no autoplay unless user interaction occurs).
• Use Dependency Injection where needed to provide controllers with model instances or configuration values. This will help in unit testing and make the system more modular.
Architectural Patterns and Technologies
• MVP (Model – View – Presenter/Controller): The system clearly separates data management (Model) from UI (View) and logic/control (Controller).
• Singleton and Static Methods: Controllers use the singleton pattern to ensure a single point of control for game management.
• OOP Principles: The project leverages object-oriented design for reusable and modular code across scenes, music components, and game elements.
• Dependency Injection: As mentioned in the README, plan for a DI strategy to decouple components.
• Branch out to show the View layer (with distinct nodes for the various game scene HTML files and associated CSS/JS).
• Controller to the Model layer, indicating that game data is stored and manipulated in the Model.
• An Assets node representing external resources like CSS and Audio, linking it to the View and Controller as needed.
• Optionally, include annotations or legends that indicate the use of Singleton patterns, dependency injection, and adherence to Google’s audio policies.