You are viewing a potentially older version of this package. View all versions.
Suite-DSP_Planner_Export-1.9.0 icon

DSP Planner Export

Serves live game state to the DSP Ultimate Suite planner over localhost: research, production rates, blueprint protos — plus an in-game advisor & deficit HUD.

Date uploaded 2 weeks ago
Version 1.9.0
Download link Suite-DSP_Planner_Export-1.9.0.zip
Downloads 35
Dependency string Suite-DSP_Planner_Export-1.9.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

DSP Planner Export (BepInEx plugin)

Serves live game state from a running Dyson Sphere Program game over a small localhost HTTP server, so the DSP Resource Tree Planner (dsp-ultimate-suite.html) can show a live view. Three endpoints:

GET http://localhost:8765/state    researched tech / upgrade levels
{ "version":1, "running":true,
  "states":[ {"id":1131,"level":1,"max":1,"unlocked":true},
             {"id":2101,"level":4,"max":6,"unlocked":true} ] }

GET http://localhost:8765/protos   full item proto dump (static, built once)
{ "version":2, "items":[
  {"id":1101,"name":"Iron Ingot","grid":1101},
  {"id":2303,"name":"Assembling Machine Mk.I","grid":2404,"model":65,
   "w":3,"h":3,"zstep":5.05,"slots":[3,3,3,3]}, ... ] }

GET http://localhost:8765/rates    cumulative production/consumption counters
{ "version":1, "running":true, "gameTick":123456,
  "items":[ {"id":1101,"p":12345,"c":678}, ... ] }
  • /state: id is the in-game TechProto id. Leveled upgrades report level (curLevel); the planner expands consecutive ids per level using FactorioLab's id map.
  • /protos: every item gets id/name/grid (inventory grid index); buildings additionally get model (modelIndex), w/h (blueprint footprint in cells from prefabDesc.blueprintBoxSize), zstep (vertical offset per stacked level, prefabDesc.lapJoint.y) and slots (per-side sorter slot counts [N,E,S,W] from prefabDesc.slotPoses). The mapper's "Load protos (plugin)" button consumes this for exact blueprint export.
  • /rates: counters accumulate across all factories since plugin load via a Harmony prefix on FactoryProductionStat.GameTick, which reads productRegister/consumeRegister just before the game folds and zeroes them (the same approach the BetterStats mod uses). The planner polls twice and computes items/min from deltas: rate = Δcount / Δtick × 3600 (60 ticks/s). The planner's Plan vs actual card does this automatically.

Prerequisites

  • BepInEx 5.x installed into Dyson Sphere Program (the usual DSP modding setup).
  • .NET SDK to build (dotnet build), or open the .csproj in Visual Studio / Rider.

Build

