Convert from PUN to Server - how hard is it?

Options
Hi! I'm just starting learning Photon PUN now, and it seems very straightforward. However I'm making a Moba kind of game, and I'm thinking if I instead should make it with Photon Server, to prevent cheating.

But is the process of working in Photon Server completely different, or is there some logical way to convert from PUN to Server later, in case of many people playing my game?

At the moment I'm trying to put the authority in the master client, so everyone sends commands, and most of the important logic and stuff like credits etc is stored on the master. This is currently a 1 vs 1 game, which means 50% of the players would be able to hack/cheat the game.

I'm sorry if the question is unclear as I'm still rather new to Photon. Thanks! :)

Comments

  • chvetsov
    Options
    Hi, @nicmar

    PUN uses photon server as backend. you may write your own plugin and use it to add anti-cheat checks

    best,
    ilya
  • nicmar
    Options
    Thanks, I was struggling to figure out how to switch from master-client/client to server/client, but I will look into plugins and see if I understand how it works.

    I saw some Unity tutorial (unet?) where both server and client used the same code, it only had code snippets like if (Network.isServer) {.

    Is it something completely different in Photon, or do I still use the same code to run an authorative server, for example to run all the physics?
  • chvetsov
    Options
    I would ask @JohnTube to answer this question.

    but in general, the same approach does not work in case of Photon. All that you could do is write your assembly and share it between server(plugin) and client

    best,
    ilya
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited July 2018
    Options
    hi @nicmar,

    Thank you for choosing Photon!

    You are still thinking in terms of UNet and client hosted games where one of the clients becomes "server" and all others connect to it.

    In PUN, this is not the case.
    Even the Master Client is just a normal client that we just delegate to some extra tasks but it is in a no way a proper "server".
    In PUN there is PhotonNetwork.isMasterClient check equivalent to Network.isServer. But that's still the old way you are moving away from.

    So as my colleague @chvetsov already mentioned, your custom server authoritative code should go into a plugin DLL. So server and client code bases are separate but they could have compatible shared stuff (assembly, classes, enum, etc.) since it's all C#.