Skip to content

Fix Pipe Surface Floater's movements - #2873

Open
tornac1234 wants to merge 23 commits into
SubnauticaNitrox:masterfrom
tornac1234:fix/surface-floater-movement
Open

tornac1234 wants to merge 23 commits into
SubnauticaNitrox:masterfrom
tornac1234:fix/surface-floater-movement

Conversation

@tornac1234

Copy link
Copy Markdown
Collaborator

Linked Issues / Context

  • Pipe surface floater used to be highly inconsistant with how they would be fully deployed and surface correctly.
  • RemotelyControlled entities would be teleported once around 0, 0, 0 at first, which would cause some unexpected errors
image

Description of Change

  • Reworked RemotelyControlled so it's smoother for both entities and swimming creatures (in particular, reaper leviathans used to teleport once every few meters)
  • Fix RemotelyControlledPipeFloater to properly detect surfacing and act accordingly when it should be static
  • Remove useless GC allocations in EntityPositionBroadcaster by reworking a good part of it

Validation

To observe the actual PipeSurfaceFloater fix:

  • connect with Player A and Player B
  • type subnautica command item pipesurfacefloater to get one
  • throw it with one player, observe its movement with the other player
  • when it's surfaced, make sure neither player can move it by pushing it. also try stepping on it to make sure that it's at the exact same place for both players

To observe Reaper Leviathan's movements improvements (as a side effect from the whole rework):

  • connect with Player A and Player B
  • type subnautica command spawn reaperleviathan
  • observer that it no longer glitches every few meters

PR Checklist

  • PR rebased on top of main at the time of opening
  • Has tests for the changes (if applicable)
  • Has a linked issue
  • Has been tested in-game (if applicable)
  • Has been tested on Windows/Linux/macOS (if applicable) (for cross-platform code)

AI was used to review myself before opening this PR

@tornac1234 tornac1234 added Area: netcode Related to packet serialization and networking algorithms p/1 Work that is important Status: Needs reviews Pull Request is waiting for code review labels Aug 30, 2026
@tornac1234

Copy link
Copy Markdown
Collaborator Author

I'll send a commit with slight corrections (fixing the test too) once #2845 is merged

@tornac1234
tornac1234 force-pushed the fix/surface-floater-movement branch from 1d50d81 to c7e3665 Compare August 30, 2026 15:54
@github-actions

github-actions Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Test Results

272 tests  +3   267 ✅ +3   10s ⏱️ ±0s
  1 suites ±0     5 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit e7b82de. ± Comparison against base commit 24730bf.

This pull request removes 2 and adds 5 tests. Note that renamed tests count towards both.
Nitrox.Test.Patcher.Patches.PatchesTranspilerTest ‑ AllPatchesTranspilerSanity (NitroxPatcher.Patches.Dynamic.CrashHome_Spawn_Patch,2)
Nitrox.Test.Patcher.Patches.PatchesTranspilerTest ‑ AllPatchesTranspilerSanity (NitroxPatcher.Patches.Dynamic.PipeSurfaceFloater_FixedUpdate_Patch,2)
Nitrox.Model.Extensions.DictionaryExtensionsTest ‑ RemoveWhere_ShouldHandleEmptyDictionary
Nitrox.Model.Extensions.DictionaryExtensionsTest ‑ RemoveWhere_ShouldHandleRemovingAllItems
Nitrox.Model.Extensions.DictionaryExtensionsTest ‑ RemoveWhere_WithExtraParameter_ShouldRemoveMatchingItems
Nitrox.Model.Extensions.DictionaryExtensionsTest ‑ RemoveWhere_WithoutParameter_ShouldRemoveMatchingItems
Nitrox.Test.Patcher.Patches.PatchesTranspilerTest ‑ AllPatchesTranspilerSanity (NitroxPatcher.Patches.Dynamic.CrashHome_Spawn_Patch,-5)

♻️ This comment has been updated with latest results.

Comment thread NitroxClient/MonoBehaviours/EntityPositionBroadcaster.cs Outdated
Comment thread NitroxClient/MonoBehaviours/EntityPositionBroadcaster.cs Outdated
Comment thread NitroxClient/GameLogic/MovementHelper.cs Outdated
Comment thread NitroxClient/MonoBehaviours/RemotelyControlled.cs
Comment thread NitroxClient/MonoBehaviours/RemotelyControlled.cs Outdated
@Jannify Jannify added the Status: Needs answers Pull Request needs answers from author label Sep 7, 2026
@tornac1234
tornac1234 force-pushed the fix/surface-floater-movement branch from cc36fce to dc8a1d7 Compare September 7, 2026 21:22
@tornac1234

Copy link
Copy Markdown
Collaborator Author

Added a commit to answer the requested changes. Also deprecated MultiplayerVehicleControl for good since it was entirely replaced by MovementReplicator.

@dartasen dartasen removed p/1 Work that is important Status: Needs answers Pull Request needs answers from author labels Sep 8, 2026
@dartasen
dartasen requested review from Jannify and a balanced review from Copilot September 8, 2026 21:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Ownership notifications, cell-transfer handling, and coordinate conversion currently introduce synchronization regressions.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Improves remote entity movement, pipe-floater synchronization, and position broadcasting efficiency.

Changes:

  • Reworks remote movement smoothing and teleport correction.
  • Makes surfaced pipe floaters static for remote players.
  • Refactors entity broadcasting and simulation ownership synchronization.
