High ping PUNBasis

i have done the PUNBasics demo with PUN2 and i calculate the ping myself: with RCP, i send a call and the 2nd player send me back the call. I get around 100-200 ms and it's very variable. The ping with the EU server is 42ms (written in the log at the launch of the game), being in France. I would like to know if my calculation seems right (according to the EU ping). And also, how can I get this ping better ? But maybe this is normal and there shouldn't be any latency ? Because for now the demo doesn't seem to lag or just a bit but maybe it's because the game is quite simple ? It's very important cause i have to decide if I'm gonna use photon for the game project of my company. (which would rather like to keep a free version).


  • TobiasTobias admin
    edited April 2019
    Typically, you should not need to calculate your own ping. Internally, the library will do this anyways and on a much deeper level, so you would reimplement this with .. less clear results.

    Using an RPC for this is not entirely fair either. It's not being sent right after you called it. Instead, it is queued and sent with any other updates (in regular frequency but not tied to the RPC call).
    You may speed this up with PhotonNetwork.SendAllOutgoingCommands(), right after the RPC.

    Also, this is a reliable command. It can not be executed if any prior reliable command got lost or delayed, so the speed of it depends on other commands. That's not perfect for a ping value.

    I guess you also make the receiver reply with another RPC? All in all, this will be quite some traffic, just to ping pong a time value.

    Use GetPing() instead. You may send the local value to anyone else, if needed.

    If your company "would rather like to keep a free version", they probably compare apples to oranges. Photon does a lot more than most networking solutions to which it's often compared. Care to let us know the other options and something about your project?
  • Yes i did a receiver reply with another RPC. I will try what you said thank you. I understand ok, but it was just to see the real time it takes for a message to come back, without using the functions given by Photon as I don't know what's in there. But I used getPing beside to get the ping to the server, around 40ms all the time. I think we might use Photon, there is just one thing: the games are often turned based game, is it really possible to do it with PUN ? How long datas are kept ? I've seen like 60min but i would like to continue a game days later. I did a lot of crossed researches and right now, i'm confused.

    I mean I think they are ready to pay the licence etc but not something monthly too expensive for them, regarding the health of the company.
  • Sorry for the late reply.

    About your new question if turnbased games are possible with PUN:
    Yes and no. The PUN layer itself (PhotonViews, RPCs and such) is not entirely suitable for turnbased games. If you skip the PUN specific features (PhotonViews and related) and instead use RaiseEvent and Custom Properties, then you have a good foundation for turnbased games that can even be stored and loaded on your own service.
    RaiseEvent and Custom Properties are part of the Photon layer called "Realtime" or "Loadbalancing" and here's a doc about long running turnbased games:

    You will need some backend, that stores per player data (the save games). However, to find savegames, have friends, etc, you probably need such a backend service anyways. PlayFab and player.io are suitable.

    The license fees are for development and running Photon. The pricing is quite low for what it does but of course it's not a solution to all situations. One of it's strengths is that it can be combined with other backends where needed. So maybe you just use it when you are working on a game that's better with realtime interaction / updates.
    On the other hand, Golf Clash (just one example that comes to my mind now) benefits from seeing the other player's actions during her turn - even though the game is strictly speaking turn based. You just see how the other side prepares for the shot and that makes it more .. interactive (it's not just wait time).

    Hope that helps.
Sign In or Register to comment.