-
Notifications
You must be signed in to change notification settings - Fork 450
feat: NetworkTransform now uses NetworkVariables instead of RPCs #826
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
feat: NetworkTransform now uses NetworkVariables instead of RPCs #826
Conversation
shared objects now update normally, there's still an update issue when client takes shared object (server side, the update for the shared object isn't fast)
adding parented cubes so better test world scale
Fixing issue with player movement where client was doing an unauthorized transform update Fixing all unauthorized transform updates
making sure everything uses the right network transform and the right authority
making sure scaling cubes also have the updated NetworkTransform
Currently looking into writing tests based on Albin's multi instance tools |
/// </summary> | ||
[Tooltip("This assumes that the SendsPerSecond is synced across clients")] | ||
public bool AssumeSyncedSends = true; | ||
public float FixedSendsPerSecond = 30f; |
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.
Why do we need to change it?
Or, more generally, why do we still have this?
It only seems to affect v.Settings.SendTickrate = FixedSendsPerSecond;
And the SendTickrate
is only used by NetworkList
, NetworkSet
and NetworkDictionary
. As such, I'm tempted to say: let's remove FixedSendsPerSecond for NetworkTransform and simply leave v.Settings.SendTickrate
at default value. If it breaks anything, then I missed something :-)
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.
+1 for this. Maybe we want NetworkTransform
to expose a SendTickrate
property which then updates the position, rotation, scale variable at the same time? Not sure whether that's confusing though and individual control over update rate of for instance scale could be nice.
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.
To me, the fact only list set and dict are using SentTickRate is a problem by itself. I wasn't aware of that and that should be fixed.
A use case I can see for this is this:
if I have a far away object, we could have a relevancy system that reduces global tick rate. However, if I have a giant far away, I DO want to see that giant's detailed updates. I would want to override that giant's tick rate to keep it at this value.
Not sure I see a use case for having different control per variable though. Maybe if I know my scale will change in a linear way, I could save on bandwidth and have it update once per second for example and just interpolate it?
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.
If there's a valid use case for the user to set properties about priority, importance or desired rates, the user should do it at the NetworkVariable level, and Snapshot should accommodate/consider those values. Then, NetworkTransform can expose those underlying values. My point was that NetworkTransform should not attempt to drive this rate, as it kinda did in the past.
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.
yep, that's why I'm still exposing that value but not using it. I didn't want to remove too much functionality from the old NetworkTransform.
Once we have that feature available at the NetVar level, we could plug it in, what do you think?
/// The min meters to move before a send is sent | ||
/// </summary> | ||
// ReSharper disable once NotAccessedField.Global | ||
public float MinMeters = 0.15f; |
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.
Can we elaborate, maybe with a comment in code on the plan, here? The NetworkTransform would check distance between its value what it last set on the NetworkVar and not update it unless it is large enough ? I'm curious how that plays with snapshot values received from the authoritative server.
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.
I was thinking this could be more on the network variable itself. If a server increases a Netvar int by +0.05, the netvar would actually not transmit that info and would wait for the value to be even more different.
The setting in the NetworkTransform would be to just apply it to our netvars when available? What do you think?
This is a very good step. However, it puts us in a sort of transitional state where we lose interpolation. We should only merge to |
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.
IsMoveValidDelegate. Since this is now using a new authority enum, it doesn't make much sense to have a client authoritative network transform with a server side check. This could be revisited with an eventual prediction.
I disagree with this statement. IsMoveValidDelegate could still be a feature to have some level of checks when running in client authority mode. Not saying we shouldn't remove it just that I don't agree with the explanation.
Few small things I pointed out which might need fixing
We could also just put this in a NetworkTransformV2 class that would live along side NetworkTransform. This way we could all start experimenting with it, without breaking the current NetworkTransform? |
I disagree, we never had interpolation in a networked sense. The implementation which existed was flawed and thus not a feature. I do not think that the quality of the position synchronization gets worse with this change. |
Adding better spawn check in FixedUpdate so handle objects that are Despawned
If you look at the sample scene with the new NetworkTransform, movements for ghosts are jaggy. They weren't with the old NetworkTransform. Sure users could increase their tick rate (right now it's set at 0.05), but that's not the same thing. They do lose "something" even if that something is flawed. |
I think this goes back to our discussion on nomenclature. To me, as soon as you have server side checks, you're not client authoritative anymore. |
adding explanation on why callback is needed
…nity-Technologies/com.unity.multiplayer.mlapi into feature/NetworkTransform-using-Netvars * 'feature/NetworkTransform-using-Netvars' of github.com:Unity-Technologies/com.unity.multiplayer.mlapi: feat: grabbable ball script to utilize transform parenting (#827)
…nity-Technologies/com.unity.multiplayer.mlapi into feature/NetworkTransform-using-Netvars * 'feature/NetworkTransform-using-Netvars' of github.com:Unity-Technologies/com.unity.multiplayer.mlapi: fix: move ball on top of our head according to our local scale
Adding client authoritative ball in test scene Fixing issue with GrabbableBall not finding player objects client side when it's the server side object grabbing the ball.
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
* develop: fix: gracefully handle exceptions in an RPC invoke (#846) fix: Fixing utp license file for legal (#843) ci: enable standards check on UTP too (#837) refactor: NetworkBehaviour.NetworkObject no longer throws an exception (#838) fix: revert #830 (#840) test: converting the manual rpc tests over to an automated unit test (#830)
…nity-Technologies/com.unity.multiplayer.mlapi into feature/NetworkTransform-using-Netvars * 'feature/NetworkTransform-using-Netvars' of github.com:Unity-Technologies/com.unity.multiplayer.mlapi: Adding nameof NetworkTransform in error log
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.
I don't think this is "the ultimate solution" for NetworkTransform
syncing but it's definitely better than what we used to have — so, I think we should have it. 🚀
I'm curious about what you mean here. How are NetworkVariables not the best construct ? If there's any shortcomings, it would be better to list them now, before we built further on top, especially with the Snapshot system. |
…player-object-get * develop: test: manual connection approval to fully automated connection approval testing (#839) test: manual rpc tests to automated fixed revision (#841) fix: CleanDiffedSceneObjects was not clearing PendingSoftSyncObjects (#834) feat: NetworkTransform now uses NetworkVariables instead of RPCs (#826) fix: gracefully handle exceptions in an RPC invoke (#846) fix: Fixing utp license file for legal (#843) ci: enable standards check on UTP too (#837) refactor: NetworkBehaviour.NetworkObject no longer throws an exception (#838) fix: revert #830 (#840) test: converting the manual rpc tests over to an automated unit test (#830) # Conflicts: # com.unity.multiplayer.mlapi/Tests/Runtime/MultiInstance/MultiInstanceHelpers.cs
Refactoring NetworkTransform to use NetworkVariables instead of RPCs.
We're losing a few features with that refactor:
What we gain with that refactor: