Search Unity

"Simple" Multiplayer Networking Options

Discussion in 'Multiplayer' started by GoldFire33, Mar 31, 2010.

  1. GoldFire33

    GoldFire33

    Joined:
    Mar 31, 2010
    Posts:
    91
    I'm working on a "simple" multiplayer game (yes, I know, it isn't as simple as anyone would like it to be), but I'm coming from a background of 7 years of PHP/MySQL/AJAX development and moving to 3D game development is a challenge to grasp at times (especially now that I am diving into the networking side of things).

    I'm having a hard time figuring out what is the best way to go about setting up the network connections. I have been reading all sorts of manuals, tutorials, forum posts, etc for the last 24 hours, but I still haven't been successful in actually finding what I'm looking for.

    I have a dedicated server running linux that I want to host all of the games on. The game is semi-turn based, so there wouldn't be a large amount of data being passed between clients. There will only be 2-4 players in each game, but I need to be able to scale for a few hundred players on the server at a time (the server is plenty robust, so processing power bandwidth shouldn't be an issue).

    I also don't need to do much in the way of game logic on the server-side, but I would like to be able to update a MySQL database to have the results of the battle and the current state of the battle saved on some of the updates. Since Unity can't be run on Linux, I obviously have to go with some 3rd party solution or write my own (I sort of doubt writing my own would be the best idea).

    Technically just having a PHP script that would be polled to update everything would work (this is what I have been doing for years with my text-based web games), but this obviously isn't the ideal solution and has scaling problems. Any suggestions for how I can accomplish this, hopefully with open source software as my budget isn't very large right now (although if it is absolutely necessary I am open to anything).
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    as linux user without the interest to invest in SmartFox your option likely is: write a solution with C++ or another language that uses TCP / UDP sockets and talks to your game through sockets.
     
  3. GoldFire33

    GoldFire33

    Joined:
    Mar 31, 2010
    Posts:
    91
    Well I am open to using SmartFoxServer if that is actually the best way to go, but I was under the impression that this solution provided a lot more than I need and would sort of be overkill. Am I wrong in this assumption?
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    It seems like you want networking, database, small games, quite a lot of players and potentially a lobby of some kind which is pretty much what SFS is all about :)

    I really don't see much of an option aside of developing your own thing or implement the client and server side for RedDwarf for example and use that with your unity client.
     
  5. GoldFire33

    GoldFire33

    Joined:
    Mar 31, 2010
    Posts:
    91
    Are there better options if I were using Windows Server? I could potentially go that route if it would mean a better game experience. Again, I feel like my 100% background in traditional browser based games could be putting me at a disadvantage in the reasoning department. Linux is best for all things website for the most part, but I'm not sure when it comes to this kind of thing.

    I'm used to there being quite a bit of open source software for linux, so I assumed there would be some options that would work here. Is SmartFoxServer not just a type of COMET server?
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Not much, on windows, ExitGames server offers just become an option too.

    But it still means that you either pay for a solid base or have to develop it yourself.

    The primary difference linux vs windows, if you own unity pro, is that you could host headless client on your windows server to form "servers" for the game rounds, which is not an option with linux
     
  7. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    The twisted framework for python could be used server side along w/ simple TCP or UDP sockets on the client side.
     
  8. GoldFire33

    GoldFire33

    Joined:
    Mar 31, 2010
    Posts:
    91
    So let's say I've changed my mind and will be doing a live action based game with 10-20 people in each game, would SmartFoxServer (or possibly Twisted Framework) still be an ideal solution if I still want the games hosted on my server?
     
  9. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    all of these still remain an option :)
     
  10. jcullen24

    jcullen24

    Joined:
    Feb 27, 2010
    Posts:
    116
    Have you looked at Photon? I'm not to the networking stage of my project but the two options I'm looking at are, SFS, or Photon.

    Jim Cullen
     
  11. GoldFire33

    GoldFire33

    Joined:
    Mar 31, 2010
    Posts:
    91
    Not extensively. Any idea what the major differences are between them? I've been looking over the pages of them, but can't tell what, if anything, separates them.
     
  12. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    There are many things that seperate them:

    PHoton:
    High performance socket server with C# code for your server side application
    UDP low latency networking
    Windows only server side, many client platforms
    No lobby system etc present
    MMO Example framework for range based sync etc


    SFS Pro (I skip the lower end ones):
    Java server backend with support for java, as2, as3 code for your server side extension
    Only TCP higher latency networking (not suitable for action oriented work)
    virtually any platform that supports java
    lobby system, friends list etc
    nothing available in relation to mmo

    the licenses differ too.

    For action games and potentially MMOs (in the sense of many player, 1 world, direct interaction with each other in realtime) I would clearly go with Photon.
    For something like an interactive chat, or lobby + mini game / lobby + player hosted games I would likely go with sFS Pro as it offers these things out of the box already.

    I've naturelly the benefit that I can just say "I don't care about the server side language" as aside of AS2 I'm able to find my way around any of them. A bit less with AS3 than with the others but its the by far least complex language to learn for someone like me that came from the Blitz Languages / Basic Language style languages.
     
  13. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    There's always RakNet as well.
     
  14. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    if you want to work with standalone and write a plugin, yes.
    Otherwise: discussable, and definitly the by far hardest way of doing it as you must do 100% of the server backend, not just the app related code while the platform itself is there and granted to work :)
    Oh and C-Hell-Hell (sometimes also called C-Hack-Hack) isn't everybodys thing ;)
     
  15. GoldFire33

    GoldFire33

    Joined:
    Mar 31, 2010
    Posts:
    91
    Thanks for the information dreamora. Sounds like Photon is actually what I need since the new direction I am taking is away from turn-based completely and almost like a FPS. Too bad my server is a linux box.

    I'm curious, do you know that Photon is better for action-based games from experience, or from information on the site/forums? Just doing websites is so much simpler (no challenge anymore, one reason I'm looking into Unity now) :p
     
  16. GoldFire33

    GoldFire33

    Joined:
    Mar 31, 2010
    Posts:
    91
    Anyone know anything about other options like NetDog, Project Verse, or ReplicaNet? Or are these not compatible with Unity?
     
  17. UniLogic

    UniLogic

    Joined:
    Jun 3, 2010
    Posts:
    1
    I was wondering if you could follow up on this post. I'm curious to know which options you tried and what you've learned. I have the exact same background as you do. I have developed many php/mysql/js/ajax games which I am converting to 3d/unity web player apps. I have been considering SFS...
     
  18. GoldFire33

    GoldFire33

    Joined:
    Mar 31, 2010
    Posts:
    91
    I went ahead and used SFS. With my background it was the easiest for me to get up and running. Also, I couldn't even try Photon because my server runs Linux. The way SFS is setup works perfectly for what I need and the ability to add the extensions on the server side in Actionscript 1.0 (so basically JS) is really nice.