Question about networknig for an Authoritative RPG game.


I am in the process of developing a multi-player RPG style game and I'm looking for some insight on how to set up my networking architecture.

I was hoping to create the game in a semi-authoritative fashion, where players control, process, and send their own movement but any abilities or actions are processed by the server.

My current setup looks like this when a client uses an ability:
Client pushes ability key. Client sends their key press to the server via RPC
Server receives and relays to MasterClient
MasterClient receives and executes the appropriate ability "server side"
MasterClient sends the results back to the server
Server relays the results to the client.

Or at least I think this is how it works...
The trouble with this is latency. I get about 100ms from the masterclient (and regular clients) to the Photon Cloud server (I am in Los Angeles, CA. The ping seems high... but that's another issue).

This means that any time a player wishes to use the ability that have to wait over a second to see any results on their screen. In a game that takes split second decision making (abilities are often press more than once a second) this kind of delay is unacceptable.

My hope is that one of you fine people can point me in a better direction of setting up my game, or give me advice or insight of any kind.

Thank you for your time!



  • This is one of the situations where the Photon Cloud is not the very best choice. If you run some logic on another client and need the replies before you can act, then you can't avoid getting extra lag.

    In best case, you would host Photon closer to your players or you would host some Unity "server" instances for your players, close to Photon or even on the same machine. But in that case, you could potentially also make Photon authoritative in the first place.

    You can take a look at the Photon Server SDK and start hosting Photon and or modify it with some authoritative Operations for your clients.

    Get the Photon Server SDK here:
    and read: ... er-in-5min

    Make sure to set your Game Server config and to start "LoadBalancing" for PUN.
  • Thanks for the quick reply Tobias,

    Let me do a bit of reiterating to make sure I'm understanding everything correctly.

    It seems to me that the only difference between Photon and other hosting practices, is that Photon requires a MasterClient. The time between the connection of the MasterClient and the server is what causes the extra delay. I believe thats what your saying here:
    In best case, you would host Photon closer to your players or you would host some Unity "server" instances for your players, close to Photon or even on the same machine. But in that case, you could potentially also make Photon authoritative in the first place.

    The reason one can't ignore the MasterClient completely is that the Photon Server SDK, while allowing for some Authoritative logic, cannot handle much of the logic that a MasterClient can, for example physics calculation.

    This is where the idea behind 'headless' Unity clients, hosted at the same location as the Server, arises.
    You talk about it in this thread,
    The physics part is a limitation that you can overcome by implementing an own solution in server and client.
    Alternative you can do what some others did too and use unity headless clients as 'world simulation nodes' directly connected to the photon server from within your server cloud / cluster. These nodes would be explicitely developed for this purpose and thanks to being headless they require not remotely as much resources as the regular unity builds :)

    Could you expand on this idea a bit for me?
    Is there any type of documentation I could look at, or further research I could do, to understand this concept better?
    Any direction you could point me in to learn would be much appreciated.

    Thanks so much for your time Tobias!

  • Photon does not require a Master Client by definition but as it's just another client in a room, there is some additional lag you should take into consideration.
    However, if you would host your game on some user's machine (like Unity's Networking does), the lag could be very nearly the same as with Photon in the loop. Not all direct connections to anyone's machine are fast. In the end, Photon is just some hops more but has a low internal lag.

    There is no good documentation how to handle a lot of Unity instances on demand for rooms created in Photon, sorry.

    Basically, you would have to get rooms to create (or request) a Unity instance on the same server and treat that as Master Client (or you could come up with "Server Client" or some other term). You could treat the Unity instance as normal client or in a special way with specific messages to update it and to get updates from that instance.
    The down side of this is that you have to run Unity on your servers with all assets and everything "up to date" and compatible with the clients. So any update might hurt.
    It could be something that makes up a good "plugin" for the Unity Asset Store when done in a simple way.

    Another way would be to export the level architecture that you need in a simplified representation and load it in some physics engine you run on the server.

    I'm sorry that this is still relatively vague. This is such a big topic and there are so many options and things to keep in mind, that we don't want to go that route currently.
    However, it can be done :)
Sign In or Register to comment.