Skip to content

Add Protogen Systems Docking Solutions - #361

Merged
viktor-ferenczi merged 4 commits into
StarCpt:mainfrom
ryancrimsonrd-ux:add-protogen-docking-solutions
Nov 18, 2026
Merged

viktor-ferenczi merged 4 commits into
StarCpt:mainfrom
ryancrimsonrd-ux:add-protogen-docking-solutions

Conversation

@ryancrimsonrd-ux

@ryancrimsonrd-ux ryancrimsonrd-ux commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Adds Protogen Systems Docking Solutions 1.2.1, a client plugin that helps with docking: a full-screen dock camera on the connector's face with guidance, a movable picture-in-picture dock camera, and the "DOCK - Docking Assist" LCD script. It also offers a mod message API so other plugins and mods can show the docking pictures.

  • Source: https://github.com/ryancrimsonrd-ux/ProtogenDockingSolutions (MIT)
  • Commit: c92d2a6560dd0b4088c9b62c709626c848540d9f (1.2.1: the review fixes, plus pausing in creative tools, admin mode, spectator and AFK, and a fix for a crash after a Build Info world)
  • Runtimes: CLR, CoreCLR (Legacy and Interim)
  • Client-side only, with no network calls. Settings are stored under the game's UserData Storage folder.
  • Harmony patches use their own IDs, and unpatching only removes this plugin's patches.
  • The picture-in-picture publicizes VRage.Render and VRage.Render11 (declared in ClientPlugin/GameAssembliesToPublicize.cs).

🤖 Generated with Claude Code

@viktor-ferenczi viktor-ferenczi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review: Protogen Systems Docking Solutions (new registration)

Scope: hub PR head f538f31b1bfc8735806b49eb6e2368cdf275d7df, manifest Plugins/ProtogenDockingSolutions.xml, source ryancrimsonrd-ux/ProtogenDockingSolutions@4b20829 (version 1.2.0). Full-repository review: I accounted for all 75 tracked paths. The hub compiles ClientPlugin (15 .cs) and Shared (11 .cs), 6,713 lines in total.

Summary: One Medium fairness finding: the dock camera's spot can be moved anywhere through the settings file and is never kept out of other grids or voxels, which turns it into a free camera in survival. One Low filesystem finding. Security otherwise looks clean: no network, no process launch, no assembly loading, no binaries.

Manifest

  • GitHubPlugin with a GUID Id, RepoId, SourceDirectories ClientPlugin + Shared, Runtimes CLR,CoreCLR, and no NuGetReferences. python3 test.py Plugins/ at the PR head: All files validated. No other hub entry uses this Id.
  • Api/ (the copy-me client for other mods), Tests/, Tools/ and the PowerShell scripts are outside SourceDirectories, so the hub doesn't compile them. ClientPlugin doesn't depend on Api/.
  • The repository's own ProtogenDockingSolutions.xml matches the hub entry, apart from its placeholder <Commit> and the comments.

Repository and pin provenance

  • Public, MIT, created 2026-11-15. 4b20829 is the current main HEAD (compare reports identical). There are no tags yet.
  • No submodules, symlinks, LFS objects, archives, DLLs or native files. The 31 images under Tests/ are well-formed PNG/JPEG files with nothing appended after the image data. They are generated test previews and are not compiled or loaded.
  • ClientPlugin.csproj references game DLLs from $(Bin64) with Private=false, plus Lib.Harmony 2.4.2 (Pulsar supplies Harmony) and Krafs.Publicizer 2.3.0 (local builds only). The hub path doesn't read either package reference. It publicizes VRage.Render and VRage.Render11 from the IgnoresAccessChecksTo attributes in GameAssembliesToPublicize.cs, which also defines the attribute class when LOCAL_BUILD isn't set.

Security

  • Not present in the compiled sources: network access, process launch, assembly loading, P/Invoke, encoded payloads, self-update. Shared/ uses only System and is pure geometry and drawing.
  • Files: only Storage/ProtogenDockingSolutions/DockingSolutions.ini under the game's user data path, which is read and written as text by DockConfig (see finding 2 for its fallback path).
  • Reflection: fixed member names only. I checked each one against decompiled SE 1.211.017: MyCockpit's explicit IMyCameraController.ControlCamera/HandleUse, MyTextSurfaceScriptFactory.m_scripts, MyShipConnector.m_connectorMode, MyDefinitionManagerBase.m_definitions, MyDefinitionManager.DefinitionSet.m_definitionsById, and MyTextPanelComponent.Render/m_area/m_textureSize/m_screenAspectRatio/m_renderLayers. System.Reflection.Emit is used only for OpCodes in the depth-stencil transpiler.
  • Renderer hooks (DockPip.Init): a reverse patch of MyRender11.DrawGameScene re-renders the scene into the plugin's own textures. The postfix and the skip prefixes only act while Drawing is set. RenderScene saves and restores the camera, resolution and debug overrides in a finally. The CreateDepthStencil transpiler lets the depth-stencil pool grow instead of returning null, and it does so for the whole session, not only while the PiP is on.
  • Mod API: SendModMessage/RegisterMessageHandler stay inside the client process. Any client-side mod can call Command, SetTheme and SetOffset and so change the saved settings. SetOffset goes through the clamp in DockTrack.SetOffset.
  • Multiplayer: nothing is sent to the server. Moving the main camera doesn't change replication, because while you sit in a seat, MyClientState.WriteShared reports only the controlled entity's id. The server uses a spectator position only from a player with creative rights. The Docking Assist LCD script id is saved on the block and shows blank to players without the plugin, as the README says.

