[PR #251] [MERGED] kb: Cities: Skylines 1 read-only live city dashboard (HTTP server inside a C# mod, Linux, mcs) + example #253

Closed
opened 2026-10-15 20:54:49 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rehan-remade/universal-modder/pull/251
Author: @GustavoHSCruz
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @rehan-remade

Base: main ← Head: kb/cities-skylines-city-dashboard


📝 Commits (3)

  • d22820a kb: Cities: Skylines 1 read-only live city dashboard (HTTP server inside a C# mod, Linux, mcs) + example
  • f7d7e96 kb: cities-skylines dashboard: review fixes
  • bf887e3 Merge remote-tracking branch 'origin/main' into resolve/pr-251

📊 Changes

21 files changed (+3719 additions, -2 deletions)

View changed files

📝 AGENTS.md (+2 -1)
➕ examples/cities-skylines-city-dashboard/.gitignore (+2 -0)
➕ examples/cities-skylines-city-dashboard/README.md (+143 -0)
➕ examples/cities-skylines-city-dashboard/build.sh (+34 -0)
➕ examples/cities-skylines-city-dashboard/media/charts.png (+0 -0)
➕ examples/cities-skylines-city-dashboard/media/city.png (+0 -0)
➕ examples/cities-skylines-city-dashboard/media/day-and-night.png (+0 -0)
➕ examples/cities-skylines-city-dashboard/media/deathcare-reach.png (+0 -0)
➕ examples/cities-skylines-city-dashboard/mod/CityDashboard.cs (+1145 -0)
➕ examples/cities-skylines-city-dashboard/remove.sh (+8 -0)
➕ examples/cities-skylines-city-dashboard/tools/mock_game.py (+340 -0)
➕ examples/cities-skylines-city-dashboard/web/src/1-nucleo.js (+238 -0)
➕ examples/cities-skylines-city-dashboard/web/src/2-mapa.js (+407 -0)
➕ examples/cities-skylines-city-dashboard/web/src/3-regras.js (+230 -0)
➕ examples/cities-skylines-city-dashboard/web/src/35-telas.js (+163 -0)
➕ examples/cities-skylines-city-dashboard/web/src/4-visoes.js (+493 -0)
➕ examples/cities-skylines-city-dashboard/web/src/base.html (+49 -0)
➕ examples/cities-skylines-city-dashboard/web/src/estilo.css (+207 -0)
📝 knowledge/INDEX.md (+2 -1)
➕ knowledge/games/cities-skylines/read-only-live-city-dashboard-for-cities-skylines-1-an-http-.md (+215 -0)

...and 1 more files

📄 Description

A second field note for Cities: Skylines (the existing one maps the APIs and containers and says no mod was built) plus a worked example: a read-only mod that serves a live browser dashboard of the running city.

What the note records

  • Route: the supported IUserMod API, compiled on Linux with plain mcs against the game's assemblies. No Unity editor, no Harmony, nothing patched.
  • Mod loading: the mod class is instantiated even while disabled, so it can enable itself; FindPluginInfo skips disabled plugins; overwriting the DLL in a running game does nothing.
  • Threads: main thread versus simulation thread, SimulationManager.AddAction (runs even while paused), and the measured cost of collecting a 9,600-building map on each.
  • Where the numbers are: district 0 as the whole city, units, coverage at a point through ImmaterialResourceManager, the natural resource grid, zone-block geometry, road segments as Bézier curves, service vehicles, the budget-to-capacity curve, day/night budgets, engine limits.
  • 12 gotchas, among them: a second city in the same process breaks a modded session (reproduced without this mod); Player.log is truncated on every start; core dumps from the Steam runtime container do not unwind on the host.

What the example contains (examples/cities-skylines-city-dashboard)

  • mod/CityDashboard.cs: the mod (a TcpListener HTTP responder, on-demand collection on the simulation thread, weekly history, day/night sampler).
  • web/src/: the page (canvas map, info views, advisor rules, full-screen charts, day/night budget advice).
  • tools/mock_game.py: serves the page against a synthetic city in the same wire format, so it opens without the game. The screenshots come from it.
  • build.sh / remove.sh. The game's assemblies are referenced at compile time and never copied.

Honesty

  • Status is in-progress, not working: on the machine it was built on, the game aborted one second into a save with the mod installed and a never-saved city was lost. Three scripted save runs with the same DLL did not reproduce it, the cause is unknown, and the mod is not cleared. The note's Gotcha 1 and the example README say so up front.
  • Verified in the real game on the native Linux Steam build 1.21.1-f9 only. Not verified: Windows, macOS, Epic, districts and transport lines with a real city that has them.
  • Identifiers and the JSON wire format are Portuguese (the mod was written for a Brazilian player); the interface, comments and messages are English. The README has a glossary.

Checks

  • um kb check <note> and um kb check --index: pass (183 notes).
  • um publish check examples/cities-skylines-city-dashboard --game <install>: pass, 17 files, 0 warnings.
  • um publish check .: 0 failures (the 2 warnings are in existing notes).
  • uv run --with pytest pytest -q tests: 99 passed, 1 skipped.

Also adds the example to the "Worked examples" line in AGENTS.md.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rehan-remade/universal-modder/pull/251 **Author:** [@GustavoHSCruz](https://github.com/GustavoHSCruz) **Created:** 10/12/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@rehan-remade](https://github.com/rehan-remade) **Base:** `main` ← **Head:** `kb/cities-skylines-city-dashboard` --- ### 📝 Commits (3) - [`d22820a`](https://github.com/rehan-remade/universal-modder/commit/d22820ab66b23318aabbf0b02b02f29fc845b482) kb: Cities: Skylines 1 read-only live city dashboard (HTTP server inside a C# mod, Linux, mcs) + example - [`f7d7e96`](https://github.com/rehan-remade/universal-modder/commit/f7d7e96742c66d0d7c1fea5169e8d3b4c679a13f) kb: cities-skylines dashboard: review fixes - [`bf887e3`](https://github.com/rehan-remade/universal-modder/commit/bf887e3b91a64b30f5944e37148f9241fd02b982) Merge remote-tracking branch 'origin/main' into resolve/pr-251 ### 📊 Changes **21 files changed** (+3719 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+2 -1) ➕ `examples/cities-skylines-city-dashboard/.gitignore` (+2 -0) ➕ `examples/cities-skylines-city-dashboard/README.md` (+143 -0) ➕ `examples/cities-skylines-city-dashboard/build.sh` (+34 -0) ➕ `examples/cities-skylines-city-dashboard/media/charts.png` (+0 -0) ➕ `examples/cities-skylines-city-dashboard/media/city.png` (+0 -0) ➕ `examples/cities-skylines-city-dashboard/media/day-and-night.png` (+0 -0) ➕ `examples/cities-skylines-city-dashboard/media/deathcare-reach.png` (+0 -0) ➕ `examples/cities-skylines-city-dashboard/mod/CityDashboard.cs` (+1145 -0) ➕ `examples/cities-skylines-city-dashboard/remove.sh` (+8 -0) ➕ `examples/cities-skylines-city-dashboard/tools/mock_game.py` (+340 -0) ➕ `examples/cities-skylines-city-dashboard/web/src/1-nucleo.js` (+238 -0) ➕ `examples/cities-skylines-city-dashboard/web/src/2-mapa.js` (+407 -0) ➕ `examples/cities-skylines-city-dashboard/web/src/3-regras.js` (+230 -0) ➕ `examples/cities-skylines-city-dashboard/web/src/35-telas.js` (+163 -0) ➕ `examples/cities-skylines-city-dashboard/web/src/4-visoes.js` (+493 -0) ➕ `examples/cities-skylines-city-dashboard/web/src/base.html` (+49 -0) ➕ `examples/cities-skylines-city-dashboard/web/src/estilo.css` (+207 -0) 📝 `knowledge/INDEX.md` (+2 -1) ➕ `knowledge/games/cities-skylines/read-only-live-city-dashboard-for-cities-skylines-1-an-http-.md` (+215 -0) _...and 1 more files_ </details> ### 📄 Description A second field note for **Cities: Skylines** (the existing one maps the APIs and containers and says no mod was built) plus a worked example: a read-only mod that serves a live browser dashboard of the running city. ## What the note records - **Route:** the supported `IUserMod` API, compiled on Linux with plain `mcs` against the game's assemblies. No Unity editor, no Harmony, nothing patched. - **Mod loading:** the mod class is instantiated even while disabled, so it can enable itself; `FindPluginInfo` skips disabled plugins; overwriting the DLL in a running game does nothing. - **Threads:** main thread versus simulation thread, `SimulationManager.AddAction` (runs even while paused), and the measured cost of collecting a 9,600-building map on each. - **Where the numbers are:** district 0 as the whole city, units, coverage at a point through `ImmaterialResourceManager`, the natural resource grid, zone-block geometry, road segments as Bézier curves, service vehicles, the budget-to-capacity curve, day/night budgets, engine limits. - **12 gotchas**, among them: a second city in the same process breaks a modded session (reproduced without this mod); `Player.log` is truncated on every start; core dumps from the Steam runtime container do not unwind on the host. ## What the example contains (`examples/cities-skylines-city-dashboard`) - `mod/CityDashboard.cs`: the mod (a `TcpListener` HTTP responder, on-demand collection on the simulation thread, weekly history, day/night sampler). - `web/src/`: the page (canvas map, info views, advisor rules, full-screen charts, day/night budget advice). - `tools/mock_game.py`: serves the page against a **synthetic city** in the same wire format, so it opens without the game. The screenshots come from it. - `build.sh` / `remove.sh`. The game's assemblies are referenced at compile time and never copied. ## Honesty - Status is `in-progress`, not `working`: on the machine it was built on, the game **aborted one second into a save with the mod installed and a never-saved city was lost**. Three scripted save runs with the same DLL did not reproduce it, the cause is unknown, and the mod is not cleared. The note's Gotcha 1 and the example README say so up front. - Verified in the real game on the native Linux Steam build 1.21.1-f9 only. Not verified: Windows, macOS, Epic, districts and transport lines with a real city that has them. - Identifiers and the JSON wire format are Portuguese (the mod was written for a Brazilian player); the interface, comments and messages are English. The README has a glossary. ## Checks - `um kb check <note>` and `um kb check --index`: pass (183 notes). - `um publish check examples/cities-skylines-city-dashboard --game <install>`: pass, 17 files, 0 warnings. - `um publish check .`: 0 failures (the 2 warnings are in existing notes). - `uv run --with pytest pytest -q tests`: 99 passed, 1 skipped. Also adds the example to the "Worked examples" line in `AGENTS.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 20:54:49 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rehan-remade/universal-modder#253
No description provided.