Hi, sometimes I have over 40 characters(2 players + enemies) at the same time, that I synced correctly. Now I want to add more than 20 NPCs (as walking people in the scene) whose their position matters (because their role may change dynamically).
I was wondering if the PhotonTransformView is the right choice? Or maybe there is a better way to do it with less data usage(on the network).
In general, you want to stop syncing position updates when characters / NPCs and enemies stop moving.
Most likely, the code you use to control NPCs and enemies has some flag if the character moved. If it didn’t, you could stop sending updates by providing your own, custom IPunObservable
code (possibly based on PhotonTransformView
).
There is some more background info in our docs.
PUN is not great for larger numbers of PhotonViews. Make sure to test what happens when the maximum of characters moves. You may have to apply “Network Culling” with Interest Groups. A prototyping script for that is provided in the PUN 2 package (see CullingHandler.cs
).
We didn’t see a good way to fix these limitations without breaking PUN 2 entirely, so we created Fusion as state of the art approach to networking. It would support this number of characters without hitch. I would recommend this for any upcoming project and anything that’s a prototype still.
1 Like