-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Movements overhaul #2189
Movements overhaul #2189
Conversation
…timization), added a setting to adjust movement latency
… with reduced packet load
…s latency managing, and files cleanup
…w one integrated in the new movement system
…being set correctly
This PR is now ready for both tests and reviews :) |
NitroxClient/Communication/Packets/Processors/VehicleDockingProcessor.cs
Outdated
Show resolved
Hide resolved
NitroxClient/MonoBehaviours/Vehicles/ExosuitMovementReplicator.cs
Outdated
Show resolved
Hide resolved
NitroxClient/MonoBehaviours/Vehicles/ExosuitMovementReplicator.cs
Outdated
Show resolved
Hide resolved
NitroxClient/MonoBehaviours/Vehicles/SeaMothMovementReplicator.cs
Outdated
Show resolved
Hide resolved
NitroxClient/MonoBehaviours/Vehicles/SeaMothMovementReplicator.cs
Outdated
Show resolved
Hide resolved
NitroxClient/MonoBehaviours/Vehicles/SeaMothMovementReplicator.cs
Outdated
Show resolved
Hide resolved
Translations string has been added to Weblate, modified the format a bit so it matches with existing keys :
|
… being deleted when the vehicle is gone, being too far from the piloting chair, destroying a cyclop's objects would bug for players outside the cyclops, remote player wrong rotation in bases
43d370b
to
b6b86ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typical merged it a few minutes before I finished the review I was doing. Sorry for being slow but thought I would still comment them. Good code!
@@ -111,10 +111,11 @@ public void ProcessUpdate(TimeChange packet) | |||
|
|||
latestRegistrationTime = DateTimeOffset.FromUnixTimeMilliseconds(packet.UpdateTime); | |||
latestRegisteredTime = packet.CurrentTime; | |||
|
|||
|
|||
// We don't want to have a big DeltaTime when processing a time skip so we calculate it beforehands |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// We don't want to have a big DeltaTime when processing a time skip so we calculate it beforehands | |
// We don't want to have a big DeltaTime when processing a time skip so we calculate it beforehand |
|
||
public void Update() | ||
{ | ||
float currentTime = (float)this.Resolve<TimeManager>().RealTimeElapsed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this to be cast to float or can we have it as it is for the evaluation of the if?
|
||
if (latency > maxAllowedLatency) | ||
{ | ||
maxAllowedLatency = latency + SafetyLatencyMargin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This calculation seems strange to me, we are saying are we higher than the max allowed and then resetting that. It feels like if it's the max allowed we shouldn't go past this. Interested in others thoughts
} | ||
} | ||
|
||
float occurrenceTime = time + INTERPOLATION_TIME + maxAllowedLatency; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this won't this calculation be different for everyone and so mean each client has them out of sync?
if (simulationOwnershipData.GetPlayerForLock(movementData.Id) != player) | ||
{ | ||
Log.WarnOnce($"Player {player.Name} tried updating {movementData.Id}'s position but they don't have the lock on it"); | ||
// TODO: In the future, add "packet.Data.RemoveAt(i);" and "continue;" to prevent those abnormal situations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this not be an easy thing to do now? Why wait?
* Changed movement replicator's buffer to be a LinkedList (very good optimization), added a setting to adjust movement latency * Huge improvements to get a smooth movements for seamoths and exosuits with reduced packet load * Reimplement channels into LiteNetLib * First attempt at implementing a variable latency adaptor * Fix channels (again), add two settings for better control of movements latency managing, and files cleanup * Deprecate the current vehicle animation system and replace it by a new one integrated in the new movement system * Fix seamoth enter sound playing all over the map, cyclops driver not being set correctly * Restore driver state of other players when connecting to a server * Fix remotely driven exosuits' animations * Fix a possible divide by zero from TimeManager.DeltaTime * Refactor docking code to bring it up to new standard * Decouple docking patches from Vehicles.cs * Supress MovementReplicator during (un)docking * Fix docking processor * Few corrections for docking and simulation ownership * Refactors and little corrections here and there * Add a movement broadcast rate limiter * Fix bugs: not being able to drive a vehicle, rate limiter entries not being deleted when the vehicle is gone, being too far from the piloting chair, destroying a cyclop's objects would bug for players outside the cyclops, remote player wrong rotation in bases --------- Co-authored-by: Jannify <[email protected]>
Reason for PR 🤔:
Current state of vehicles movements is really poor, both for regular play, and for testing the brand new #2106.
+ the network optimization behind movements is currently really poor and mostly random
Latest rework of movements (after modpocalypse) messed up movements sync, and it was never that suitable for Nitrox.
Benefits of the PR 🤩:
Will drastically improve movements for players and vehicles:
Tasks for myself 🍙🍜🍣 (I kept the best ones 😋):
Tasks assigned to @Jannify 🍕🍔🍟 (thanks for proposing your help 😀):
Translations to be added to Weblate 📜🌐:
Context images for the translations:
