Network Culling Handler - Second player cannot see the first player

Options
Hi,

I added the CullArea, configured it, added the handler script to the characters. When the second player joins, he cannot see the first player(master), the first player can see the second player.

if I disable the cullarea gameobject, disable the scripts on the characters, both players see each other fine, so I definately know its the culling causing the issue.

No errors, infos, warnings in console. Both players show the same inside cell & subscribed cell info, I've tried playing with the size of the cullarea and the divisions, made no difference.

Sometimes, if I cancel play on first player/master, then hit play again and enter game, both players can now see each other, (this is random), it might take a few attempts to get that working.

Unity ver = 5.5.0p3
Photon ver = 1.80

Regards

Carme

Best Answer

Answers

  • Hi!
    I am getting the same issue :/
    The issue is always with the last player that joins.. That player can not see the others until another player joins, then the new player will get the issue but it will be fixed for the others..
    Any Solution?
    Thanks!
  • Hi @TheGamerX20,

    can you please test, if the other characters get visible for the last joined player, after they moved?

    A few other questions: Does this happen every time you run the game or is it just sometimes? Did you follow the instructions on the docs page and working with the RPGMovement Demo or with a custom project?

    If it doesn't work at all, can you please share us the project or a similar repro case where we can take a look at, since I currently can't reproduce the issue. To do so you can send a mail to developer@photonengine.com containing a link to the project files and a reference to this topic.
  • Hi @Christian_Simon,
    They're visible(since I set them by default to be Visible in my Project),
    But they do not send any update.. So they do not move at all.. or sync the rest of the variables.

    It is a Custom Project, But I followed the RPGMovement Demo Culling Tutorial
    I'd send it but it contains some models and stuff.. So I'll try to reproduce the issue in a new Project and see!

    Thanks for your Response! :)
  • TheGamerX20
    edited February 2017
    Options
    Hi once again! :)
    So, In the new Project everything is working fine.. on my Project however, I still have the exact same issue :/
    Not sure what the Reason is, Would changing scenes affect it? I'm changing the scene and disabling the message query when the Player joins a room and enabling the message query when the Scene is loaded(for different maps).

    Thanks!
    Regards
  • I found out the Issue!
    So, I am syncing quite a lot of Variables through the OnPhotonSerializeView, Which apparently causes this issue? I'm currently syncing 12 variables using OnPhotonSerializeView.. why does it cause the issue?

    Thanks!
  • The NetworkCullingHandler is permanently changing the attached PhotonView's Interest Group determined by the created Cull Area in your scene. Changing the group also affects the behaviour of the stream of OnPhotonSerializeView(...) - irrespective of it is reading or writing. Means that you may only send this data to a certain group once a second or receive data once per second from a certain group.

    Which kind of data are you trying to synchronize by using OnPhotonSerializeView(...) ? If it is transform data you can try using the PhotonTransformView component delivered with the PUN package. Or is it custom data which is necessary for the game to work properly?
  • Hi, @Christian_Simon!
    Thanks for your Response! :smile:
    I did not realize that, I am syncing custom data that is in fact necessary for the game to work..

    What about PhotonPlayer's custom properties? Can I use that? And is there a way to know when something in the Hashtable has changed?
  • Hi @TheGamerX20,

    using the Player's custom properties might be an option, as long as you don't have to update these values permanently at a high rate and update them less frequently like once a minute or even more rarely. If your game logic works with this limitation, you can use OnPhotonPlayerPropertiesChanged(object[] playerAndUpdatedProps) callback to respond to changes. You can find some more details here.

    Otherwise we need to find another solution for your problem.
  • Hi, @Christian_Simon

    It's an FPS Game.. so things will definitely change quite frequently.. for things like Weapons, Health, Kills etc..

    So what's the solution now? :/
    Thanks!
    Regards
  • Hi @TheGamerX20,

    to be honest, I currently don't know why OnPhotonSerializeView(...) isn't working properly in your case, since when two player getting close to each other they should be synchronized, at the latest when both of them are inside the same cell. Can you maybe share us the content of your OnPhotonSerializeView(...) function?

    However for synchronizing your additional, game relevant values you can think about using RPCs. But in combination with Network Culling you need some additional steps being handled by your game logic, since you need to switch to another Interest Group before sending the RPC and restore it afterwards. This might look like the following:
    int storedGroup = pView.group;
    pView.group = 0;
    pView.RPC(...);
    pView.group = storedGroup;
    This verifies that the RPC is sent to the default group and is received by all clients.

    There are maybe also some bugs (hopefully there aren't) in the Network Culling related scripts, so can you confirm that your game runs fine without set up Network Culling?