File summaries
File Description
NitroxPatcher/Patches/Dynamic/Vehicle_OnPilotModeEnd_Patch.cs Removes obsolete vehicle control cleanup.
NitroxPatcher/Patches/Dynamic/SplineFollowing_GoTo_Patch.cs Uses the broadcaster instance for spline updates.
NitroxPatcher/Patches/Dynamic/PropulsionCannon_GrabObject_Patch.cs Updates entity-watching API usage.
NitroxPatcher/Patches/Dynamic/PipeSurfaceFloater_FixedUpdate_Patch.cs Controls remote floater surfacing behavior.
NitroxPatcher/Patches/Dynamic/CreatureDeath_OnKillAsync_Patch.cs Updates movement-control cleanup.
NitroxClient/Unity/Smoothing/SmoothVector.cs Modernizes namespace formatting.
NitroxClient/Unity/Smoothing/SmoothRotation.cs Modernizes namespace formatting.
NitroxClient/MonoBehaviours/Vehicles/WatchedEntry.cs Corrects private field naming.
NitroxClient/MonoBehaviours/RemotelyControlledPipeFloater.cs Locks surfaced floaters to synchronized transforms.
NitroxClient/MonoBehaviours/RemotelyControlled.cs Reworks remote physics and spline movement.
NitroxClient/MonoBehaviours/MultiplayerVehicleControl.cs Removes obsolete vehicle smoothing implementation.
NitroxClient/MonoBehaviours/EntityPositionBroadcaster.cs Refactors tracking and reduces allocations.
NitroxClient/GameLogic/SimulationOwnership.cs Centralizes ownership acquisition and broadcasting.
NitroxClient/GameLogic/RemotePlayer.cs Adds distance-based teleport correction.
NitroxClient/GameLogic/MovementHelper.cs Extracts teleport and correction helpers.
NitroxClient/GameLogic/Items.cs Claims ownership immediately for dropped items.
NitroxClient/GameLogic/Entities.cs Clears unresolved broadcaster entries during spawning.
NitroxClient/Communication/Packets/Processors/RemoveCreatureCorpseProcessor.cs Updates broadcaster API usage.
NitroxClient/Communication/Packets/Processors/EntityTransformUpdatesProcessor.cs Removes a stray statement.
Nitrox.Test/Patcher/Patches/PatchesTranspilerTest.cs Removes the obsolete transpiler expectation.
Nitrox.Server.Subnautica/Models/Packets/Processors/EntitySpawnedByClientProcessor.cs Changes ownership assignment for client spawns.
Nitrox.Server.Subnautica/Models/Packets/Processors/CellVisibilityChangedProcessor.cs Bundles simulation data with spawned entities.
Nitrox.Server.Subnautica/Models/GameLogic/Entities/EntitySimulation.cs Shares simulation policy and adds forced assignment.
Nitrox.Model/Extensions/DictionaryExtensions.cs Adds pooled conditional dictionary removal.
Nitrox.Model.Subnautica/Packets/SpawnEntities.cs Revises simulation-aware constructors.
Nitrox.Model.Subnautica/Helper/SimulationWhitelist.cs Moves simulation policy into the shared model.
Review details
  • Files reviewed: 26/26 changed files
  • Comments generated: 6
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Nitrox.Server.Subnautica/Models/GameLogic/Entities/EntitySimulation.cs Outdated
Comment thread NitroxClient/GameLogic/RemotePlayer.cs
Comment thread NitroxClient/MonoBehaviours/EntityPositionBroadcaster.cs Outdated
Comment thread Nitrox.Model.Subnautica/Packets/SpawnEntities.cs Outdated
Comment thread Nitrox.Model/Extensions/DictionaryExtensions.cs
Comment thread NitroxClient/MonoBehaviours/RemotelyControlledPipeFloater.cs
private void CheckEntities()
{
// when fishes die, they're only a corpse and their swim behaviour stops functioning
splineEntities.RemoveWhere(pair =>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I find the usage of RemoveWhere in this class really weird, we're adding side effects to a boolean predicate

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If you can suggest a better name for RemoveWhere please, I've been thinking but it's really hard. Also I really think the performance gain from it is worth it. So either we rename it or we copy paste the code twice 😩

Comment thread NitroxPatcher/Patches/Dynamic/Vehicle_OnPilotModeEnd_Patch.cs
@tornac1234
tornac1234 force-pushed the fix/surface-floater-movement branch from 28cbd8e to dc8a1d7 Compare September 19, 2026 15:35
@MistaOmega MistaOmega mentioned this pull request Sep 25, 2026
3 of 4 tasks
@tornac1234

Copy link
Copy Markdown
Collaborator Author

Now with 3861f6d, fixes #2473 (PrefabPlaceholderGroup assumed all databox spawners were PrefabPlaceholder while they might also be PrefabPlaceholderGroup ) and #2543 (NitroxEntitySlots didn't take into account all transform hirerarchy up to their designed root)

@tornac1234 tornac1234 added the Area: spawning Related to spawning and/or terrain label Sep 27, 2026
@Measurity Measurity modified the milestone: 1.9 Sep 27, 2026

@Measurity Measurity 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.

LGTM

PipeSurfaceFloater audio plays while holding but appears to be vanilla bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: netcode Related to packet serialization and networking algorithms Area: spawning Related to spawning and/or terrain Status: Needs reviews Pull Request is waiting for code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Floating fragments Lights are missing on Databox in wrecks

5 participants