How anthornet/sc-interactivemap works
Project type and purpose
• This is a client-side, full-stack-light web application (no separate server code in this repo) that provides an interactive 2D map renderer and save-game editor for the game Satisfactory.
• It loads a Satisfactory “.sav” file (remotely or locally), parses it into in-memory game state, and renders that state in a map UI with full editing capabilities via modals, tooltips, context menus, etc.
File structure
• src/SaveParser: Reads and writes the binary .sav file into JavaScript objects.
• src/Models: Contains JSON descriptors for every building, pattern, and vehicle type (static model data).
• src/SubSystem: Implements game-logic subsystems (WorldGrid, GameState, Conveyor networks, Vehicles, Power, etc.).
• src/BaseLayout + src/GameMap + src/SCIM.js: Core rendering engine (built on Leaflet), layout components, entry point.
• src/Modal + src/Selection + src/Spawn: User-interaction layers (dialogs, entity placement, selection, copy/paste).
• webpack.config.js: Bundles all modules, static assets, and JSON models into a single JS/CSS package for the browser.
README for additional insights
• Confirms the project is purely front‐end, intended to run on satisfactory-calculator.com.
• Notes remote save loading via CORS-enabled HTTPS from a dedicated Satisfactory server.
• Mentions high‐level features: rendering, full-featured save editor.
Main components and their interactions
a. Data Input Layer
• User uploads or points to remote .sav → src/SaveParser/Read.js
• External service: HTTPS file hosting (CORS)
b. Domain Model Layer
• Parsed data feeds into SubSystem modules (GameState, WorldGrid, PowerNetwork, ConveyorChainActor, Vehicle, etc.)
• Static metadata (src/Models) is injected to “build” game objects
c. Rendering & Presentation Layer
• GameMap (Leaflet map instance) draws terrain, grid, building overlays
• BaseLayout components (ContextMenu, Tooltip, Polygon, Math, etc.) handle lower-level SVG/Canvas abstractions
d. UI Interaction Layer
• Modal dialogs (src/Modal) for editing properties, game rules, statistics, schematics
• Selection & Spawn tools alter domain state via SubSystem APIs
• FileSaver.js & pako.esm.js export modified .sav back to the user
e. Build & Deployment
• webpack bundles all JS, CSS, JSON into a minified package
• jsconfig.json configures module resolution
Architectural patterns and design principles
• Layered architecture: Input → Domain → Presentation → UI.
• Modular JavaScript: each folder corresponds to a bounded context or feature.
• JSON-driven metadata for easy extensibility (add new Models without code changes).
• Event-driven subsystems: SubSystem/Event dispatches changes to rendering/UI.