Skip to content

NetworkTransform Interpolation#28

Merged
SamuelBellomo merged 29 commits intomasterfrom
rfc/network-transform-smoothing/buffered-interpolation
Aug 23, 2021
Merged

NetworkTransform Interpolation#28
SamuelBellomo merged 29 commits intomasterfrom
rfc/network-transform-smoothing/buffered-interpolation

Conversation

@SamuelBellomo
Copy link
Copy Markdown
Contributor

@SamuelBellomo SamuelBellomo commented Jul 25, 2021

See this page for formatted view

SamuelBellomo and others added 17 commits July 19, 2021 20:10
… of github.com:Unity-Technologies/com.unity.multiplayer.rfcs into rfc/network-transform-smoothing/buffered-interpolation

* 'rfc/network-transform-smoothing/buffered-interpolation' of github.com:Unity-Technologies/com.unity.multiplayer.rfcs:
  adding video
@SamuelBellomo SamuelBellomo marked this pull request as ready for review July 25, 2021 22:42
Copy link
Copy Markdown
Contributor

@LukeStampfli LukeStampfli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can agree with the overall idea behind this.

What is a bit worrying is that the Interpolator does a lot of things in addition to interpolating. It is also storing a state history and is aware of frames/ticks. I can see why we are doing it to quickly fix issues in the NetworkTransform but I think we will need get back to this and redesign it when we get snapshots.

@SamuelBellomo
Copy link
Copy Markdown
Contributor Author

I think I can agree with the overall idea behind this.

What is a bit worrying is that the Interpolator does a lot of things in addition to interpolating. It is also storing a state history and is aware of frames/ticks. I can see why we are doing it to quickly fix issues in the NetworkTransform but I think we will need get back to this and redesign it when we get snapshots.

It's very possible we'll need to break the API with snapshot, but I'm not sure. Passing a Vector3 for position to AddMeasurement would still happen, snapshot or no snapshot. Passing a NetworkTime would still happen snapshot or no snapshot.
I would imagine the snapshot system would still be available statically from the interpolator, without needing to inject snapshots through the interface. If there's any need for rewinding things, interpolators could still have access to that information.
Our usage of the interpolator might change, but I think the interface is flexible enough to give us some leeway once we add snapshots later? Unless you have some other ideas of things we could work into the interface?

@jeffreyrainy
Copy link
Copy Markdown
Contributor

I think I can agree with the overall idea behind this.
What is a bit worrying is that the Interpolator does a lot of things in addition to interpolating. It is also storing a state history and is aware of frames/ticks. I can see why we are doing it to quickly fix issues in the NetworkTransform but I think we will need get back to this and redesign it when we get snapshots.

It's very possible we'll need to break the API with snapshot, but I'm not sure. Passing a Vector3 for position to AddMeasurement would still happen, snapshot or no snapshot. Passing a NetworkTime would still happen snapshot or no snapshot.
I would imagine the snapshot system would still be available statically from the interpolator, without needing to inject snapshots through the interface. If there's any need for rewinding things, interpolators could still have access to that information.
Our usage of the interpolator might change, but I think the interface is flexible enough to give us some leeway once we add snapshots later? Unless you have some other ideas of things we could work into the interface?

What I hope happens is, once Snapshot is there and works, for the interpolator to attach to the NetworkVariable directly. Then the NetworkTransform responsibility becomes ones of integrating with the Unity's transforms and integration with UI, surfacing parameters type stuff. But I hope the interpolation to eventually go down into NetworkVariables. Would still use the/an interpolator, but just not tied to NetworkTransform, if that makes sense.

@SamuelBellomo
Copy link
Copy Markdown
Contributor Author

I think I can agree with the overall idea behind this.
What is a bit worrying is that the Interpolator does a lot of things in addition to interpolating. It is also storing a state history and is aware of frames/ticks. I can see why we are doing it to quickly fix issues in the NetworkTransform but I think we will need get back to this and redesign it when we get snapshots.

It's very possible we'll need to break the API with snapshot, but I'm not sure. Passing a Vector3 for position to AddMeasurement would still happen, snapshot or no snapshot. Passing a NetworkTime would still happen snapshot or no snapshot.
I would imagine the snapshot system would still be available statically from the interpolator, without needing to inject snapshots through the interface. If there's any need for rewinding things, interpolators could still have access to that information.
Our usage of the interpolator might change, but I think the interface is flexible enough to give us some leeway once we add snapshots later? Unless you have some other ideas of things we could work into the interface?

What I hope happens is, once Snapshot is there and works, for the interpolator to attach to the NetworkVariable directly. Then the NetworkTransform responsibility becomes ones of integrating with the Unity's transforms and integration with UI, surfacing parameters type stuff. But I hope the interpolation to eventually go down into NetworkVariables. Would still use the/an interpolator, but just not tied to NetworkTransform, if that makes sense.

