Search Unity

Server logic for Unity simple game

Discussion in 'Multiplayer' started by CyborgGames, Feb 18, 2019.

  1. CyborgGames

    CyborgGames

    Joined:
    Mar 2, 2017
    Posts:
    15
    I am new to game development, can you please give me an advice on how to implement a server for the game done on Unity for both iOS and Android platforms.

    There is a task: an online 1vs1 pin-pong game where you can bet your in-game currency. There are (for example) 3 game modes with a bet of 5, 20 and 100 coins. The player chooses which bet he wants to play and queues, then the second player queues for the same bet and a room is automatically created for them where they play against each other up to 10 points to win. It is desirable to implement the selection of opponents by skill/experience of the game. So the beginners play with beginners, and experienced with experienced (logic on the server). Again, the rooms should be automatically generated. There should be no lobby with a visible list of rooms, only the choice of a bet and the expectation of an opponent. The winner gets the full bet (without any fee). There must be a database to save the results and settings of each player. Authorization through social networks and email. Protection against cheaters is a low priority.

    How I planned: All physics and logic takes place on the client side. The server creates rooms for the players that waiting for opponents and provides the exchange of platforms location via UDP, and important messages/events via TCP. There will be no game physics and logic on the server side. This server will be connected to the database to save information, leaderboards and number of collected coins and so on ...

    Main tasks: C # server for Unity Own logic on the server Ability to work with the database.

    I wanted to use Photon server for these tasks, but I cannot understand if it is possible to bind a database, for example, MySQL, and process minimal logic on the server, is it possible at all? What server besides Photon is suitable for this project?(preferably free). I will be glad to recieve some help and to find the correct way to solve this problem.

    Thanks.
     
  2. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    154
    Hi, I have worked for the past year and a half with SmartFoxServer and I think you could give it a try. It supports all of the things you have mentioned and then some.
    On the server side the game logic needs to be written in Java or Javascript, they don't support C# but I have not found this to be a problem. C# and Java are almost brothers, they share the same syntax and for certain aspects Java is simpler than C#, imho.
     
    CyborgGames likes this.
  3. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    Yes, you can do this with the Photon Server. The Photon Server "Plugin" SDK should be a good fit. It enables you to use any C# libraries, DB connections and anything else on the server and run it effortlessly "per room". It comes with a free 100 CCU license.
    On the client side, you can use the PUN 2 Package and focus on using RaiseEvent() instead of using Instantiate, PhotonViews and RPCs. Those are pre-defined events and RaiseEvent() calls and not explained well, so you would have to decipher them before using them. You could save that effort.
     
    CyborgGames likes this.
  4. CyborgGames

    CyborgGames

    Joined:
    Mar 2, 2017
    Posts:
    15
    thank you very much guys!