Skip to content

refactor: calling networkShow(NetworkObject) code in networkshow(List<NetworkObject>) #1028

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 5 commits into from
Aug 10, 2021

Conversation

jeffreyrainy
Copy link
Contributor

@jeffreyrainy jeffreyrainy commented Aug 5, 2021

instead of calling a deeper-nested function. Make the code more uniform and prepares for incoming snapshot changes

…<NetworkObject>) instead of calling a deeper-nested function. Make the code more uniform and prepares for incoming snapshot changes
@jeffreyrainy jeffreyrainy changed the title refactor: calling networkShow(NetworkObject) code in networkshow(List… refactor: calling networkShow(NetworkObject) code in networkshow(List<NetworkObject>) Aug 5, 2021
Comment on lines -296 to -297
networkManager.SpawnManager.WriteSpawnCallForObject(nonNullContext.NetworkWriter, clientId,
networkObjects[i]);
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't this delete and the other below (nonNullContext.NetworkWriter.WriteUInt64Packed(networkObjects[i].NetworkObjectId);) break some stuff 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.

ohh.. right.. I had missed this and the subtle s in CreateObjects. I think this highlights the need for a test.
Thanks! Will rework.

Copy link
Contributor Author

@jeffreyrainy jeffreyrainy Aug 10, 2021

Choose a reason for hiding this comment

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

I take back my "ohh... right...".
This removes a WriteUInt64Packed and also removes a matching number of WriteSpawnCallForObject. The whole thing is done in a CreateObjects context. Removing them all is fine as it forms a consistent block.

It its place, we now call a given number of NetworkShow. But each will generate a consistent set of bytes. This then works.

I've updated the branch and checked the new test NetworkShowHideTest, which passes.

I've also checked on my not-yet-committed spawn branch. It works there too, with all the traffic going in Snapshot Messages.

Can you please re-check and potentially approve ? (but yeah, the test should have been there in the first place)

Copy link
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.

This should work and is much cleaner now.

Looks like the only tradeoff is that we now run a few safety exception checks inside NetworkShow/Hide multiple times but I'd argue that's completely fine.

@jeffreyrainy jeffreyrainy merged commit 589882c into develop Aug 10, 2021
@jeffreyrainy jeffreyrainy deleted the experimental/snapshot-prep3-spawn branch August 10, 2021 21:57
SamuelBellomo added a commit that referenced this pull request Aug 11, 2021
…nsform

* develop: (32 commits)
  refactor: calling networkShow(NetworkObject) code in networkshow(List<NetworkObject>) (#1028)
  feat: snapshot. MTT-685 MTT-822 (#1021)
  test: adding a multi-instance test checking NetworkShow and NetworkHide on lists of objects (#1036)
  fix: corrected NetworkVariable WriteField/WriteDelta/ReadField/ReadDelta dropping the last byte if unaligned. (#1008)
  chore: run standards check over solution files (#1027)
  chore: replace MLAPI with Netcode in Markdown files (#1025)
  fix!: added plainly-callable Add() method to NetworkSet [MTT-1005] (#1022)
  fix: fixing incorrect merge done as part of commit 85842ee (#1023)
  chore: cleanup/upgrade serialized scenes (#1020)
  chore: replace MLAPI with Netcode in C# source files (#1019)
  test: add network collections, struct and class tests MTT-936 (#1000)
  test: add buildtests to test build pipeline on target platforms (#1018)
  chore: rename MLAPI types to Netcode (#1017)
  chore!: rename asmdefs, change top-level namespaces (#1015)
  Replacing community NetworkManagerHUD with a simpler implementation (#993)
  test: network prefab pools and INetworkPrefabInstanceHandler (#1004)
  fix: do not expose Runtime internals to TestProject.ManualTests asmdef (#1014)
  refactor: snapshot. merge preparation. Removing old acks, removing unused varia… (#1013)
  chore!: per-asmdef namespaces instead of per-folder (#1009)
  feat: snapshot. ground work, preparing depedencies. No impact on code behaviour (#1012)
  ...

# Conflicts:
#	com.unity.multiplayer.mlapi/Prototyping/NetworkTransform.cs
#	com.unity.multiplayer.mlapi/Runtime/Messaging/InternalMessageHandler.cs
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