Skip to content
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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

tornac1234
Copy link
Collaborator

@tornac1234 tornac1234 commented Oct 30, 2024

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:

  • Only 30 packets/second are now required per tracked unit (players and vehicles) which is a lot better than it used to be (it had even poorer visible performance)
  • Packets will be lighter than before
  • New system is adaptable to poorer connections (there are two settings for the automatically adjusted latency system)
  • While having different latency between players might cause a bit of frustration (e.g being hit on another player screen while they're still safe on their own screen), it is the best compromise between performance and playability.

Tasks for myself 🍙🍜🍣 (I kept the best ones 😋):

  • Reimplement channels in LiteNetLib (we always had a setting in packets but we never actually fed it to LiteNetLib)
  • Create a new dedicated MovementReplicator MonoBehaviour responsible for reproducing players and vehicles movements, while automatically taking variable latency into account
  • Deprecate our old system (delete the old packets and MultiplayerCyclops (etc) behaviours)
  • Make some classes inheriting from MovementReplicator for the Cyclops, Seamoth and Exosuit to have their animations working accordingly with the replicated movement.
  • Have players be set to at the right position when they're driving a vehicle (vehicles packets' might require at least one more field or two for steering wheel and throttle data (can probably be reduced to a byte for the angles, and a bool for appliedThrottle), but as long as we know it's a cyclops, we can hardcode the relative localposition to avoid sending that data

Tasks assigned to @Jannify 🍕🍔🍟 (thanks for proposing your help 😀):

  • Finally make use of VehicleOnPilotModeChanged packet to be the trigger of a remote player entering/exitting a vehicle (and no longer have a very weird logic like the current Vehicles.UpdateVehiclePosition)
  • Ensure remote players remain in place during the driving (that I supposedly fixed with cyclops movement PR)
  • Rework docking and undocking accordingly to the new movement system (a trigger must be sent to start the animations, during which remote players will ignore incoming data for the vehicles involved)

Translations to be added to Weblate 📜🌐:

  • NitroxBandwidthSettings: Bandwidth Settings
  • NitroxHigherForUnstable_Tooltip: Give a higher value for more unstable connections
  • NitroxSettingsLatencyUpdatePeriod: Latency Update Period (s)
  • NitroxSettingsSafetyLatencyMargin: Safety Latency Margin (ms)

Context images for the translations:
image

@tornac1234 tornac1234 added Type: bug Area: vehicles Related to vehicles (seamoth, cyclops, prawn) Complexity: hard Requires deep understanding and/or hard to setup and verify Area: player Related to player character actions Type: enhancement Issue is to be solved by implementing new features labels Nov 1, 2024
@tornac1234
Copy link
Collaborator Author

tornac1234 commented Nov 3, 2024

This PR is now ready for both tests and reviews :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: player Related to player character actions Area: vehicles Related to vehicles (seamoth, cyclops, prawn) Complexity: hard Requires deep understanding and/or hard to setup and verify Type: bug Type: enhancement Issue is to be solved by implementing new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants