Optimizing PUN+ Networking

Options
Hi devs! I'm working on a multiplayer FPS project with PUN+ and I was wondering what was the best method (or if there is a guide) to optimize the networking and minimize msg/s and the Traffic. My first questions are, to instantiate a bullet or a hole of a bullet, is better to use PhotonNetwork.Instantiate or a [PunRPC] with Instantiate (obj); inside? And a question that troubles me a little, as they are understood Msg/s? each synchronized variable, RPC method called or variables passed to a method are considered a message? thanks for the answers!

Comments

  • vadim
    Options
    Hi,

    Just keep messages count and message payload size as small as possible, For bullets it means that you only need to send 1 'shoot' RPC with initial bullet data for visualization and 1 RPC to notify about bullet hit. It's essential not to create PhotonView for objects like bullets and holes to save resources.
    Message is either RPC or object synchronization call with all properties (~10 times per sec. per object). Instantiation, destroy and other similar calls are also counted as messages but used less frequently.
    Add PhotonStatsGui.cs to your scene to check current message send ratio.
  • LeafSAS
    LeafSAS
    edited March 2016
    Options
    Thanks for reply! Im working using rpc call, ill do some test with photostatsgui.cs, it's possible to check what message im sending? Thanks!
  • LeafSAS
    Options
    vadim said:

    Hi,

    Just keep messages count and message payload size as small as possible, For bullets it means that you only need to send 1 'shoot' RPC with initial bullet data for visualization and 1 RPC to notify about bullet hit. It's essential not to create PhotonView for objects like bullets and holes to save resources.
    Message is either RPC or object synchronization call with all properties (~10 times per sec. per object). Instantiation, destroy and other similar calls are also counted as messages but used less frequently.
    Add PhotonStatsGui.cs to your scene to check current message send ratio.

    I'm working on msg/s, i don't know why but i'm getting over 30/40 msg/s for each player if i try to send messages (like moving, jumping, shooting etc.) on first 10-20 seconds when player join room, if i wait a few seconds and try to send messages all work fine (i got max 10-11 msg/s), no messages in excess, i'm investigating on it...