Skip to content

Replica body test by kept entity ids; the replica's movement kept current - #356

Closed
Kharote wants to merge 1 commit into
mainfrom
fix/replica-body-stale-movement
Closed

Kharote wants to merge 1 commit into
mainfrom
fix/replica-body-stale-movement

Conversation

@Kharote

@Kharote Kharote commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

What this changes

A player's game crashed when its body touched another player's body (access violation in the body touch test, replica_body). That test went through every replica's stored movement object and read the actor inside it. When the game had freed that movement object, the read hit freed memory.

  • The replicas' entity ids are kept when a replica is made, dropped when it goes, and cleared on a world reset. The touch test now only compares ids and never reads a replica's game objects.
  • Each frame the replica tick keeps a replica's movement as its actor holds it now. When the pointer changes it logs one line (COMBAT remote movement replaced). The other combat code that reads the stored movement then gets the live one.

How it was tested

  • Formatting check passes.
  • Kit run with two games (bodies walking into each other and fighting) follows in this pull request.

Checklist

  • I read CONTRIBUTING.md and agree that my contribution is licensed as it says.
  • The change is my own work: no code, assets or dumps that are not mine or that come from the game.
  • python Dev/tools/format_source.py --check passes.
  • Tests cover the change, and the checks of this pull request pass.
  • Public behaviour that changed is documented (KCD-Synced/KCDS-DOCS) or needs no docs.

…rent

Telling whether a body that touched another is a replica read each replica's movement object
and the actor inside it. When that movement object was gone, the game crashed in the touch.
The replicas' entity ids are now kept when they are made and dropped when they go, and the touch
compares ids only. The replica tick also keeps each replica's movement as its actor holds it now,
with one log line when it changes.
@Kharote Kharote mentioned this pull request Nov 26, 2026
5 tasks done
@Kharote

Kharote commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Shipped in KCDS 1.2.3 through #358.

@Kharote Kharote closed this Nov 26, 2026
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