BepInEx and HarmonyX are restored from the official BepInEx NuGet feed (nuget.config points at https://nuget.bepinex.dev/v3/index.json) — they are compile-time references only; the game's BepInEx install provides them at runtime. The only machine-specific path is the game install (for Assembly-CSharp.dll and the Unity 2022.3 engine assemblies, which have no NuGet package):

  1. Edit DSPManaged in DSPPlannerExport.csproj to match your install, or pass it on the command line:
    dotnet build -c Release -p:DSPManaged="C:\...\Dyson Sphere Program\DSPGAME_Data\Managed"
    
  2. Copy the resulting bin\Release\DSPPlannerExport.dll into …\Dyson Sphere Program\BepInEx\plugins\.
  3. Launch the game. The BepInEx console log should show: DSP Planner Export: serving http://localhost:8765/state, /protos, /rates

Publishing to Thunderstore

The plugin ships on Thunderstore as Suite/DSP_Planner_Export (community dyson-sphere-program). Publishing is a local, one-command step — it can't run in CI because the build needs the game's Assembly-CSharp.dll, which a runner doesn't have.

One-time setup:

  1. Restore the CLI (pinned in .config/dotnet-tools.json): dotnet tool restore — invoked as dotnet tcli. (publish.ps1 runs the restore for you.)
  2. Get a service-account token: thunderstore.io → the Suite team → Service AccountsAdd service account → copy the token. (tcli is stateless — no login / credential store — so the token is supplied per publish; the script sources it for you.)
  3. Save it once to Windows Credential Manager:
    pwsh ./publish.ps1 -SaveToken     # prompts for the token (hidden), stores it encrypted
    
    It's kept under your Windows account (DPAPI-encrypted at rest, target DSPPlannerExport:ThunderstoreToken — visible in Control Panel → Credential Manager → Windows Credentials), outside the repo. publish.ps1 then reads it automatically — no pasting. Resolution order: $env:TCLI_AUTH_TOKEN (for CI / op run) → Credential Manager → a one-off secure prompt if neither is set. Treat the token like a release key; to rotate it, re-run -SaveToken.

Each release:

  1. Bump VERSION in Plugin.cs (single source of truth — flows to the csproj manifest and the Thunderstore version_number). Thunderstore versions are immutable and must strictly increase, so re-publishing the same number fails.
  2. From this folder: pwsh ./publish.ps1 — builds the DLL, packages the Thunderstore zip (thunderstore.toml + icon.png + README.md + the DLL under BepInEx/plugins/…), and uploads it via tcli. Use pwsh ./publish.ps1 -DryRun to build + package only (inspect ./build/*.zip) without uploading.

The package metadata lives in thunderstore.toml; icon.png (256×256) is the listing icon and is committed so every publish reuses it. Keep this in step with the web release: when the app ships a version that changes the live-link contract, bump + publish the plugin too.

Use with the planner

  1. Open dsp-ultimate-suite.html.
  2. Research tab → Live: on polls /state every ~3 s and repaints the trees as you research in-game. (While Live is on, manual ticks are overwritten on each poll.)
  3. Planner tab → Plan vs actual → Live: on polls /rates every 3 s and compares the plan's computed per-item rates with what your factories actually produce and consume (needs two samples before the first numbers appear).
  4. Mapper tab → Load protos (plugin) pulls /protos for exact model indices, footprints, z-steps and sorter slots when exporting blueprints.

In-game HUD & advisor (T99)

The optional overlay (toggle with F8) draws live deficits and — when [Advisor] Enabled — a "Upgrades available" section listing researched building tiers worth switching to (e.g. Conveyor Belt MK.II researched). It mirrors the planner's 💡 Advisor. Configure which kinds appear in the BepInEx config (live-reloaded):

  • [Advisor] Enabled — master toggle for the advisor section.
  • [Advisor] Belts / Sorters / Machines / Proliferator — pick which recommendations show.
  • [Advisor] DismissKey (default F9) — hide the current tips; each returns only when a still-newer tier unlocks (dismissals are remembered in [Advisor] Acknowledged).

The advisor flags the highest unlocked tier above the base in each family (belts, sorters, assemblers/smelters/chemical plants/miners, proliferator) — Dark-Fog-only tiers are excluded.

Notes / troubleshooting

  • The page is file://, fetching http://localhost — allowed because the plugin sends Access-Control-Allow-Origin: *. No HTTPS issues since the page isn't HTTPS.
  • If the listener fails to start, another app may hold port 8765, or Windows needs a URL ACL. Either change Port in Plugin.cs, or run once as administrator.
  • Game API used: GameMain.history.{techStates,ItemUnlocked}, TechState.{unlocked,curLevel,maxLevel}, LDB.items/models, PrefabDesc.{blueprintBoxSize,lapJoint,slotPoses}, FactoryProductionStat.{GameTick,productRegister,consumeRegister}, GameMain.gameTick. All verified to compile against the current build (Unity 2022.3.62, 2026-06). If a future patch renames them, the compiler will point at the exact spot — the planner side needs no change.
  • The HTTP thread never touches Unity objects: the main thread refreshes JSON snapshots ~once per second and the listener just serves the latest strings (thread-safe).
  • /rates counters reset when the plugin reloads; the planner detects the tick going backwards and re-seeds automatically.