Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Photon server side logic

Discussion in 'Connected Games' started by TheDavvyd, Feb 7, 2019.

  1. TheDavvyd


    Feb 15, 2015
    We are making multiplayer platform for multiple small games.

    we would like to do all game logic on server side to prevent cheating.
    also every room would need its own logic. as player is able to change game modes and game types.
    we do not require physics or simulations.

    is this possible with Photon or photon server+plugins ? and what are we losing by not using photon cloud ?
    Are there any better options that we should check out ?
  2. MrsPiggy


    Jun 13, 2018
    I'd recommend also checking SmartFoxServer 2X, it's a very solid product for projects that require server side coding and it's highly customizable.

  3. zhuchun


    Aug 11, 2012

    You need to pay OnPremise license fee, it's expensive somewhat if your server can only serve for a small number of players concurrently

    Headless server and other network solution, see also

    Yes, it's a solid product, but I'm not so sure about if it's a proper alternative to Photon. IIRC, SFS uses Java/JS as its server-side language.

    1. Photon do the serialization/deserialization for you, you may have to implement it your self in other solution, something like StreamWriter.WriteInt and StreamReader.ReadFloat.

    2. Photon plugins are pure C# projects, which means you CAN NOT use anything from UnityEngine, there're some tricks/hacks but no guarantee.

    3. Actually, there are lots of other things you need to know before you start if this is your first multiplayer game, is a good site for essential knowledge. If you've already known what you're going to do, then you're good to go, good luck :)
    Last edited: Feb 12, 2019 at 12:39 PM
    tobiass likes this.
  4. tobiass


    Apr 7, 2009
    Technically, this is the safe approach, yes. You will have to make sure you can run a lot of instances per server, or this easily becomes a very CPU intensive and costly approach as you run the full game (headless) per room.
    Also, you have to manage the instances and it affects matchmaking, etc. Unity's Multiplay and other services do this for you but then you're using a service once again.
    I'm not saying you should not do this. Lots of games do, in fact. But you are trading some problems for others.

    This means the benefit of running headless instances will be minimal.
    Your case is pretty much perfect for the Photon Server Plugins. You can run your own abstract logic on the server, prevent cheating and customize the in-room logic to your needs. You could create one assembly for game functionality, which can be run on the server and on the client.

    Without the Photon Cloud, you have to take care of the servers and set them up per region (if you wanted to). I would say it's not as complicated as running headless instances, as your server SDK provides the tech to scale it and it covers the matchmaking. The client will run with the Photon Plugin SDK as is.

    Preventing cheating and hacks is an ongoing battle. You're never done.
    We recommend using IL2CPP and client-side anti cheat packages (there are some in the Asset Store but I don't know enough to recommend either).
    The cheapest solution we came up with, so far, is to make the clients verify the actions of others. You will need to identify users/clients which hack/cheat and report them. Of course, this requires a backend service, which accepts reports (and identifies fake cheater-reports). This service can be independent from Photon or integrated with WebHooks in the Photon Cloud (without plugin or custom server).
    When you can ban cheaters with their accounts, your anti-cheat protections will make a difference.
  5. Munchy2007


    Jun 16, 2013
    Do you have any example of how something like this might be implemented?