Custom Network Culling implementation

Options
Hello guys.

I had upgraded recently from v1.51 to v1.81, and I just saw now the problem about disconnection on v1.82, so I'm upgrading to v1.83 :D .

I had a question about network culling. I'm not gonna lie, I haven't check your culling demo yet :D , but I look at the network culling code from PUN+ directly and wanted something different (not cells).

Currently I'm using mainly OnPhotonSerializeView to sync my players + plus some RPC on the side for specific actions. What I would like to be able todo is basically have a way from OnPhotonSerializeView so send only the stream to specific players, not all of them. Basically, I would maintain a status of each player which indicate to whom the local player have to send his information and then send to only those. My problem is there seems to be no way out-of-the-box currently in order for me to restrict to whom the stream from OnPhotonSerializeView is sent, so it will be sent always to all the players.

How can I achieve this with v1.83 code base? I'm ok to get dirty and go modify some Photon code, as long as I get a little guidance from you guys. I was thinking about 2 implementations:
1) Either i dig into OnPhotonSerializeView related code and find a way todo what I want, assuming all this code is in C# and can be made, not hidden deep down in the native code. Is that feasible?
2) Stop using OnPhotonSerializeView and use RPC call instead to sync players information (pos, rot, etc) , which allow to specify PhotonPlayer as recipient. That would be nice, but I think there might be an overhead cost to use RPC instead at a high frequency (10-15 per seconds)?

Regards,
Eric

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @dontonka,

    Thank you for sticking with us and apologies about the 1.82 issue.

    I invite you to read our newly published "Interest Groups" documentation page. It's a good start for what you are looking for and it's what we use in our Network Culling demo.
  • Bunzaga
    Options
    This is perfect for what I was imagining just yesterday... A masking system, similar to a physics engine, where entities have a local mask, as well as a group mask. Entities only get updates for things set in their group mask, and broadcast their data only to other entities with their local mask set.

    Then each client would be responsible to know what their group mask should be, or their 'interest group', based on distance, vision, team, etc.

    Anyway, I might have to mess around with it, but I'm glad to see this feature, because like dontonka, I was a little frustrated that it was all controlled on the server side.
  • dontonka
    Options
    So I have implemented my own thing which seems to work great, with RPC, as I find out that my first suggestion was not possible as it controlled from the native code. I created a new RPC method which accept a PhotonPlayer[] and in TargetActors flag I pass that list of view Ids (thanks to you for passing a list of Ids). Then the owner of the view similary as you do in PhotonHandler main loop compute when message needs to be sent for each player, and I maintain a table so that the local player knows which other players are require HD update rate and others which doesn't. Final result is that I'm sending updates to players according to their own pace individually. The table maintaining the sync rate is made by another RPC, so I'm not doing any pooling there.

    Cheers,
    Eric L.