Skip to content

refactor!: introduce NetVar.ValueRef & convert NetTrans.NetState to struct #1061

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

Merged
merged 3 commits into from
Aug 19, 2021

Conversation

0xFA11
Copy link
Contributor

@0xFA11 0xFA11 commented Aug 17, 2021

decoupling from PR #1051

@@ -9,7 +9,7 @@ namespace Unity.Netcode.Prototyping
[AddComponentMenu("Netcode/" + nameof(NetworkTransform))]
public class NetworkTransform : NetworkBehaviour
{
internal class NetworkState : INetworkSerializable
internal struct NetworkState : INetworkSerializable
Copy link
Contributor Author

@0xFA11 0xFA11 Aug 17, 2021

Choose a reason for hiding this comment

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

I wanted to see what it'd mean to convert from class to struct (turns out, it's not too bad :P)

Comment on lines +69 to +75
/// <summary>
/// The temporary accessor to enable struct element access until [MTT-1020] complete
/// </summary>
public ref T ValueRef
{
get => ref m_InternalValue;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this part is introduced by PR #1051 originally, it's here too.
I'm not sure about the ultimate API, @mattwalsh-unity might chime in here as he wants to drive this change/shift around the codebase.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is commented temporary, granted, but I'm not familiar with the linked issue. Can you elaborate on why marking the netvar dirty is not needed here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not entirely sure what is the new design direction but I can tell you why NetworkTransform's State still works: we manually mark NetVar to be dirty later in code. So, we don't rely on a get/set prop marking NetVar dirty, we mark the NetVar dirty somewhere else.

@0xFA11 0xFA11 changed the title refactor!: introduce NetVar.ValueRef & convert NetTrans.NetState to struct refactor!: introduce NetVar.ValueRef & convert NetTrans.NetState to struct Aug 17, 2021
@0xFA11 0xFA11 marked this pull request as draft August 18, 2021 10:52
@mattwalsh-unity
Copy link
Contributor

Yeah, I may be messing with the ValueRef stuff more but this looks good and I'd love to have this on mainline and rebase off of it

@0xFA11 0xFA11 marked this pull request as ready for review August 19, 2021 21:10
@0xFA11 0xFA11 enabled auto-merge (squash) August 19, 2021 21:11
@0xFA11 0xFA11 merged commit d4d15fa into develop Aug 19, 2021
@0xFA11 0xFA11 deleted the refactor/class-to-struct-netstate branch August 19, 2021 21:56
SamuelBellomo added a commit that referenced this pull request Aug 23, 2021
…nsform

* develop: (21 commits)
  test: adding more details to multiprocess readme (#1050)
  refactor!: convert NetworkTransform.NetworkState to `struct` (#1061)
  fix: networkmanager destroy on app quit (#1011)
  feat: snapshot, using unreliable packets, now that the underlying foundation supports it. Only merge after #1062 (#1064)
  feat: snapshot. Fully integrated despawn, mtt-1092, mtt-1056 (#1062)
  fix: eliminate bad use-after-free(destroy) pattern (#1068)
  chore: cleanup meta files for empty dirs (#1067)
  chore: minor MLAPI to Netcode rename (#1065)
  feat: report network behaviour name to the profiler (#1058)
  fix: player movement (#1063)
  test: Add unit tests for NetworkTime properties (#1053)
  chore: remove authority & netvar perms from NetworkTransform (#1059)
  feat: networktransform pos/rot/sca thresholds on state sync (#1055)
  feat: expose network behaviour type name internally (#1057)
  chore: remove all the old profiling code (#1048)
  fix: if-guard `NetworkManager.__rpc_name_table` access (#1056)
  fix: Disabling fixedupdate portion of SpawnRpcDespawn test because it's failing for known reasons that will be fixed in the IMessage refactor. (#1049)
  feat: Implement metrics for the new network profiler (#960)
  chore!: change package name & asmdefs (#1026)
  feat: per axis networktransform state sync (+bitwise state comp) (#1042)
  ...

# Conflicts:
#	com.unity.netcode.gameobjects/Prototyping/NetworkTransform.cs
mollstam pushed a commit to Keepsake-Games/com.unity.netcode.gameobjects that referenced this pull request Feb 13, 2023
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.

3 participants