From-source build

I compiled the 26 ClientPlugin + Shared files with the installed Pulsar Compiler process (Pulsar 013a108 RoslynCompiler, C# 14) over its IPC protocol. References were the SpaceEngineers*/VRage*/Sandbox*/ProtoBuf* DLLs from SE 1.211.017 Bin64 and Harmony 2.4.2, the same list Pulsar passes.

  • Interim flags TRACE;NETCOREAPP;LINUX;PULSAR with the .NET 10.0.11 runtime: Release and Debug succeed, 0 errors. The compiler log shows Using publicized VRage.Render and VRage.Render11.
  • Legacy flags TRACE;NETFRAMEWORK;PULSAR with the net48 reference assemblies: Release and Debug succeed, 0 errors.

I didn't load the plugin in a game.

Findings

1. Medium: the dock camera's spot is unbounded from the settings file and passes through other grids and voxels, so it works as a free camera in survival.
DockTrack.SetOffset clamps /dock offset to −2..20 m forward and ±10 m up/right. But DockSettings.Parse keeps DockCamOffsets exactly as written (DockSettings.cs#L153), and DockTrack.Offsets applies the parsed numbers unclamped in Frame. DockConfig.Poll reloads the file within a second of an edit. A line such as DockCamOffsets=<connectorId>:2000:0:0 therefore puts the full-screen dock camera, the PiP and the LCD feeds 2 km ahead of the ship, aimed by turning the ship. That is a spectator camera on servers that disable spectator. Even inside the clamp, nothing keeps the spot out of other entities. Park the connector against another ship or an asteroid with a few metres of offset and the camera sits inside it, showing the interior. Vanilla's third-person camera raycasts against occluders to prevent that (MyThirdPersonSpectator.RaycastOccludingObjects). The client only shows entities it already has, so this isn't a server-authority bypass. It does give views that no vanilla view gives in survival.
Fix: apply the SetOffset limits when the offsets are parsed, in Offsets() or Parse. Then pull the spot back to the first hit along the segment from the connector face to the offset position, using MyPhysics.CastRay and ignoring your own mechanical group. Tradeoff: a moved camera stops short of whatever is in the way, which is also what keeps it docking-only.

2. Low: the settings folder can fall back to %AppData%\SpaceEngineers.
DockConfig.Folder uses Environment.GetFolderPath(SpecialFolder.ApplicationData) when MyFileSystem.UserDataPath is empty. EnsureLoaded returns early in that case, but Change still calls Save, which would write there. The game supports -appdata, so that would be the wrong folder. It's unlikely to be reached in practice. Please drop the fallback and skip saving until UserDataPath is set.

Non-blocking notes

  • The PR description still says 1.1.0 and commit 45b02ff. The manifest pins 4b20829 (1.2.0).
  • The hub description names "Protogen Systems - Virtual Displays" as an API user. That plugin isn't on PluginHub, so players can't install it from there.

@ryancrimsonrd-ux

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review. Both findings are fixed in 9778cce, which the manifest now pins:

  1. Dock camera spot: offsets from the settings file now go through the same clamp as /dock offset (−2..20 m forward, ±10 m up/right; non-finite values count as 0), in DockSettings.ClampOffset, which both paths use. DockTrack.Frame also casts a ray from the connector face to the camera spot (CollisionLayerWithoutCharacter) and pulls the camera back to 0.25 m before the first hit. Hits on the ship's own mechanical group are ignored. The full-screen camera, the PiP, the LCD feeds and the API all take the spot from Frame. Tested in game: a 2000 m offset in the file stays at 20 m, and the view stops in front of other ships and asteroids instead of going inside.
  2. Settings folder: the %AppData% fallback is gone. Until MyFileSystem.UserDataPath is set, changes stay in memory, and they're saved once it is.

I also dropped the Virtual Displays mention from the hub description and updated the PR description to 1.2.0 and the new commit.

@ryancrimsonrd-ux

Copy link
Copy Markdown
Contributor Author

Updated to 1.2.1 (c92d2a6): the plugin now switches itself off in creative tools, admin toggles, the admin menu and spectator, and after 30 s AFK in multiplayer. It also fixes a crash when a world was loaded after one with Build Info: the toolbar actions are now made again for each world.

@viktor-ferenczi viktor-ferenczi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-review: Protogen Systems Docking Solutions (new registration)

Scope: hub PR head 91d8f165da983b6ff91d34923d183031b06b4dd2, manifest Plugins/ProtogenDockingSolutions.xml, source ryancrimsonrd-ux/ProtogenDockingSolutions@c92d2a6 (version 1.2.1). My last review covered hub head f538f31b with source 4b20829. The tree at c92d2a6 has 76 tracked paths. Compared with 4b20829, 16 paths changed (+251/−25), one of them new (ClientPlugin/PlayGuard.cs), and the other 60 are byte-identical. I read every changed file in full. The hub compiles 16 ClientPlugin and 11 Shared .cs files.

Summary: Both earlier findings are fixed. The 1.2.1 additions only switch the plugin off or rebuild objects; they add no new authority, network, file or process access. No agent-detected blockers.

Earlier findings

1. Medium, dock camera spot unbounded and passing through obstacles: fixed.

  • DockSettings.ClampOffset holds the limits (−2..20 m forward, ±10 m up/right, non-finite → 0). Both the settings-file path (Offsets, L363) and SetOffset (L385) go through it, and Offset() reads only from Offsets(). DockCamOffsets=<id>:2000:0:0 now ends up at 20 m. The Tests project checks the clamp.
  • DockTrack.Frame passes the final spot through Unblocked, which casts from the connector's constraint point to the spot on layer 30 (CollisionLayerWithoutCharacter) and stops 0.25 m short of the first hit. Your own grid and its mechanical group don't count. In SE 1.211.017, MyPhysics disables layer 30 only against characters and layers 5, 6, 19 and 31, so other grids and voxels block the ray. Every consumer takes the spot from Frame/FrameFor: the full-screen camera, DockCam.Draw, the PiP, the LCD feed, DockScreens and the API's CameraFrame.
  • Threading: every Frame caller runs on the game thread (the ControlCamera postfix, the gameplay-screen draw postfix, and LCD script Run from MyTextPanelComponent.UpdateSpritesTexture). The render-thread hooks only use the matrices computed there, so CastRay never runs on the render thread. Each call is one short ray of at most about 25 m, a few times a frame.
  • What's left: a camera up to 20 m out in free space, stopped by obstacles. That's within what vanilla's third-person camera shows, so I have no remaining fairness concern.

2. Low, %AppData% fallback: fixed. DockConfig.Folder is null until MyFileSystem.UserDataPath is set. Until then Save only marks the settings dirty. Neither SpecialFolder nor GetFolderPath appears anywhere in the repository now.

1.2.1 additions

  • PlayGuard pauses the plugin for creative tools, any AdminSettings flag, an open MyGuiScreenAdminMenu, the spectator camera, and, in multiplayer, after 30 s without keyboard, mouse or controller input. It only reads local input and session state. If the check throws, the plugin stays paused. While paused, Plugin.Update stops the camera and clears the PiP, then returns early. The ControlCamera postfix, the draw postfixes and the render-scene postfix return before doing anything, so no extra scene is rendered. The LCD script draws only a "paused" line, and the commands, toolbar actions and the API's frame and draw calls do nothing. Each update iterates over the cached joystick enum arrays and checks the screen stack, which is cheap.
  • Toolbar actions per world: DockActions.Unregister now clears the list, and Register creates fresh IMyTerminalAction objects in the next world's BeforeStart. Toolbar slots refer to the action ids, which haven't changed. That matches your explanation of the Build Info crash. I didn't reproduce the crash.
  • Release-PluginHub.ps1 can now open the hub PR with gh. It's a developer tool outside SourceDirectories, its only external calls are gh auth status and gh pr create, and it isn't compiled or shipped.

Repository, manifest and build

  • Repository public, MIT, no tags. main is one commit ahead of the pin (d145a4b), and that commit only edits IN-GAME-TESTS.md. Still no submodules, symlinks, LFS objects, DLLs or native files.

  • Manifest is unchanged apart from the pin and the shorter description (Virtual Displays mention dropped). python3 -I test.py Plugins/ at 91d8f165: All files validated. No other entry uses this Id. The repository's backup manifest matches the hub entry apart from line wrapping and its placeholder <Commit>.

  • From-source build: the 27 selected files compile with the installed Pulsar Compiler process (Pulsar 013a108 RoslynCompiler, C# 14) over its IPC protocol. References are SE1 Bin64 (Steam build 26329893) SpaceEngineers*/VRage*/Sandbox*/ProtoBuf* plus Pulsar's common list:

    • Interim (TRACE;NETCOREAPP;LINUX;PULSAR, .NET 10.0.11): Release and Debug succeed with 0 errors. The log shows Using publicized VRage.Render and VRage.Render11.
    • Legacy (TRACE;NETFRAMEWORK;PULSAR, net48 reference assemblies, Harmony 2.4.2 net48): Release and Debug succeed with 0 errors.

    I didn't load the plugin in a game.

Non-blocking notes

  • The PR description still says 1.2.0 and commit 9778cce. The manifest pins c92d2a6 (1.2.1).

@viktor-ferenczi
viktor-ferenczi merged commit 9abb185 into StarCpt:main Nov 18, 2026
1 check passed
@ryancrimsonrd-ux
ryancrimsonrd-ux deleted the add-protogen-docking-solutions branch November 19, 2026 16:23
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.

2 participants