tranek / GASShooter

Advanced FPS/TPS Sample Project for Unreal Engine 4's GameplayAbilitySystem plugin
MIT License
953 stars 265 forks source link

GC_Sprinting on Listen Server plays sound in wrong place. #25

Closed sentyaanko closed 3 years ago

sentyaanko commented 3 years ago

When the Net Mode is set to Play As Listen Server and Sprint is executed on the client side, the Listen Server will play the sound on the RootComponent of Pawn, which is controlled by the Listen Server itself.

Currently, GetPlayerController->IsLocalPlayerController is used to determine if sound should be played or not. OnRemove and OnActive receive MyTarget, so I suggest using MyTarget->GetOwner->CastToPlayerController->IsLocalPlayerController.

tranek commented 3 years ago

I'm not sure I understand the issue here. In Listen Server, GetPlayerController->IsLocalPlayerController == MyTarget->GetOwner->CastToPlayerController->IsLocalPlayerController for the local player. Listen server does not spawn a separate process. The local player is the Listen Server and we want the sound to play on them.

Any other players' PlayerControllers will not be considered "local".

tranek commented 3 years ago

Ah, I understand now what the issue is. The Listen Server player will hear the sprint sound for all simulated clients. Got it. Thank you!