I'm still not convinced about moving this in NetVar. I had to move transform state sending to NetworkTick in NetworkTransform in order to make this fit with BufferedInterpolation. I'm pretty sure we can't impose this on NetVar update call sites.
Do you have use cases for interpolation at the NetVar level beside transform related ones?

Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
0xFA11 and others added 4 commits July 30, 2021 15:03
…n' and 'rfc/network-transform-smoothing/buffered-interpolation' of github.com:Unity-Technologies/com.unity.multiplayer.rfcs into rfc/network-transform-smoothing/buffered-interpolation

* 'rfc/network-transform-smoothing/buffered-interpolation' of github.com:Unity-Technologies/com.unity.multiplayer.rfcs:
  small syntax fixes
  Update text/0000-network-transform-buffered-interpolation.md

* 'rfc/network-transform-smoothing/buffered-interpolation' of github.com:Unity-Technologies/com.unity.multiplayer.rfcs:
  small syntax fixes
  Update text/0000-network-transform-buffered-interpolation.md
Copy link
Copy Markdown
Contributor

@LukeStampfli LukeStampfli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more scriptable objects yay 😄

@andrews-unity
Copy link
Copy Markdown

Just so I understand we are still purposing the addition of an interface ? And the ability to set per object different interp algorithms? If so I am going to want to understand why we need this. I truely believe 90% of the time most devs won't change it beyond the default one. So to me we should make that the best possible algorithm and say if you want something special there is the code write it yourself.

We constantly try to provide this plug and play swap this and that model and I just don't see the argument for it. You mentioned several other engine all of which have one path maybe with some nobs and dials and 100s and 100s of multiplayer games have shipped on them. We don't need to solve for everyone we need to solve for the majority.

@SamuelBellomo
Copy link
Copy Markdown
Contributor Author

Just so I understand we are still purposing the addition of an interface ? And the ability to set per object different interp algorithms? If so I am going to want to understand why we need this. I truely believe 90% of the time most devs won't change it beyond the default one. So to me we should make that the best possible algorithm and say if you want something special there is the code write it yourself.

We constantly try to provide this plug and play swap this and that model and I just don't see the argument for it. You mentioned several other engine all of which have one path maybe with some nobs and dials and 100s and 100s of multiplayer games have shipped on them. We don't need to solve for everyone we need to solve for the majority.

@andrews-unity
I'm still suggesting an interface, but I'm not suggesting the way it's going to be exposed to users in inspector anymore. The interface would be to serve as a contract for users that do want to extend it.
One near-term use case I can see for a new interpolator would be with Luke's network physics work. There's potential for linear interpolation to not be enough and a need for syncing more data (velocity for example). Having that contract would help extending current interpolation for a physics based one for example, but still keep default linear interpolation for when we want to save on bandwidth.
Unreal teleports character capsules but interpolates graphics. It's great for predicted characters, but not that great for a self contained component like we're trying to build here.
Hermite interpolation uses more bandwidth, but has less wobble.
Kalman Filtering is more physics based and less noisy, but can show transform updates that are not true, with an inertia client side that wouldn't be there server side.
Buffered Linear interpolation would still remain the default. It's smooth even with bad jitter and only uses a float for extra bandwidth to track the time the value was updated.

mattwalsh-unity added a commit that referenced this pull request Aug 12, 2021
@SamuelBellomo SamuelBellomo merged commit fdcab1f into master Aug 23, 2021
@SamuelBellomo SamuelBellomo deleted the rfc/network-transform-smoothing/buffered-interpolation branch August 23, 2021 21:24
SamuelBellomo added a commit to Unity-Technologies/com.unity.netcode.gameobjects that referenced this pull request Sep 16, 2021
Adding buffered interpolation to network transform following this RFC Unity-Technologies/com.unity.multiplayer.rfcs#28
This will smooth out transform updates over jittery networks and help alleviate some packet loss.

Jira: MTT-876
@LukeStampfli LukeStampfli removed the final-comment-period RFC is in final comment period label Oct 4, 2021
mattwalsh-unity added a commit that referenced this pull request Dec 1, 2021
* network variables / collections changes (#28)

* more on netvar tradeoffs (#28)

* updated for client write-ability
mollstam pushed a commit to Keepsake-Games/com.unity.netcode.gameobjects that referenced this pull request Feb 13, 2023
Adding buffered interpolation to network transform following this RFC Unity-Technologies/com.unity.multiplayer.rfcs#28
This will smooth out transform updates over jittery networks and help alleviate some packet loss.

Jira: MTT-876
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open RFC is open for review and comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants