Search Unity

Question Multiple game instances in one server executable

Discussion in 'NetCode for ECS' started by duova, Dec 14, 2022.

  1. duova

    duova

    Joined:
    Mar 15, 2021
    Posts:
    3
    Hi,
    I'm trying to develop a match-based game and I believe the standard is to have multiple matches run inside the same server executable for performance. These matches run on basically identical logic but should be isolated from one another.

    As this post points out multiple server worlds seem to work perfectly fine. But I'm wondering if this is intended.

    Also, considering the way ECS works, would it be more performant to have all matches in the same server world, and have them be separated by physics worlds + ghost relevancy? As far as I know, this allows entities from all matches to share the same archetypes and lets a single system operate on all matches, which should improve server performance relative to having multiple worlds.

    Is this true and is there anything I'm missing regarding the implementation of a match-stacking system?

    Cheers :)
     
    kynphlee likes this.
  2. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    Hey rezonabyt!
    It's not supported in the sense that we don't test to ensure this works, but if it works, then feel free to use it!

    We will consider adding official support for this feature (in editor, at the very least), as it overlaps with another feature we're thinking about, but I can't be any more specific than that unfortunately.

    With that said, my understanding is that it's better practice to run multiple instances of the executable on a server instance, rather than having one that spools up and down. This is to isolate failures (like crashes and CPU stalls).

    Let us know how you get on with it, as it does sound useful.
     
  3. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    Are there currently efforts being made to reduce the base cost of a running instance?

    currently having multiple worlds inside one instance would consume a lot less resources compared to one executable per world.

    Especially if each instance only hosts very few players (2-3).

    if the server resource cost (cpu & ram) for multi world vs multi instance are close that would of course be ideal.
     
    kynphlee likes this.
  4. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    I believe so. The Dedicated Server Build Target is still being improved AFAIK:
    https://forum.unity.com/threads/uni...tions-now-live-please-share-feedback.1143734/
    You may have better luck with this query posting in that Multiplayer sub-forum.

    Agreed. I'll ask for someone who knows more to reply.
     
    Last edited: Dec 16, 2022
    kynphlee and Occuros like this.
  5. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    259
    Hello!

    Yes! we are continuously working on improving the Dedicated Server as a platform.

    I agree, in that thread Niki mentioned we shared that some initial results showed a memory reduction of up to 60% for some sample projects. That was a big first step and we continue investigating more ways to optimize cost, performance and workflow.
     
    kynphlee, Occuros and NikiWalker like this.