How adnyropast/nss works
Main Components
• Game Loop & Entry Points:
• Files like index.js, gameStart.js, and gameloops.js serve as entry points and the main loop controller.
• User Input & Controls:
• Game Entities and Actions:
• The entities folder (e.g., PlayableCharacter.js, Enemy.js, Dummy.js) represents the game’s actors.
• The actions directory encapsulates various actions (Jump, Movement, Teleport, etc.) that modify the state or behavior of these entities.
• Rendering & Drawable Components:
• Physics & Interactions:
• The interactions folder includes multiple interaction patterns (AirStateGranter/Receiver, GravityActor/Recipient, etc.) that manage collisions, movement, and physics effects.
• Battle System:
• The battle directory (Battler.js, Move.js) handles the turn-based battle elements described in the README.
• World/Level Data:
• The chapters and maps directories hold level-specific logic and map data (.ttt files) to represent different environments or chapters.
• Utility and Core Framework:
• Assets:
• The images directory organizes all graphical assets like backgrounds, characters, and item images.
Establish Relationships and Interactions
• The core loop (index.js, gameStart.js, gameloops.js) initiates the game, manages update cycles, and directs input events.
• Input from the user (via draft-menu.js and control scripts) is received, then forwarded to update actions (in the actions folder) that affect game entities.
• Entities (in the entities directory) are updated based on both player input and automated interactions (from files in the interactions folder) such as physics responses (gravity, collision, etc.).
• When a battle is triggered, control shifts to the battle module where Battler.js and Move.js orchestrate turn-based combat mechanics.
• Utility libraries provide shared functionality across components (scaling, event handling, etc.), ensuring consistency and keeping the code DRY.
Architectural Patterns and Design Principles
• Modularization: The system is segmented into clear domains (actions, entities, rendering, interactions), each encapsulated in its own directory.
• Separation of Concerns: Input, game logic, rendering, and physics interactions are maintained in separate modules.
• Event-Driven Updates: The use of events and imp interfaces in the util/imps directory suggests an event-driven architecture for object updates and inter-component communication.
Relevant Technologies and Libraries
• JavaScript is the primary language with node package manifest (package.json) indicating common libraries and build scripts.
• Use of CSS (nss.css) and image assets for visual presentation.
• Potential handling of custom file formats (e.g., .ttt maps) to manage level definitions.