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

Footsteps sounds not synced #2164

Closed
tornac1234 opened this issue Aug 13, 2024 · 0 comments · Fixed by #2177
Closed

Footsteps sounds not synced #2164

tornac1234 opened this issue Aug 13, 2024 · 0 comments · Fixed by #2177
Labels
Area: sound Related to sound (in-game or out) Complexity: easy Suitable for contributors new to Nitrox
Milestone

Comments

@tornac1234
Copy link
Collaborator

tornac1234 commented Aug 13, 2024

Sound emission is in FootstepSounds.OnStep, a manual EventInstance start depending on hardcoded Player.main states.

It is estimated that there are 2.5 steps/second

Envisaged solution for minimal performance and network overload:
create a packet (playerfootstep) containing:

  • ushort playerID
  • byte assetIndex

(packet should be 3 bytes)
server processor needs to only forward the packet to other players which can hear the sound (take inspiration from FMODAssetProcessor.cs, check for same sub and distance between players < some hardcoded value, maybe 20f) (thanks @Jannify)

client processors need to find the player associated with playerID, and do the playing steps sound part in FootstepSounds.Onstep (from EventInstance @event = ...) using data that they can compute for each player:
fmodasset can be deduced by assetIndex (can make a switch with hardcoded cases 1, 2 and 3 corresponding to precursor, metal and land), volume needs to be calculated with FMODSystem.CalculateVolume, velocity is to be determined by adding some kind of velocity measurement (every frame, velocity = (position - prevPosition) / Time.deltaTime, prevPosition = position), 3D attributes can be determined easily with the remote player's Body

@tornac1234 tornac1234 changed the title Foosteps sounds not synced Footsteps sounds not synced Aug 13, 2024
@tornac1234 tornac1234 added Complexity: easy Suitable for contributors new to Nitrox Area: player Related to player character actions labels Aug 13, 2024
@Measurity Measurity added the Area: sound Related to sound (in-game or out) label Aug 13, 2024
@tornac1234 tornac1234 added this to the 1.8 milestone Aug 13, 2024
@tornac1234 tornac1234 removed the Area: player Related to player character actions label Aug 13, 2024
@Measurity Measurity linked a pull request Sep 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: sound Related to sound (in-game or out) Complexity: easy Suitable for contributors new to Nitrox
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants