Scene PUN Object Health / Healing / Damage

Vlaxep

Active member
Hi,

Looking for the best and most efficient way to simply synch the 'health' of a SceneObject over Photon PUN 2.

So I just need to sync the object's:
AttributeManager > HealthValue

and sync based on Projectile Impacts causing 'damage', AND Magic Particle causing 'heal'.

My current setup results in differences between clients based on how they detect collisions, but I don't know what the 'best practice' should be, and am trying for the simplest existing solution with Opsive components.

All SFX and VFX relating to the health state at different percentages will be handled locally, I just need to sync the float value of the health.

I'm assuming this 'should' be performed on the MasterClient? Is that correct?

I'm just not sure how this works for projectiles, I don't know whether that's how projectiles normally work or not, nor for Magic Particles.

So I'm pretty sure that a 'SceneObject' will be controlled by MasterClient, but I don't know whether:
a) Master client should check each collision > adjust health > send RPC health update to others, OR
b) remote client should check each collision > send 'damage' or 'heal' message to master > Master updates health value > send RPC health update to all.

Would appreciate some guidance on how best to achieve this, please don't assume I know how projectiles and particles currently apply damage/heal! Speel it out lol.

Regards,
Vlaxep
 
Since PUN is peer to peer and you're not trying to stop cheaters I don't think there is a right answer. With that said, going route a does seem to be the most straight forward.
 
Thanks Justin,

Have solved this by disabling health component while NOT MASTER.

The Master uses the OnDamage/OnHeal events to run a method in a custom script I added which sends the updated HealthValue in Attribute Manager by RPC to 'others'. The remote clients then perform all necessary FX and store the new value in case of a MasterClient change
 
Last edited:
Top