Skip to content

Fix player visibility: duplicate puppets, join announcements, tracking range - #1

Merged
nobody71004 merged 2 commits into
masterfrom
nobody71004-install-game-mod
Jul 5, 2026
Merged

nobody71004 merged 2 commits into
masterfrom
nobody71004-install-game-mod

Conversation

@nobody71004

Copy link
Copy Markdown
Owner

Fixes three server-side issues that prevented co-op players from seeing each other:

  1. Duplicate puppets — HandleJoinWorld spawned a new random NPC on every PlayerJoinWorld (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.

  2. Joiners invisible until they move — the new puppet was never announced to other players; tracking only ran on movement packets. Now UpdateTrackingOf is called immediately after spawn.

  3. 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 (SpawnTransientEntity via Codeware DynamicEntitySystem) verified working.

- 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>
Copilot AI review requested due to automatic review settings July 5, 2026 03:19
…-game-mod

# Conflicts:
#	server/Managed/PacketHandling/PlayerPacketHandler.cs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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) during HandleJoinWorld.

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
nobody71004 merged commit 6702478 into master Jul 5, 2026
2 of 3 checks passed
nobody71004 added a commit that referenced this pull request Aug 23, 2026
docs(license): migrate to AGPL-3.0, update READMEs with credits, prot…
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