Skip to content

fix: client authoritative NetworkAnimator skips sending to 2nd player when in server mode#2127

Merged
NoelStephensUnity merged 39 commits intodevelopfrom
fix/client-authoritative-networkanimator
Sep 28, 2022
Merged

fix: client authoritative NetworkAnimator skips sending to 2nd player when in server mode#2127
NoelStephensUnity merged 39 commits intodevelopfrom
fix/client-authoritative-networkanimator

Conversation

@NoelStephensUnity
Copy link
Copy Markdown
Member

@NoelStephensUnity NoelStephensUnity commented Aug 16, 2022

This PR is based off of florius0's user-submitted PR-2115. This resolves the issue where if only two clients were joined the second client would not be updated when running a server and not a host.

MTT-4384
This also pertains to #2114, #2134

Changelog

  • Fixed: issue when running a server and not host the second player would not receive updates unless a third player joined.
  • Fixed: issue where late-joining client transition synchronization could fail when more than one transition was occurring.

Testing and Documentation

  • Includes integration test updates.

This includes coverage for running in server mode only as well as validates the fix where a second client will receive updates.
Adding changelog entry.
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review August 16, 2022 16:29
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner August 16, 2022 16:29
@NoelStephensUnity NoelStephensUnity enabled auto-merge (squash) August 17, 2022 21:54
@NoelStephensUnity NoelStephensUnity marked this pull request as draft August 18, 2022 20:28
This fixes some additional issues with trigger synchronization.
adding comments about this change
Removed the bool from ProcessAnimationMessageQueue as it was no longer needed.
replacing the bool... (doh) ><
Needed that to mark the message processed.
Looking at the possibility of fixing the multiple trigger issue (i.e. multiple triggers are fired in the same frame on the same network animator that creates multiple transition states.
Still work in progress.  This revision adds the ability to synchronize late joining clients with more than one trigger that might have been triggered recently.  This only will be synchronized if the layer's current state hash is the same as the trigger's current or next state hash.
comments.
white space fixes.
NoelStephensUnity and others added 6 commits August 24, 2022 15:12
This is a new approach to synchronizing transitions with late joining players without having to actually set the associated conditional trigger.  By building a small list of all states and then building a quick lookup table, we can just synchronize the "transition state" which for late joining clients is a cross fade between the start and destination state.  We synchronize the normalized time (where it was in the transition on the server side when the client connected) of the transition this way as well.
Now, we just synchronize states (which some can be transition states).
Updated a property name and added some network log warning and error messages.
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review September 19, 2022 18:46
@NoelStephensUnity NoelStephensUnity marked this pull request as draft September 21, 2022 01:05
NoelStephensUnity and others added 5 commits September 23, 2022 08:38
Since the next update will be a minor revision, removed the "if defs" and just using ISerializationCallbackReceiver.
- Removing the packing since we gain nothing unless we are packing unsigned long values.
- Caching the NetworkManager to assure we have one when cleaning up on the server side.
- Added an error message and removed TODO comment.
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review September 28, 2022 17:32
@NoelStephensUnity NoelStephensUnity enabled auto-merge (squash) September 28, 2022 17:42
removing some CR/LFs.
@NoelStephensUnity NoelStephensUnity merged commit f98e7a2 into develop Sep 28, 2022
@NoelStephensUnity NoelStephensUnity deleted the fix/client-authoritative-networkanimator branch September 28, 2022 18:18
jakobbbb pushed a commit to GooseGirlGames/com.unity.netcode.gameobjects that referenced this pull request Feb 22, 2023
… when in server mode (Unity-Technologies#2127)

co-authored-by: Vadim Tsvetkov
co-authored-by: Andrei Soprachev
* fix: animator syncronization for >2 clients
* fix: remove redundant rpc call when host
* test
This includes coverage for running in server mode only as well as validates the fix where a second client will receive updates.

co-authored-by: Noel Stephens - Unity
* fix
Fixed some additional issues with trigger synchronization.
Removed the bool from ProcessAnimationMessageQueue as it was no longer needed.

* fix
This is a new approach to synchronizing transitions with late joining players without having to actually set the associated conditional trigger.  By building a small list of all states and then building a quick lookup table, we can just synchronize the "transition state" which for late joining clients is a cross fade between the start and destination state.  We synchronize the normalized time (where it was in the transition on the server side when the client connected) of the transition this way as well. Now, we just synchronize states (which some can be transition states).

* test
increased number of clients
Fixed issue where the late joining client was not being shutdown at the end of the LateJoinSynchronizationTest.

* update
NetworkAnimator uses ISerializationCallbackReceiver to build its transition to states table for late joining client synchronization when a transition is ocurring.

Co-authored-by: Vadim Tsvetkov <florius0@ninsar.pro>
Co-authored-by: Andrei Soprachev <soprachev@mail.ru>
Co-authored-by: Unity Netcode CI <74025435+netcode-ci-service@users.noreply.github.com>
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