Search Unity

[question] how to MMO Server

Discussion in 'Multiplayer' started by goguma, Nov 3, 2009.

  1. goguma

    goguma

    Joined:
    Nov 3, 2009
    Posts:
    5
    hi guys.
    i have a question.

    i made game server by c++.
    how to use in unity.

    i want to play web and consol mode.

    please tell me that way.

    ------------------------------------------
    sorry, i have a short english.
     
  2. Ethan

    Ethan

    Joined:
    Jan 2, 2008
    Posts:
    501
    Welcome to the forums :)

    Unity uses an older version of RakNet for its networking stuff it this helps you.

    I think the better way for you would be: import DLLs with your own networking client-logic into Unity and use it with Unity's C#.

    ethan
     
  3. goguma

    goguma

    Joined:
    Nov 3, 2009
    Posts:
    5
    thank you .

    i watch the master server using raknet

    master server is developed by c++.
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    the master server though can't be used for any network gaming with unity networking, its only game listing.
     
  5. goguma

    goguma

    Joined:
    Nov 3, 2009
    Posts:
    5
    thank you dreamora

    i have a question. master server listen to game client.
    how to master server listen the client.

    if that is right, how to create socket in unity.
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    The master server has no code to listen to them outside of the MasterServer.xxx and Network.xxx functionality in unity.

    For anything else you would have to add in.
    As for sockets: See System.NET on MSDN / go-mono.org :)
     
  7. zumwalt

    zumwalt

    Joined:
    Apr 18, 2007
    Posts:
    2,287
    http://www.unifycommunity.com/wiki/index.php?title=Simple_TCP/IP_Client_-_Server

    A simple TCP/IP client server code setup for Unity to help get you going, if you wrote your own Client DLL and your own Server DLL and you own PRO, you can use the C++ DLL's with DLLIMPORT as long as you follow the examples on how to get it to work with Unity found in the documentation, if you do not own Pro, you need to do a managed version using C# that is compatible with Mono.
     
  8. runningbird

    runningbird

    Joined:
    Sep 3, 2009
    Posts:
    382
    So we have to have PRO to use external DLL'S?


     
  9. zumwalt

    zumwalt

    Joined:
    Apr 18, 2007
    Posts:
    2,287
  10. goguma

    goguma

    Joined:
    Nov 3, 2009
    Posts:
    5
    thank you..^^;

    we are developing game that base web player.

    i read plugin but it worked stand alone.that didn't support web base game.

    how to develop mmo game on web based game.
     
  11. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    either by using sockets or a technology that uses .net sockets or by licensing the sources.

    if you are really developing an mmo and have the required funding to do so, the later might be a workable solution
     
  12. goguma

    goguma

    Joined:
    Nov 3, 2009
    Posts:
    5
    Is in sever program to develop by language (C++,java,c#).
    because server program listen to the socket from the client(unity client)

    simply server accept clinet and listen to the socket.

    so server program develop any language any platform.

    Is i think this wrong????
     
  13. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    hard to say if anything is right or wrong as you used a translator that destroyed any meaning in the text.
     
  14. zumwalt

    zumwalt

    Joined:
    Apr 18, 2007
    Posts:
    2,287
    I know of some folks who are using the built in Unity networking at the moment via browser, creating rooms, having about half a dozen people in those rooms at the same time, but as far as MMO, Unity has stated before that they intentionally do not allow plugins (C++ using DLLIMPORT) via browser, now, that said, Cartoon Network has a browser based MMO, I think there are a few more in the works or have been made browser based MMO's using Unity, I just simply don't know if they bought the source and did it, or if they worked within the confines of the Unity Raknet implimentation. Only they can answer that.
     
  15. shepherd

    shepherd

    Joined:
    Oct 16, 2006
    Posts:
    12
    We did it using .NET sockets (C#) and a custom packet protocol. We did not use the built in RakNet based network views.
     
  16. TrickyFishy

    TrickyFishy

    Joined:
    Aug 27, 2009
    Posts:
    39
    I'm working on a browser based MMO. My background is in server development and wrote my own in C# on both client server. They communicate using .NET sockets over UDP.

    http://www.youtube.com/watch?v=kCp2-nfibzY

    I'd be glad to share whatever I've learned if you have questions.


     
  17. jeffro11

    jeffro11

    Joined:
    Jan 7, 2010
    Posts:
    185
    I posted this the other day.
    http://forum.unity3d.com/viewtopic.php?t=41407

    We're going down the same road. So far we've only tested 50 clients, with our own I guess you can call it "protocol".

    This base should give you an idea how to start sending packets and receiving them via UDP.

    TrickyFishy, that's an impressive video :D Nice work.

    Curious though...Are you setting the players height automatically to the terrain's normal and just using X,Y to position the characters? All we have done so far is just a simple plane.
     
  18. TrickyFishy

    TrickyFishy

    Joined:
    Aug 27, 2009
    Posts:
    39
    Thanks for the compliment!

    The short answer to your question: in the video version, yes.


    I've made 3 major forks of this server:

    1. Simple relay (used in that video): clients send position updates to server. Server validates that both movement and velocity is VALID. Server partitions world space, checks entity visibility intersections and relays movement information to interested clients.

    2. Fully authoritative world:
    (Quake/Valve source-style protocol)
    input is buffered and sent from the client to the server. World server runs the simulation, calculates state deltas and sends them back. More complicated than it sounds! x,y z are all sent plus rotation and camera info (for 3rd person)

    3. Clustered authoritative world + gateway + 'hive': same as #2 but with two additional layers for scale:

    Code (csharp):
    1.  
    2.  
    3. SYSTEM INPUT
    4. Input -->     Route -->       Sim -->   Aggregate
    5.  
    6. client ___                 ___ world ___
    7.           \               /             \
    8.            \__ gateway __/               \___ hive
    9.            /             \               /
    10. client ___/               \___ world ___/
    11.  
    12.  
    13.  
    14. SYSTEM OUTPUT
    15. State-->       Route -->          Interpolate
    16.  
    17.                               ___ client
    18.                              /
    19.            ___ gateway-1 ___/
    20.           /                 \
    21. hive ____/                   \___ client
    22.          \              
    23.           \___ gateway-2 ___
    24.                             \
    25.                              \___ client
    26.