Skip to content

attempt to address npc desyncs

Logg requested to merge Loggy/openrsc:fix-235-npc-location-desync into develop

Mostly what I've done is just overly-comment the GameStateUpdater code that tells players where NPCs are.

I've also changed a few things though:

  1. In WalkingQueue, I identified that mob.face(point) could hypothetically be called independent of mob.setLocation(point), which, I don't think was the desync issue, but it might possibly have been.
  2. I made it so that if an NPC is teleporting, the server will add their location that same tick, instead of the next one. I'm not sure why this condition forbidding that an NPC is added on a tick where they are teleporting was there, but it's possible there was a good reason & this could cause an issue. I would like to test without this condition & see what happens on the live server.
  3. I added a check in Mob.setLocation(point) so that if the mob's new location is more than 1 tile away from their old location, they are considered to be teleporting. Previously, "teleported" boolean was set entirely by the programmer, which could lead to a position desync bug if something (other than combat, since combat forces a coordinate refresh) did manage to make the Mob move more than 1 tile in a tick.
  4. Finally, as a Hail Mary, I added the ability for the server to disable the local npc cache. It is actually permissible that the server simply tell each client each and every tick exactly where the NPC is, instead of building on previous ticks' data. This causes more network usage, which would inflate our PCAP logs, and it is not authentic, but otherwise it is completely unproblematic and allowed within the protocol. If nothing else, "Breaking the NPC Location Cache" will definitely fix the issue of NPC desyncs. Because I would not really like server operators to use this option, I have not added it to any of the server configs at this time, it defaults to false, & the server config option might be removed in the future.

Merge request reports

Loading