[Improvement]: ObjectPickup: Explicitly notify other player about objects being picked up.

echtnice

Member
Hi,

I dynamically spawn networked ObjectPickup's (ObjectPool.Instantiate+NetworkObjectPool.NetworkSpawn). They should be destroyed once picked up. Currently they are only destroyed if picked up on the MasterClient because in ObjectPickup->ObjectPickedUp->NetworkObjectPool.Destroy we only broadcast the ObjectDestruction event when we are the MasterClient. With non dynamically spawn networked ObjectPickup's, Respawner+PunLocationMonitor is responsible for syncing the active state.

I worked around the problem by making all clients aware of the object being picked up. Patch is attached due to character size limit.

Now that the ObjectPickedUp2 (there is probably a better name for it) method is called on all clients, I was also able to play the pickup audio on all clients altough that is not part of this patch.

What are your thoughts on this? Regarding the pickup audio i'm not sure how to generalize my patch as I can imagine someone wants a pickup sound on all clients vs only the player who picks it up which is the current bahavior.

Thanks!
 

Attachments

  • NetworkAwareObjectPickedUp.txt
    9.2 KB · Views: 0
In theory it sounds good but it has been awhile since I looked at that system so I need to familiarize myself with it again more and get back to you. Having the audio play/not play on all clients does sound like it'll take some changes to the base class.
 
Yes, for now I carry some additional code which is kinda hacky ... I'll let you know when I figure out a solution that works for me
 
Top