Footsteps sounds not synced #2164
Labels
Area: sound
Related to sound (in-game or out)
Complexity: easy
Suitable for contributors new to Nitrox
Milestone
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:
(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'sBody
The text was updated successfully, but these errors were encountered: