Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Authoritative server in UNTIY

Discussion in 'Multiplayer' started by unity_1SeL-HQ69UMA9g, May 25, 2018.

  1. unity_1SeL-HQ69UMA9g

    unity_1SeL-HQ69UMA9g

    Joined:
    Oct 7, 2017
    Posts:
    8
    How looks performance with server made in Unity?

    It is good to make authoritative server for MMO Survival game?

    It will be working without graphics, only physics calculations.
    Unity 2018.1 supports Jobs (multithreading). This is new feature so it can be not very good.
     
  2. Hoshiqua

    Hoshiqua

    Joined:
    Jul 22, 2016
    Posts:
    77
    As with any question you could ask with this level of abstraction, it depends.

    In this case, it depends on how much you rely on Unity's built in systems (GameObjects, Rigidbody components...).

    I don't think Unity is so good at mass simulating tons of GameObjects, even without rendering, and it would very, very probably die trying to simulate Rigidbody physics in an MMO world.

    However, if on the server you use the minimum amount of Unity related stuff (just one GameObject and one component to run the server itself), and then make your own entity system and your own networking system using Unity's low or high level API, I don't see why it should not be up to the task. Just make sure you activate headless mode, that way the server's FPS isn't capped (it will be plenty lowered with a MMO simulation to run anyway).

    But above all, it depends on the amount of work your server will have to do. Of course, no MMO is going to be ran on just one server. This means servers on room-based MMOs with "loading screens" between each rooms need much, much less performance (since you'll have many of them running together). However, if you're making a seamless world with "hidden" transitions between servers, well, unless you can hide the transition perfectly and handle all cases perfectly (what happens if an item is dropped on a border ? If someone dies there ? Builds there ?), then you won't be able to afford using many servers for the sake of user experience, and then they become more hungry for performance :)

    If you're worried about multithreading, you shouldn't be. Unity perfectly supports multithreading like any other C# application, the only problem being you can't change any important Unity values outside the main thread (an object's position for example), but of course that is not a problem if you're making your own internal entity system. Then it's up to you not to screw up and get unsafe, erratic code.

    If you're really afraid of running a dedicated server on Unity (which is fair I guess), I think it's possible to use Unity networking in a standard C# app.
     
    unity_1SeL-HQ69UMA9g likes this.
  3. unity_1SeL-HQ69UMA9g

    unity_1SeL-HQ69UMA9g

    Joined:
    Oct 7, 2017
    Posts:
    8
    I need unity for calculating AI mostly. I using this:

    https://github.com/antonpantev/unity-movement-ai

    Its on rigidbodies so .... hmmm

    MMO we are creating its Survival with small, medium and large worlds. It will be all on one server.
    Writing Ai script for that, outside unity is hard.

    Do you think we should do this without unity? Is it possible to achieve 100 CCU?
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    MMO's are usually not designed to be run all on a single server, and I'm not just referring to Unity. If you are designing it that way you it may end up being a mistake unless your MMO was exceedingly simple. Generally you would split up the game world across multiple servers.

    There's also multiple networking API's available for Unity. You should research them to see which one fits your specific use case. There is nothing in Unity that would prevent you from creating a MMO running on it, but you're going to have to put in a lot of work on the back end.
     
    unity_1SeL-HQ69UMA9g likes this.
  5. unity_1SeL-HQ69UMA9g

    unity_1SeL-HQ69UMA9g

    Joined:
    Oct 7, 2017
    Posts:
    8
    Maybe not MMO but Survival Online. Can this be on one server?
     
  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    If you scope and design your game so it can realistically be handled by a single server, then of course it can. It all comes down to how you design it, not some function of the engine.

    It sounds like you're pretty new to Unity, so I would suggest starting with a single player game so you can figure out what Unity does and is capable of. A multiplayer game is significantly more complex, and requires a lot more time to build. Expect your development time to be measured in years rather than months for something like a multiplayer survival game.
     
    Last edited: May 25, 2018
    unity_1SeL-HQ69UMA9g likes this.
  7. unity_1SeL-HQ69UMA9g

    unity_1SeL-HQ69UMA9g

    Joined:
    Oct 7, 2017
    Posts:
    8
    Im not new in Unity. I just never created a server :)