Skip to content

fix: snapshot system. last fixes for release #1129

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 20 commits into from
Sep 2, 2021

Conversation

jeffreyrainy
Copy link
Contributor

Use GetSpawnCommand' GetDespawnCommand` to get default-constructed structs. Makes the code lighter and protects the code from needing to change when a field is added to those structs.

Keeps track of how many time a spawn was written to a message. Will be needed for controlling re-sends, but not used for now.

Empties the SentSpawn array, when spawns and despawns are ack'ed. It would grow unbound otherwise.

That should be it for SnapshotSystem for this release. :-)

…ing the sent info) from preparing the buffer to send
…t in the specified limit, instead of stopping once the limit is busted
@@ -1067,5 +1118,37 @@ private void DebugDisplayStore()
table += "======\n";
Debug.Log(table);
}

static internal SnapshotDespawnCommand GetDespawnCommand()
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see what this does. The struct constructor already initializes everything as default.

Copy link
Contributor

Choose a reason for hiding this comment

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

Like this is a struct it will not pass the static instance by reference 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.

Right. After re-trying seems like I was confused with C++ (again).
Was using SnapshotDespawnCommand command; instead of
SnapshotDespawnCommand command = new SnapshotDespawnCommand();
will fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can also do SnapshotDespawnCommand command = default (will do exactly the same as default constructor)

var diff = Math.Min(63, m_CurrentTick - spawnCommand.TickWritten);

// -1 to make the first resend immediate
return (1 << diff) > (spawnCommand.TimesWritten - 1);
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 pretty cool 😃

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.

Spawn/despawn backoff looks good.

@jeffreyrainy jeffreyrainy enabled auto-merge (squash) September 2, 2021 16:26
@jeffreyrainy jeffreyrainy merged commit b5b40de into develop Sep 2, 2021
@jeffreyrainy jeffreyrainy deleted the experimental/snapshot-system-spawn4 branch September 2, 2021 16:38
SamuelBellomo added a commit that referenced this pull request Sep 3, 2021
…hub.com:Unity-Technologies/com.unity.multiplayer.mlapi into sam/feature/interpolation-for-network-transform

* 'sam/feature/interpolation-for-network-transform' of github.com:Unity-Technologies/com.unity.multiplayer.mlapi:
  fix: networkscenemanager not releasing buffers from pool (#1132)
  test: fixed-length strings in netvars (#1119)
  fix: snapshot system. last fixes for release (#1129)
  refactor!: Unified Shutdown (#1108)
  chore: Fill out unity project for integration test project (#1128)
  feat: make ServerRpc ownership check an error log instead of warning log (#1126)
mollstam pushed a commit to Keepsake-Games/com.unity.netcode.gameobjects that referenced this pull request Feb 13, 2023
* feat: snapshot. MTT-1087 first part. separating the side effect (storing the sent info) from preparing the buffer to send

* feat: snapshot. MTT-1087 second part. Writing SnapshotMessage that fit in the specified limit, instead of stopping once the limit is busted

* feat: snapshot. MTT-1087 part 3. Writing spawns after acks, because spawns are limited in message size

* feat: snapshot. MTT-1087 part 4. Using max spawn message size from NetworkConfig

* feat: snapshot. mtt-1087. Forgotten , for performance

* feat: snapshot. MTT-1089 pessimistic resend control. spawn part

* feat: snapshot. MTT-1089 pessimistic resend control. despawn part

* fix: snapshot. Cleaning up our clientData.SentSpawns data structure. Otherwise it grows unbound

* feat: snapshot. Last fixes for release. Prepares for MTT-1089, but leaves it disabled

* feat: snapshot. Last fixes for release. PR review comments

* style: snapshot. Coding standards

* style: snapshot. Coding standards
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.

2 participants