Projectile Lag Compensation

Hello,

Using Photon Engine for my tower defense game. I am not using photonView on bullets/projectiles, because they have stable speed and target. I am using rpc for instantiating bullets. The problem is there is a lag happening from turret to target across clients. And need a fix for this. I have a code in Bullet's update code, which is leading the bullet to target. Is it mandatory to use onPhotonSerializeView for fixing lag issue?

Thanks.

Answers

  • You don't have to use OnPhotonSerializeView but it's a simple way to frequently send updates for a networked object. You can reimplement it any other way, of course.

    However, in most cases, your projectiles should not need updates. It is usually not feasible to network them, as there are so many. In best case, their trajectory is pre-defined and you only need to send some values to actually shoot.

    Yes, there are projectiles that are slow and change their path but that should be rare. Even for them, you only need to send updates when the path changes significantly.

    I would recommend using Quantum or Fusion for a tower defense game. Quantum is not (yet) freely accessible but its determinism is a perfect fit for those games and works well on mobile. Fusion is at least tick based and you can sync projectiles much more precise with less effort than in PUN 2.