How tamari-moto/tollroad works
Purpose and Runtime
TollRoad is a Godot 4.7.1+ economic-simulation game prototype. Godot loads project settings from project.godot and starts the main gameplay scene at scenes/main/Main.tscn. It is a local client game; the repository indicates no backend, network service, or third-party API integration.
Application Composition
The main scene and its controller assemble gameplay UI and route player actions into game systems:
• scenes/main/Main.tscn
• scenes/main/main.gd
The scene-oriented design separates reusable UI layouts under scenes/ui/ from their behavior scripts under scripts/ui/.
Global State and Session Lifecycle
GameState is the autoload-level global coordination boundary, likely exposing shared state to scene/UI code. Session orchestration owns the active run, progression, and scenario setup; saving is isolated from gameplay logic:
• scripts/autoload/game_state.gd
• scripts/systems/game_session.gd
• scripts/systems/save_manager.gd
Flow: startup initializes global/session state, selects or starts a scenario, then UI commands mutate the session through systems rather than owning core simulation state.
Economic Domain Model
Game data and pricing are distinct system layers. Static/domain definitions are centralized in game_data.gd; price evaluation is isolated in price_table.gd, enabling market UI and scenario logic to consume common pricing results:
• scripts/systems/game_data.gd
• scripts/systems/price_table.gd
• data/
This boundary is the core economic flow: game/session state plus scenario conditions feed pricing, which drives buying, selling, cargo, and outcome evaluation.
Scenario Engine
A base scenario abstraction supports a catalog of mission/month-specific scenarios, with an aggregate selector/runner:
• scripts/systems/scenario_base.gd
• scripts/systems/scenario_all.gd
• scripts/systems/scenario_m1.gd
• scripts/systems/scenario_m19.gd
Scenarios define the controlled variation layer over shared simulation systems: briefing/objectives, starting conditions, progression constraints, and success/failure results.
Player-Facing Interaction Surfaces
Panel scenes represent the primary transaction and planning workflows: inspect cargo, choose islands/routes, view markets, operate workshops, and read objectives. Their scripts are the presentation adapter layer over session/economy APIs:
• scenes/ui/CargoPanel.tscn, scripts/ui/cargo_panel.gd
• scenes/ui/MarketPanel.tscn, scripts/ui/market_panel.gd
• scenes/ui/WorkshopPanel.tscn, scripts/ui/workshop_panel.gd
• scenes/ui/IslandPanel.tscn, scripts/ui/island_panel.gd
• scenes/ui/MemoPanel.tscn, scripts/ui/memo_panel.gd
Map, Feedback, and Results
Map controls/rendering are separate from market/session logic, while dialogs frame scenario start and completion. Shared visual/audio feedback utilities support UI without becoming domain dependencies:
• scenes/ui/MapPanel.tscn, scripts/ui/map_panel.gd, scripts/ui/map_view_3d.gd
• scenes/ui/BriefingDialog.tscn, scripts/ui/briefing_dialog.gd
• scenes/ui/ResultDialog.tscn, scripts/ui/result_dialog.gd
• scripts/ui/fx_layer.gd, scripts/ui/sfx.gd
Visual content is packaged as Godot-imported assets, notably city, island, item, and mount sprites under assets/sprites/.
Components 18
Godot Runtime
- Project Bootstrap · Loads settings and opens the main scene.
project.godot - Main Scene
scenes/main/Main.tscn - Main Controller · Composes gameplay UI and routes player actions.
scenes/main/main.gd
Game Systems
- GameState · Global coordination boundary for scenes and UI.
scripts/autoload/game_state.gd - Game Session · Owns the active run and progression.
scripts/systems/game_session.gd - Save Manager · Keeps saving separate from gameplay logic.
scripts/systems/save_manager.gd - Game Data · Centralizes static economic definitions.
scripts/systems/game_data.gd - Price Table · Evaluates shared market prices.
scripts/systems/price_table.gd - Game Data Files
Scenario Engine
- Scenario Base
scripts/systems/scenario_base.gd - Scenario Catalog · Selects and aggregates mission scenarios.
scripts/systems/scenario_all.gd - Mission Scenarios · Month-specific starting conditions, objectives, and outcomes.
scripts/systems/scenario_m1.gd
Player UI
- Transaction Panels · Cargo, market, workshop, island, and memo workflows.
- Map UI · Separates route/map rendering from session logic.
scenes/ui/MapPanel.tscn - Briefing Dialog
scenes/ui/BriefingDialog.tscn - Result Dialog
scenes/ui/ResultDialog.tscn - FX and SFX · Shared visual and audio feedback.
scripts/ui/fx_layer.gd - Sprite Assets · City, island, item, and mount visual content.
Connections 22
- Project Bootstrap → Main Scene: starts
- Main Scene → Main Controller: uses
- Main Controller → GameState: coordinates through
- GameState → Game Session: holds active session
- Game Session → Save Manager: saves and restores
- Game Session → Scenario Catalog: selects scenario
- Scenario Catalog → Scenario Base: extends
- Mission Scenarios → Scenario Base: implements
- Scenario Catalog → Mission Scenarios: runs
- Game Data Files → Game Data: defines
- Game Data → Price Table: supplies goods data
- Game Session → Price Table: supplies state and conditions
- Mission Scenarios → Game Session: configures run
- Main Controller → Transaction Panels: hosts
- Transaction Panels → Game Session: submits actions
- Transaction Panels → Price Table: shows prices
- Main Controller → Map UI: hosts
- Map UI → Game Session: plans routes
- Game Session → Briefing Dialog: presents objectives
- Game Session → Result Dialog: presents outcome
- Transaction Panels → FX and SFX: triggers
- Map UI → Sprite Assets: renders