-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MP] Implement "watched" properties (reliable/on change). #75467
Conversation
9ee2269
to
570acdc
Compare
If we go with this design, remember to make the editor UI show an error dialog when trying to make a property watchable when there are already 64 watched properties.
I assume this is done to avoid UDP fragmentation, therefore reducing potential issues with latency? |
Will do.
Well, yes and no, UDP fragmentation starts at around 1400 bytes, so a 64k packet will already be fragmented in ~64 packets. |
Updated: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Regarding the overall approach: it's hard to strike a balance between saving network bandwidth and the processing necessary to do so, and I think this does a pretty good job :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Faless I found nothing besides what is already mentioned above, docs look good too, and the implementation is clean and minimal, nice work :)
I'll see if I can find some time to do some tests and play around with it, but once the above is addressed this IMO is good to merge. Should not impact anything else anyway.
fbe5dc2
to
39acd97
Compare
Checked at "delta_interval" (default = every frame), synchronized (reliably) if changes are detected.
Thanks everyone for the reviews ❤️ , I believe I've addressed all the comments and suggestions. |
Thanks! |
This is awesome but it is also causing the server side to crash often. I will add more details to this issue here. |
Tentative implementation for godotengine/godot-proposals#4429.
How it works
"Watched" properties are deep duplicated and then compared (
Variant::hash_compare
) according to thedelta_interval
property of the MultiplayerSynchronizer (default = every frame). Re-duplication only happens when a change is detected, and the time of change is also stored for each property.Clients receives progressive (delta) changes which only includes the changed properties. The transmission happens reliably, so all changes "across frames" (
delta_interval
) are guaranteed to be received by the clients.There is a hard limit of 64 watched properties per synchronizer.
There is a (quite arbitrary) limit of 64k bytes per delta packet which probably needs adjustment.
WIP / RFC:More testing (e.g. comparison method).Seems to work fine in my tests, we can always fix that in a follow up PR.More feedback (e.g. custom comparison function, comparison frequency, reliable vs unreliable + ack).Well, it's been a month, I think I can mark the PR as ready.Discuss replication config editor redesign (e.g. make "Initial/Sync/Delta" exclusive, or use the current one in the proposal).Let's do that in a separate PR/proposal.Some further cleanup / internal command ids change.Kinda unrelated to this PR.Nice to have: Implement editor profiler (needs redesign proposal due to space constraints 😅 ).Needs design proposal.