Search Unity

Best approach to very basic turn-based Multiplayer (Wordfeud like MP )

Discussion in 'Multiplayer' started by oneuppedgames, Oct 12, 2015.

  1. oneuppedgames

    oneuppedgames

    Joined:
    Jul 30, 2013
    Posts:
    15
    Hi guys,

    Currently I am working on a simple casual game that I want to test with an online function. The game is played individually and is based on a singleplayer game (as there is no direct contact between players in terms of gameplay. Players cannot influence each others game).

    A player plays a game (based on a specific gameseed) and sets an individual score. Another player can then play the same game (with the same gameseed) and in the end both scores will be compared. The way the online multiplayer works is very similar to Wordfeud (aside from the part in which both players influence the same game). The basic idea is as follows:

    - Player starts and finishes an individual game (and sets a score)
    - Game (stats / settings) gets queued in a public gamelist.
    - Other (random) player starts a game and gets the first game (settings / gameseed) in the public gamelist.
    - Other (random) player gets the same game (gameseed) as player.
    - Both set a score, scores get compared, win/loss is distributed.

    There are a few little variations on this principle (i.e. when a player challenges another player), but this is the basic premise.

    I've been looking into this for a few days now (dev-time is limited, so I don't want to try out five different solutions), and the best (suggested) way is to have a database (MYSQL) for the public gamelist (and players and chat / stats / etc) and let the game do basic calls to and from this database (through PHP for example). I too see this as the most viable option, however, I really have no proper experience with building an PHP interface or the time and resources for maintaining a dedicated server. I'd rather use something out-of-the-box.

    I've experimented with Photon and this worked within 5 minutes, however it did not provide a logical way to tacle my problem (Photon works with rooms and is mostly for real-time connection).

    My question is: is there an out-of-the box solution for my (simple) problem? I've seen a lot of solutions so far, but I can't really see the forest from the trees anymore.

    Attatched some visuals of my needed data-flow (in links cause images are rather large in dimensions):
    http://oneuppedgames.com/unity/1.-populate-game-data-from-server.png
    http://oneuppedgames.com/unity/2.-player-starts-a-random-game.png
    http://oneuppedgames.com/unity/2a.-run-new-public-game.png
    http://oneuppedgames.com/unity/2b.-run-existing-public-game.png
    http://oneuppedgames.com/unity/3.-player-starts-new-versus-game.png
    http://oneuppedgames.com/unity/4.-a-game-gets-finished.png
     
    Last edited: Oct 12, 2015
  2. SpeakUpGames

    SpeakUpGames

    Joined:
    Nov 25, 2014
    Posts:
    56
    When I read the game description, the first thing that came to mind was that UNet/Photon/multiplayer would probably be too sophisticated for what you're doing and you probably want just MySQL/PHP; all you want is read/write from a database.
    PHP would probably be easier to learn than trying to learn a networking framework and stubbing much of it for what you want.
     
  3. boromir6

    boromir6

    Joined:
    Feb 23, 2015
    Posts:
    21
    You could probably skip SQL / PHP altogether and use a cloud backend service like Parse or PlayFab to store data and use push notifications as a form of async multiplayer. I've been using Parse free plan and I got basic multiplayer turn-based gameplay working in a few hours. Of course this may not work for your type of game, but IMO it's the easiest solution for async multiplayer I've found.
     
  4. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    Yeah, just to clarify what the two people above me already said: UNET aims almost specifically at real-time multiplayer right now, so it's probably not the solution you are looking for.
     
  5. oneuppedgames

    oneuppedgames

    Joined:
    Jul 30, 2013
    Posts:
    15
    Hi guys,

    Thank you for all your support so far. I agree that PHP/MYSQL would be the best solution, but unfortunately I don't think I'm able to get this up and running within a relative short timespan (as can be read in the OP). It's not that I don't want to look into this (how hard can it possibly be right), but I foresee a lot of issues with this solution (upscaling, server-maintenance, initial starting costs, security, etc) and I'm trying to steer away from this if possible.

    I also agree that UNET and / or PHOTON are overkill and stripping it down is probably a chore. I'll have a go at Parse to see if this works (I also found this one, but I wasn't sure if it would be overkill as well).

    I guess what I'm trying to ask is: is there a very simple database-based (cloud-based) out-of-the-box solution for my simple networking problem :D Like a prefab MYSQL-PHP subscription solution of sorts.

    Once again, thanks for the support.
     
  6. Katie-GameSparks

    Katie-GameSparks

    Joined:
    Oct 2, 2015
    Posts:
    13
    Hi everyone.
    Katie from GameSparks here.
    Gamesparks is great for turn-based multiplayer games.In gamesparks you can create challenges which can be turn based.We also provide challenge accepted, challenge won/lost messages and leaderboards out of the box with lots of room for customization via cloud code. It's free to sign up. Check out are website www.gamesparks.com.
    You can get in contact at info@gamesparks.com and a member of are team will be happy to talk to your more about your game and gamesparks.
    Thanks
    Katie