Search Unity

Game Server C++ How?

Discussion in 'Multiplayer' started by bloodtiger10, May 20, 2009.

  1. bloodtiger10

    bloodtiger10

    Joined:
    Nov 9, 2008
    Posts:
    619
    ok here I am stuck, I want to create a game server in C++ that can communicate with unity and such. But I have no idea how to do that nor how to create a server in xcode or visual studio or the linux version.


    I have windows 7 mac os x 10.5.6 and a linux ubunto (all 64 bit). I can make the server on either platform. I just need to know how to do it. I know C++ but have never dealt with networking for 3 years so I forgot all of it (networking in C++ not C++)
     
  2. matt77

    matt77

    Joined:
    Apr 14, 2009
    Posts:
    21
    Start reading about networking.

    The only way to communicate with unity from a c++ server is through sockets. You write your messages in the socket, and read them at the other side.
     
  3. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Actually, it should be possible to have a C++-based game server if you're using Raknet which is the library that Unity also uses. If you search the term Raknet on the forums, you'll find quite a bit of useful information on this.

    So, there's probably no need to directly use sockets.

    But I'd also recommend reading about networking and starting with very simple testcases - don't underestimate the complexities involved ;-)
     
  4. bloodtiger10

    bloodtiger10

    Joined:
    Nov 9, 2008
    Posts:
    619
    is there an example some where of that? or do you have one? because I have no idea what I am doing after reading the posts and everything.
     
  5. penman_f13

    penman_f13

    Joined:
    Sep 20, 2007
    Posts:
    5
    Depending on your needs you may find that some other tools out there accelerate your project.

    Take a look at SmartFoxServer for instance. You may not want to start from scratch as that's a fairly big endeavor.
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Then you are out of luck at least with unity's networking
    There is no available dedicated server for Unity, you need to write your own basing on RakNet and the known Ids
     
  7. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    That's why we recommended reading up on game networking ... it's a really big field.

    One route you could probably follow is learning to use Raknet, maybe create a little game using it ... just enough to feel really comfortable with Raknet. From there, you'll probably feel much better with the given posts here ... and be able to ask specific questions. Just don't assume that this is something you could learn within a week or two. You might even have to do some packet sniffing of a little Unity game you create yourself to get a bit of a better feeling for what's going on.

    Or take the route via SmartFoxServer as others have recommended. I know that Thomas has created some really nice stuff, including tutorials and examples. See for example: http://forum.unity3d.com/viewtopic.php?t=19770 (and do a forum search for SmartFoxServer).
     
  8. matt77

    matt77

    Joined:
    Apr 14, 2009
    Posts:
    21
    Only if you got the time to do reverse engineering... if not, raw socket is the way.