Search Unity

On the MMO server subject...

Discussion in 'General Discussion' started by Vimalakirti, Jan 16, 2012.

  1. Vimalakirti

    Vimalakirti

    Joined:
    Oct 12, 2009
    Posts:
    755
    I have taken the advice of people to NOT try to make an mmo until getting other experience, and now I have other experience!

    I've been using Unity3d for 3 years. I started using JavaScript but changed to C#, learned object oriented programming, design patters, and have made all sorts of cool projects using Unity.

    Along the way I also have created data driven projects using Unity Web Player that dynamically load (and save) data from my server using PHP and MySQL. I can sign players up, store their data, send them a password recovery email if needed. I've also wandered off into web application development with html, css, JavaScript and jQuery.

    On the multi-player side I have used Leepo's fine networking tools and had success with that.

    I believe I am ready to take a foray into creating a small mmo-type of project.

    I would like to stick with Unity3d because I know it so well. My idea is to stick with something like a multi-player networking system, but have it coordinated by a server instead of one player's machine. I would like to move the game coordination to a server, but I just don't know how to do that. I want the server to be able to keep track of the evolving world in real time and to be able to 'log in' to that world at any time. If I could start with something very simple, like having a cube as a player that can move around on a plane, and a world that instantiates one sphere per minute in a random location, then I could work from there and make anything I want.

    How would I go about getting this to happen? Can I put a Unity project on the server? I just don't know how to get anything like this started.

    Any constructive help is appreciated.
    Thanks
     
  2. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    -Server will be separate application not dependent on Unity. Unity will be just client.
    -You need to think a lot about arbitration, to prevent players to cheat (movement, combat...)

    Actually it needs lots of know-how and if you ask such basic questions, you will fail.

    You can save thousands of hours of work by licencing some 3rd party networking solution according to your taste, but still you need to know, what are you doing
     
  3. Starsman Games

    Starsman Games

    Joined:
    Jan 30, 2011
    Posts:
    2,152
    With MMOs, it's not just about server networking code. How good are you with SQL? You will need some serious database skills to keep good track of the persistent world without sacrificing performance.
     
  4. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    I'm going to go out on a limb and somewhat disagree with Demostenes.
    I'm doing my own online sandbox project, and I started pretty much from scratch. Yes, I could have used Photon or other networking applications, but I wanted to understand the whole process more deeply, and I wanted to do it myself, from scratch.
    So far, so good. It's been a -real- challenge, but a very satisfying experience so far. I'm not under a time constraint, or have to meet any deadlines.

    I may be done in a year, or two, or three. It's not a huge project, but one that has been done more than once in the past by others. I'm still working on the foundation, but I haven't seen anything yet that tells me I won't be able to succeed.

    GRANTED...I'm not -done- yet :) But as I said, others have done it (in very small teams).
    So maybe it depends a lot on your game.

    As far as the steps to take, I can only list some issues I had to tackle:

    Read and make some simple client/server communication apps. Read up on tcp vs udp.
    Basic communication framework. Being able to talk back and forth to the client. Update player position, that sort of thing.
    Serialiazation...I'm doing my own. It's lean and pretty darn fast. Much better than the built in .net stuff.
    Data structures...these players are in this grid region. Only send messages from player X to them.
    Decide the relationship between the client and the server...fully auth server? Partial?

    I originally had both the client and server in the same unity project, bad idea. I split that out, the server is now fully .net. A big driver for this was it's SO OMG SO much easier to troubleshoot in Visual studio than Unity. I also use Resharper, big help there. Plus, I can make the server 64 bit.

    My development approach is iterative, and I work on the things at hand. I do not put in code in anticipation of features that I may or may not need. By the time you DO get there...the way things work will probably change. Also, when I get a little tired of coding or my mind gets a little bored, I start playing with other features. Like improving my skills at making realistic terrains. Or I play with 3d coat, or blender.

    I have a short attention span, and switching to different aspects of the project that excite me or I need to learn more about really helps.

    I just wish I had started earlier on my project. Let this be your inspiration:

    "A year from now, you will wish you had started today." - Karen Lamb
     
    Last edited: Jan 17, 2012
  5. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    You can cover basics, but further it is not that simple, for example you need to have some predictions of the player movement in case of packet loss, so player does not notice lag, etc. There are dozens of tricks like this...These things are very advanced and there is no need to reinvent wheel.

    If you have a time and you want to play with it, OK, write your own system, but if you want to make game in reasonable time, buy something finished.
     
  6. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    It's true...there are a lot of complexities. But overcoming each one gets you that much closer to the goal. But yeah, if you want it done ASAP...might want to check out something you can purchase to boost you along.

    I'm not saying it's easy. I'm saying it's doable.
     
  7. Vimalakirti

    Vimalakirti

    Joined:
    Oct 12, 2009
    Posts:
    755
    Yes, JC, this is exactly what I'm talking about! Do you have any links to tutorials which helped you get started?

    Some of my super-beginner issues are: How do I get a c# program to run on a server at all?? Where do I put it? How does it talk to my clients? Do php scripts call the c# program? Client calls php script which calls c# script which informs the php script which talks back to the client??

    I'm not asking you to answer these questions, just to point me in the right direction to get the answers I need.
    I need to know what the right Questions are.

    Many Thanks!
     
  8. npsf3000

    npsf3000

    Joined:
    Sep 19, 2010
    Posts:
    3,830
    Given that you don't appear to have a strong grounding in networking, my advice would be to create a simple MOG first.

    I'd consider using something like Player.IO to start with.

    Need any help, feel free to ping me and I'll give ya my skype.
     
  9. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    I'd suggest doing some googling on C# client/server tutorial, though some are definitely better than others. Get that going first, once you understand that you should be able to proceed to the next step.
    Unfortunately, I don't have any of the links, it was just google frenzy for a while :)
     
  10. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Have you checked out the Photon network server? You can have your game hosted in their cloud or on your own server.
    Complete Unity integration and API

    http://www.exitgames.com/
     
  11. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    To add onto that a reliable networking system is probably the hardest part to get right in any game that relies extensively on it.
    Rather save yourself the headache and let people who specialise in it, code it, and you focus on the development of the game.
     
  12. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
  13. wccrawford

    wccrawford

    Joined:
    Sep 30, 2011
    Posts:
    2,039
    I say go for it. If you have a basic understanding of game development (and you say you do) and networking, then you can make a small MORPG. (Yeah, no massively.) From there, the difference between them is mainly of optimization, with more players meaning more drastic optimization. You should be able to make a server handle 100 people with very few problems, so long as they're not all standing in the same location.
     
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I'd say get 2 player co-op going first as it'll teach you the fundamentals. That is what I am doing presently.
     
  15. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Co-op Hippo Ops? :p
     
  16. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    Hippo, did you decide to use GameKit? That's local wifi/bluetooth only, right?
     
  17. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Difference in development and difficulty between 100 and 1000 or 10.000 players is huge, but i dont know if that is good idea to plan game development arround 100 persons and later bulk player limit to tens of thousands. It might cause serious art rework, if triangle count or drawcalls might get out of the limits for characters especially, or it would require whole network code rework from ground up or even using some third party networking tool, i am not sure if its whorth it, unless you are doing it just for the sake of learning. I would say its better to have clear goals before you start with development.
     
  18. Vimalakirti

    Vimalakirti

    Joined:
    Oct 12, 2009
    Posts:
    755
    Use Leepo's Networking Tutorial. Easy as pie.
     
  19. coffinsnail

    coffinsnail

    Joined:
    Jan 3, 2012
    Posts:
    112
    i wonder if its easer to think like Guild Wars. where you have central towns that host alot of people at once, and i have noticed their engine does not draw charectures untill needed. i have seen players names moving invisable then appear, my guess is do to the sever only allowing so many charectures visually at once, thus clipping the max draw range.

    also why not think like this. i wonder if ya could host say a chat room style town, where 10,000 could be, form your group then exit into the actual game space thus one instance per say 8 players.

    just a thought.
     
  20. Stefano_1990

    Stefano_1990

    Joined:
    Oct 10, 2011
    Posts:
    278
    I played a lot of wow (I know, I know...) and the 'invisible -> appear' thing was due to textures being loaded. If you teleported to say Stormwind where there were 100 people in front of the auction house it took a while depending on your computer to load all the player textures. As a test I installed wow on my SSD and the players appeared almost instantly.

    This might also be what happened in guild wars. This is only a guess though.
     
  21. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Having more players than you can handle is a good issue. If you are working with an Indie budget and are having issues with 10k concurrent players (which is likely to mean hundreds of thousands of people signed up) then you are already a success.

    You can handle short term problems by having multiple worlds/servers whatever you want to call them; in the meantime build some revenue streams (why don't you have these yet?!?) and then go out and find some capital. Even having to rebuild large parts of the game is not really an issue at that point.

    Okay getting a bit off topic ...
     
  22. Alric

    Alric

    Joined:
    Feb 17, 2009
    Posts:
    331
    One of the surest ways to fail is not asking basic questions.
     
  23. Vimalakirti

    Vimalakirti

    Joined:
    Oct 12, 2009
    Posts:
    755
    THANK YOU!

    Even with YEARS of experience there's always somebody ready to shout 'Noob!' You gotta wonder why someone would post something purely critical. I guess some people need to feel smart by putting others down. Insecurity.
     
    Last edited: Jan 18, 2012
  24. shayne

    shayne

    Joined:
    Dec 26, 2011
    Posts:
    14
    If you can do C, have a study of some of those old everquest emulator servers (and remember, that there are huge legal issues around some of them, caveat emptor). Some of those had great scaleability and where well written, enough so as to seriously worry sony. You dont want to use them (although if the licence is right you could certainly pillage them for code I guess, again caveat emptor) but many have fantastic architectures that are well worth studying in detail for clues.