KH2: Reduce unnecessary packets sent/requested by the client #4035
+17
−12
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.
What is this fixing or adding?
While connected to the game and AP server, the KH2 client would send both a
Set
message (for storing the current world int) and aLocationChecks
message every 0.5 seconds, even if the value in theSet
message was unchanged or if there were no newly checked locations to send to the server.The
Set
message behaviour was identified from the PopTracker package that was listening to updates to the key via aSetNotify
message, which would receive messages multiple times a second. ThisSet
message was also requesting a reply from the server (SetReply
), but not doing anything with this reply.The
LocationChecks
message behaviour has only been identified by reading the code.This patch changes the client to only send the
Set
message when the value to set changes and to only send theLocationChecks
message when there are locations to send. TheSet
message also no longer requests a reply from the server.Because the
LocationChecks
message is no longer always created, thefinishedGame()
function now readsctx.sending
directly rather than reading it from the create message.How was this tested?
It has not been tested because I do not own KH2.