Fix player visibility: duplicate puppets, join announcements, tracking range - #1
Merged
Merged
Conversation
- HandleJoinWorld now calls UpdateTrackingOf for the freshly spawned puppet, so other players see a joiner immediately instead of only after their first movement packet. - Raise the entity tracking range from 100m to 10km so co-op players see each other anywhere in Night City; previously two players whose saves placed them more than 100m apart would never be replicated. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…-game-mod # Conflicts: # server/Managed/PacketHandling/PlayerPacketHandler.cs
There was a problem hiding this comment.
Pull request overview
This PR addresses co-op player visibility issues on the server by ensuring newly spawned player-controlled entities (puppets) are replicated promptly to other connected players and by widening the spatial tracking range so distant players still replicate to each other.
Changes:
- Increase entity replication/tracking range from 100m to 10km via a named constant.
- Announce a joining player’s newly spawned puppet immediately by calling
EntityTracker.UpdateTrackingOf(entity)duringHandleJoinWorld.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| server/Managed/Services/EntityTracker.cs | Introduces a 10km tracking constant and uses it in distance checks for replication decisions. |
| server/Managed/PacketHandling/PlayerPacketHandler.cs | Calls into the tracker immediately after spawning a joiner’s puppet to replicate it before movement packets arrive. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
121
to
+125
| foreach (var playerEntity in playerEntities) | ||
| { | ||
| // TODO: Check for out of bounds. | ||
| var playerPosition = playerEntity.WorldTransform; | ||
| if (playerPosition.DistanceSquared(entity.WorldTransform) <= 100 * 100) | ||
| if (playerPosition.DistanceSquared(entity.WorldTransform) <= TrackingRange * TrackingRange) |
nobody71004
added a commit
that referenced
this pull request
Aug 23, 2026
docs(license): migrate to AGPL-3.0, update READMEs with credits, prot…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes three server-side issues that prevented co-op players from seeing each other:
Duplicate puppets —
HandleJoinWorldspawned a new random NPC on everyPlayerJoinWorld(save reload, death, re-entry) without removing the previous one, leaking stale frozen puppets (e.g. Jackie + Hanako) that other players kept seeing. Now any existing non-vehicle puppet owned by the connection is despawned first.Joiners invisible until they move — the new puppet was never announced to other players; tracking only ran on movement packets. Now
UpdateTrackingOfis called immediately after spawn.100m tracking range — players whose saves placed them >100m apart were never replicated to each other (Night City is ~6km across). Range raised to 10km until proper interest management exists.
Tested against a live client on patch 2.31 connecting to the VPS at port 1337; client-side spawn path (
SpawnTransientEntityvia Codeware DynamicEntitySystem) verified working.