Skip to content

Add DedicatedServer with web visualizer#384

Merged
zuev93 merged 11 commits intomain-aifrom
feature/world-visualizer
Mar 20, 2026
Merged

Add DedicatedServer with web visualizer#384
zuev93 merged 11 commits intomain-aifrom
feature/world-visualizer

Conversation

@zed-assistant
Copy link

@zed-assistant zed-assistant bot commented Mar 19, 2026

Summary

Screenshot

ONI World Visualizer

Web visualizer showing real game Grid data loaded from ONI DLLs. Sidebar shows display controls, cell inspector, and game state.

What's included

Server (src/DedicatedServer/)

  • WebServer.cs — lightweight HTTP server (HttpListener, port 8080)
    • Static file serving from wwwroot/
    • API endpoints: /api/health, /api/world, /api/entities, /api/state, /api/elements
    • CORS support
  • MockWorldState.cs — generates fake 64x64 ONI world with elements, temperature, mass
  • Program.cs — console entry point with assembly resolution for game DLLs

Web Client (src/DedicatedServer/web-client/)

  • WorldRenderer.ts — Canvas 2D renderer with pan/zoom, cell hover info
  • Overlay modes: element type, temperature heatmap, mass density
  • Entity rendering (duplicants as circles, buildings as squares)
  • Sidebar with controls, cell inspector, entity list
  • Auto-refresh with configurable interval

Build changes

  • Added DedicatedServer to OniMod.sln
  • Updated Directory.Build.targets for SkipAssemblyExposure support

How to run

# Build
dotnet build OniMod.sln -c Debug

# Run with mock data
dotnet run --project src/DedicatedServer -- --mock

# Open http://localhost:8080

Next steps

Phase 2 (feature/game-loader): load real game DLLs, WorldGen, and SimDLL physics.

zed-assistant bot added 8 commits March 19, 2026 13:30
Port the mod to compile against the latest ONI game DLLs (build 21518087).
API changes addressed:
- KObject.GetEventSystem() now returns bool with out parameter
- AccessControl.DefaultPermission → SetDefaultPermission
- SkillListable removed, replaced with IListableOption
- Chore.GetSMI() moved to protected StandardChoreBase, use reflection
- SafeCellMonitor type hierarchy changed (Def instead of object)
- ScheduleGroup constructor gained Color parameter
- PauseScreen.OnQuitConfirm() requires bool saveFirst
- Chore.addToDailyReport/reportType → GetReportType()
- DevTool/DevPanel/DevToolManager not available, excluded via csproj
Adapt test code to ONI API changes:
- PathProber is now static, remove AddComponent<PathProber>()
- Worker renamed to StandardWorker
- MinionConfig.MINION_NAV_GRID_NAME moved to TUNING.DUPLICANTSTATS
…t.Sdk)

Enable dotnet test execution by adding required NuGet packages and
IsTestProject property. Tests now run: 70 pass, 335 fail due to
HarmonyLib mprotect EACCES on macOS ARM64 (W^X security restriction).
Bump OniMinimumSupportedBuild from 577063 to 21518087 to match
the game version this PR was compiled against.
- SensorsPatch: prevent Sensors.Add() from calling sensor.Update() immediately,
  which crashed MingleCellSensor, ClosestEdibleSensor etc. during minion setup
- ScheduleManager: add to test setup so MingleCellSensor.IsAllowed() doesn't NPE
- ChoreConsumerStatePatch: null-safe Schedule resolution in constructor (game
  code bug: GetSchedule() can return null but ctor doesn't check)
- MinionIdentityPatch: suppress Debug.LogError during OnSpawn when Personality
  DB is empty (test environment has no personality data)
- AbstractChoreTest DI: inject ChoreExtensions dependency (was missing,
  causing NPE in chore.Register())
- PlayableGameTest TearDown: comprehensive singleton cleanup (~30 singletons)
  to prevent cross-test contamination
- Unity mock patches: SystemInfo.processorCount, MonoBehaviour stubs,
  Object companion registration
- ChoresPatcher: fix Chore constructor access (became protected),
  handle abstract Cleanup method
…ssion

- Add TestPersonalitiesCsv constant with valid personality entry ("TestDupe")
- Set MinionIdentity.personalityResourceId to match test personality
- Remove MinionIdentityPatch (SuppressErrors hack no longer needed)
- Revert DebugLogHandlerPatch to original behavior (always throw on LogError)
- Revert unnecessary whitespace change in BehaviourPatch
- .NET 4.8 console app with HttpListener web server
- Mock world state: 64x64 grid with ONI elements, temperature, mass
- React + TypeScript + Vite frontend with Canvas 2D renderer
- Three overlay modes: elements, temperature, mass
- Zoom, pan, cell tooltips, entity markers
- API endpoints: /api/world, /api/entities, /api/state
- Vite proxies /api to backend in dev, builds to wwwroot for production
- Skip AssemblyExposure for DedicatedServer project
- Add /decompiled/ to .gitignore (game IP protection)
Copy link
Member

@zuev93 zuev93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really promising!

zed-assistant bot added a commit that referenced this pull request Mar 20, 2026
- Remove compiled wwwroot/assets/ from git (add to .gitignore)
- Update web-client README with actual build/run instructions
- Assets are embedded as resources in DedicatedServer.csproj

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zed-assistant bot added a commit that referenced this pull request Mar 20, 2026
- Remove compiled wwwroot/assets/ from git (add to .gitignore)
- Update web-client README with actual project description

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zed-assistant bot added 2 commits March 20, 2026 09:49
- Remove compiled wwwroot/assets/ from git (add to .gitignore)
- Update web-client README with actual project description
@zed-assistant zed-assistant bot force-pushed the feature/world-visualizer branch from 68ce074 to 8766587 Compare March 20, 2026 08:49
zed-assistant bot added a commit that referenced this pull request Mar 20, 2026
- Remove compiled wwwroot/assets/ from git (add to .gitignore)
- Update web-client README with actual build/run instructions
- Assets are embedded as resources in DedicatedServer.csproj
@zuev93 zuev93 merged commit 038fffe into main-ai Mar 20, 2026
@zuev93 zuev93 deleted the feature/world-visualizer branch March 20, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant