Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Database and Server Suggestions for a Simple MMO

Discussion in 'Multiplayer' started by ap.berry10, Dec 15, 2015.

  1. ap.berry10

    ap.berry10

    Joined:
    Sep 28, 2015
    Posts:
    2
    I'm looking to create a simple MMO and I am currently researching servers and databases. Ideally, I'd like something that is free, or very cheap which can be used commercially. What I plan to do is quite small scale, but I would also like to have the option of scaling up (somewhat efficiently) later on if need be.

    This isn't something I'm looking to create tomorrow. I'm just collecting some information and testing out different implementations. Any suggestions would be appreciated. Thanks.

    *Edit*

    I should also clarify that I'm not looking to create a browser game - just connect clients to my server.
     
    Last edited: Dec 16, 2015
  2. jroto23

    jroto23

    Joined:
    Oct 19, 2015
    Posts:
    82
    Unity Services offer cloud Db and relay servers. Another option is Photon servers but I don't how intergrated they are with mechanim, I think they are. Photon may now offer cloud DB, not sure on that. You need a DB to persist a players character even in a non persistent world so they can develop the character
     
  3. DRRosen3

    DRRosen3

    Joined:
    Jan 30, 2014
    Posts:
    683
    For databases you'd want to look into MySQL and a site for hosting your database(s). Right now UNet isn't optimized for MMO, but it is in the plans.
     
  4. ap.berry10

    ap.berry10

    Joined:
    Sep 28, 2015
    Posts:
    2
    Ok. Thanks for the suggestions. I've looking into MySQL a bit and it looks like that could work well for me.

    In regards to the server - My understanding of UNet is that it's simply not at the point in it's development where it would be an option for me since I would need an authoritative sever with a single persistent game world.

    What's the advantage of a Photon server over other possible set-ups?
     
  5. FStar

    FStar

    Joined:
    Sep 11, 2015
    Posts:
    50
    I'm doing something similar. My choices are also limited because I use Unity Free for both client and server and I need to stay on .NET 2.0 for this reason.

    The following is just my story, I'm not stating that this is the correct way to do it, just the way I do it currently.

    I started with SQLite using SQLite4Unity just to have something to prototype on. It works well but it can only be accessed by one thread at a time which is a bit too limiting for a real MMO. It could work for a multiplayer game with limited amount of database requests though.

    Recently I decided to switch to PostgreSQL using NPGSQL for .NET 2.0. The reason being mostly that it is completely free to use, it has even more generous license than MySQL.

    It's some work to get the basic CRUD operations in place in a convenient way because there is no LINQ or EF Code First, only ADO .NET and most likely you want some kind of framework on top of it to decouple code from database a bit and isolate the mapping between objects and data. I went with a very thin layer of model objects and some semi-flexible data context implementation to manage SQL queries and transfer of data to the models.

    There are libraries like MASSIVE, Sonic etc. that could normally do this CRUD work but they don't work in .NET 2.0. If you have a dedicated server without unity your life will be simpler.

    My server parts runs background threads that do the saving of data at set intervals, like 10 seconds for item data etc. When players manipulate inventories, collect loot etc. it'a all stored in memory on the server first and then on the next save job run the state is saved to database for all "dirty" records.

    Item instancing is a bit special, unique Id:s need to be generated for items, I currently let the database generate the id:s. It means actually doing an insert when the item is created. Not sure how that plays out in the long run...

    Anyway, this is more info than you asked for .. I'll stop rambling :)