Skip to content

feat: implement tick-based synchronized NetworkVar#482

Merged
jeffreyrainy merged 42 commits intodevelopfrom
feature/syncnetvars
Feb 26, 2021
Merged

feat: implement tick-based synchronized NetworkVar#482
jeffreyrainy merged 42 commits intodevelopfrom
feature/syncnetvars

Conversation

@jeffreyrainy
Copy link
Copy Markdown
Contributor

@jeffreyrainy jeffreyrainy commented Feb 15, 2021

This is the PR for sync-networked-vars RPC

0xFA11
0xFA11 previously requested changes Feb 20, 2021
Copy link
Copy Markdown
Contributor

@0xFA11 0xFA11 left a comment

Choose a reason for hiding this comment

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

yep, needs to be RFC'd first :)

@will-mearns will-mearns removed the request for review from fraserhutch2020 February 24, 2021 17:36
Copy link
Copy Markdown
Member

@NoelStephensUnity NoelStephensUnity left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment thread com.unity.multiplayer.mlapi/Runtime/Core/NetworkedBehaviour.cs Outdated
// special value to indicate "No tick information"
private const ushort k_NoTick = 65535;
// Number of ticks over which the tick number wraps back to 0
private const ushort k_TickPeriod = 65000;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if you just want to make sure you're never as large as k_NoTick you could k_NoTick - 1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, was trying to leave some space "just in case", but this is an internal value that could change. k_noTick - 1 would be clearer. Will do.

Comment thread com.unity.multiplayer.mlapi/Runtime/Core/NetworkedBehaviour.cs Outdated
Copy link
Copy Markdown
Contributor

@mattwalsh-unity mattwalsh-unity left a comment

Choose a reason for hiding this comment

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

  1. Had some minor stuff and questions in the PR
  2. Going forward looking to have unit tests. Would you conceive and write some?

Comment thread com.unity.multiplayer.mlapi/Runtime/Core/NetworkedBehaviour.cs Outdated
@jeffreyrainy jeffreyrainy force-pushed the feature/syncnetvars branch 4 times, most recently from 9cdd1ae to 9145e51 Compare February 26, 2021 03:31
@jeffreyrainy
Copy link
Copy Markdown
Contributor Author

  1. Had some minor stuff and questions in the PR
  2. Going forward looking to have unit tests. Would you conceive and write some?

tests done but outside, as discussed. Does that work for you?

@jeffreyrainy
Copy link
Copy Markdown
Contributor Author

yep, needs to be RFC'd first :)

I still have a todo, for the RFC, on the diagram you suggested and the comments about future possibilities. It's coming up shortly. Still, if we could unblock this PR, it would be great :-)

@0xFA11
Copy link
Copy Markdown
Contributor

0xFA11 commented Feb 26, 2021

@jeffreyrainy

tests done but outside, as discussed. Does that work for you?

I think you could submit your test component we discussed yesterday (MLAPI/Tests/Manual/...) alongside with comments explaining what you did, what happened and how you verified this feature works as intended. that'd be your sign-off on testing and verification which could be the source of truth for now, up until we have a better testing infrastructure setup IMHO.

what do you think @mattwalsh-unity ?

@0xFA11 0xFA11 changed the title Feature/syncnetvars feat: implement tick-based synchronized NetworkVar Feb 26, 2021
Comment on lines -51 to +61
void ReadField(Stream stream);
/// <param name="localTick">The local network tick at which this var was written, on the machine it was written </param>
/// <param name="remoteTick">The remote network tick at which this var was sent by the host </param>
void ReadField(Stream stream, ushort localTick, ushort remoteTick);
/// <summary>
/// Reads delta from the reader and applies them to the internal value
/// </summary>
/// <param name="stream">The stream to read the delta from</param>
/// <param name="keepDirtyDelta">Whether or not the delta should be kept as dirty or consumed</param>
void ReadDelta(Stream stream, bool keepDirtyDelta);
/// <param name="localTick">The local network tick at which this var was written, on the machine it was written </param>
/// <param name="remoteTick">The remote network tick at which this var was sent by the host </param>
void ReadDelta(Stream stream, bool keepDirtyDelta, ushort localTick, ushort remoteTick);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if you think this PR introduces a breaking change, we should also call that out to be more cautious I think.

@jeffreyrainy jeffreyrainy requested a review from 0xFA11 February 26, 2021 23:00
@jeffreyrainy jeffreyrainy merged commit 3ea55cd into develop Feb 26, 2021
@jeffreyrainy jeffreyrainy deleted the feature/syncnetvars branch February 26, 2021 23:13
Comment on lines +332 to +343
--- !u!114 &2690316626396496521
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8685790303553767886}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 962d0654df408407d8055453c9020f2b, type: 3}
m_Name:
m_EditorClassIdentifier:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jeffreyrainy — I think we probably shouldn't have merged this change (this is ManualNetworkedVarTest component being attached to Cube.prefab here which is not in testproject on develop branch)

I'll revert this change in one of my PRs next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants