I'm currently working on a FPS game. I had audio working quite well on single player for my rifle (fires about every .1 second), but then I started using RPC calls for other players to hear the audio as well. This caused a terrible stutter in the audio, and reduced the quality greatly. Is there a way I could have the players locally determine the shots and play them at the shooting player's point? I want to try to avoid calling excessive amounts of RPCs, to avoid the bandwidth and lag issues.
My code Currently:
GetComponent().RPC("Fire", PhotonTargets.Others, gunAudioClip, transform.position); //(called every .1 seconds)
[RPC]
public void Fire(int gunAudio, Vector3 position)
{
AudioSource.PlayClipAtPoint(AudioClips[gunAudio], position);
}
↧