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. Dismiss Notice

DOTS NetCode for MMORPG

Discussion in 'NetCode for ECS' started by artyomik14, Apr 14, 2020.

  1. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    857
    What if you just not gonna use the rollback, no predicted ghosts. Will it still run some rollback related systems and generate rollback data for all objects?

    I was planning to do exactly that, not use any prediction, my game does allow it. But now I see why they still might be generating rollback info. I hope this won't happen, or can be disabled.
     
    Last edited: Dec 6, 2020
  2. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    857
    Why not 1000 thin clients? Can't you run those like from a single laptop? Isn't that the same test for a server?
     
  3. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,329
    Sure.
    I want it to be as real world as possible though so there is absolutely no doubt :)
     
  4. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,102

    We already have a bandwidth debugging tool in DOTS NetCode which runs on the browser but shows you a graph of upstream and downstream bandwidth for each network tick and ...

    Regarding animations. You almost never send anything that you don't have to send which includes animation so you never will have animations sent over the network unless you have a very specific case which you need to synchronize a special event which is related to the gameplay of something specific to your game but i cannot think of any.

    Most of the challenges a MMO will face will not be solved automatically by any tool and at best tools and libs can give you tools like different algorithms to choose from and tune their numbers for area of interest and bandwidth priority management.
     
  5. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    500
    Guys I've been reading this fascinating blog different networking ideas with regards to Fortnight / MMO. Given we are now at ECS 1.0 pre15 and we have a Netcode for Entities to support it, does this change anything? Are we at the stage where it could handle a 1K CCU on a single dedicated high end server streaming a world on a 10Gbps backbone like a 1km city scale? I'm just interested how close to this is achievable?

    Some other things i'm interested in from a networking perspective would be

    Oceans
    Skies
    Terrains
    Mesh Rigged based Animations
    GUI

    Your thoughts much appreciated guys :)
     
    kmowers likes this.
  6. PolarTron

    PolarTron

    Joined:
    Jun 21, 2013
    Posts:
    87
    Netcode for Entities, while it does add some cool new features, doesn't fully solve the concurrent users in one area problem. I'm sure it can handle a lot of players at once, maybe even a thousand because of the priority accumulator, but things reaaally start to bog down once players decide to throw a cool party in one area of the map. The "how many players does x support" is very difficult to answer because it depends on several factors like Total Players Online, Average Player Density, Update Frequency and Average Snapshot Size.
    However, DOTS does improve the CPU usage by an insane amount so I suggest testing out the limits.

    All of these should be simulated on the client and not networked. If you are doing voxel terrains then there are compression techniques for that but Netcode for Entities doesn't include those features, you have to do that yourself.
     
    Last edited: Dec 28, 2022
  7. Blargenflargle

    Blargenflargle

    Joined:
    Feb 24, 2019
    Posts:
    92
    In my experience you can push vanilla NetCode to about 200 users. To start to get an idea of exactly how many you could get I recommend opening up NetDbg and playing around with your ghosts. We're absolutely network bound when talking about netcode in ECS (as opposed to CPU bound).

    The first optimization you could make is to implement the under-documented "Relevancy" feature that is implemented here in the Asteroids sample. This makes it so that far away entities are not sent to a player that they are not relevant to. This is a necessary step to building a large world.

    By default ghosts send their position and rotation constantly. We can adjust the rate with things like importance and even distance-based-importance but these are settings specific to your use case so hard to talk about in the abstract. However when networking a large number of entities we'd ideally only send the "inputs" and then calculate the same outcomes on the clients and server. We can sort of do this by using GhostVariants to not send the position/rotation data and manually sending it at an interval (or not at all) but I don't have the chops to tell you exactly how this would work with things like rollback and whether or not it would actually produce the same simulation on the client and the server after a long enough time.

    No, the only true answer is a multi-server setup. The only general purpose, publicly available example of this that I've seen is SpatialOS. However it seems like SpatialOS kinda sucks. For that reason I've proposed a Unity-ECS-based SpatialOS-like here. It seems to me that something like this would be very possible to make for 1 person with the right background and inclination to make it. If it were made, it could be applied generally to make scaling realtime games with features like rollback, and I think that'd be pretty cool.
     
    PolarTron likes this.
  8. PolarTron

    PolarTron

    Joined:
    Jun 21, 2013
    Posts:
    87
    SpatialOS for Unity is completely abandoned and they massively overscoped their integration. Coherence rised up to take their place but doesn't seem to focus on the ECS workflow and the "advanced" concepts that Netcode provides.

    I just want to chip in, as an ex SpatialOS poweruser and a creator of a similar package as Netcode that I have very similar thoughts. If we can glue together two servers, even in a crude way, it goes a long way.
     
  9. JamesW940516

    JamesW940516

    Joined:
    May 19, 2023
    Posts:
    28
    I know this is an old thread but I think the discussion is important still.

    What is the max client connection count?
    - When I use Netcode for GameObjects?
    - When I use Netcode for Entities?

    I heard that Unity Netcode does not suit for MMO games.
    Should I consider using other means to make a MMO game?
     
  10. Blargenflargle

    Blargenflargle

    Joined:
    Feb 24, 2019
    Posts:
    92
    The short answer is, yes, you should use other means to make an MMO. The long answer is below.
    Unity DOTS is very fast, but it's about efficient use of CPU cycles. Network performance is almost completely disconnected from CPU performance. With that in mind, almost any single-server setup (i.e., netcode for gameobjects, netcode for entities) is going to face the same limitations when it comes to CCUs. The exact number is almost impossible to say as it involves a lot of considerations about your games design, but almost any kind of interactive game will end up hitting the limit well before 300 CCU in "worst case" scenarios.

    What do I mean by that? Well with either netcode you're sending updates about the state of relevant entities to every player every update interval. That update can only be so big, so what information goes in there matters. Entities with lots of ghost fields that change all the time are going to be more taxing to send. The more entities that are "relevant" the less information about each entity that will be able to make it into each update.

    So we can get more CCUs by having fewer ghost fields and by having less relevant entities.

    Again, no matter how much cutting you do you eventually hit an upper limit, which I estimate to be well below 300. If you want to break that you need a multi-server architecture. SpatialOS is an "out of the box" multiserver architecture, but I don't know much about it. Good luck!
     
  11. JamesW940516

    JamesW940516

    Joined:
    May 19, 2023
    Posts:
    28

    okay I know what you mean.
    Thank you very much for your clear explanation.
    Is there any a method I can simulate my NGO game project is working with 256 players?
    Can I test with Multiplayer Tools?
     
  12. JamesW940516

    JamesW940516

    Joined:
    May 19, 2023
    Posts:
    28
    I am very happy to hear that.
    Hope talking more about this.
    I just hope more or less 256 CCU
     
  13. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    774
    Even if you have hundred thousands to entities in the world, only a bunch of them are active/visibile/relevant at a given point in time.
    As such, as always, Area of Interest (in our case relevancy) and prioritisation is what matter and govern the bandwidth used.
    Now, it is up the the dev to decide how many packet per tick the server should send to the client, as well as that are the relevant entities.
    The default for Netcode is to send 1 packet (1MTU) per server tick (more correctly based on NetworkTickRate).
    Usually consider that on average, a packet of 1MTU contains at best hundreds of entities (when they are small enough). Best case scenerario for semi-static (or rarely changing) entities is to use static optimisation (so 0 data is sent)
    For syncing 1000 players, in close proximity, is a challenge in itself. Even sending 10/20 players per packet (that is almost achievable, more realistic is probably 5/10) requires 100 packet => 100 tick => 2 second.. that is too much. So you need to send way more, 5/10 packet per tick => 50-100 players => 10 ticks => that start making sense.

    that imply 5-6KByte per update at minimum, per connection per server. for 1K players is 6MB per frame, at 20hz is 120MB => almost 1GBit
    And this just for the players, there are also the other entities etc etc. So quite a lot of data. Not crazy numbers, but still quite high.
    The bandwidth at this point is not the real problem though. CPU cost is probably the most important factor. Simulating is cheap, serializing the data is not! It may be you're becoming CPU bound very soon, requiring at least 16/32 cores to maintain an acceptable performance level.
    I would not go unless strictly necessary for a distributed simulation,
    like SpatialOS or Hadean. The complexity and costs to maintains such a scalable architecture can become easily too high for a project to maintain. A more classic zone-based/partitioned schema may be still ok with sufficiently powerful instances. Buy you need to do the math (for the costs)

    @Ashkan_gc actually says the truth: the complexity is in the data partitioning, cross-server (instance if necessary) communication and other similar factor.
    It become sorta of a distributed N-Body simulation in sense. So requires indeed special considerations.

    For animations, right now we don't support replication the Unity Animator. The best approach right now for networking animation is to use Playable, that give way more control on both transitions and state (replicated). Key fact, animations should be completely "state less" as much they can, resumable and transitional from anywhere andonly dependent on the very little serialised data.
    This is why using the Animator state machine is a poor choice in general. Best approach would be to have something similar to motion matching, with some slightly tweaks for being more "network friendly" and layered animation system.

    Even better if we could use AI and make all this a generative system (be we are going out of track..)
     
    WAYNGames, Samsle and Occuros like this.
  14. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,029
    There's a MMO game I know able to handle 15000 players at the same time at 64 core 128GB memory game server powered by .NET 6. Since dots netcode using dots tech, I guess it will able to handle even more players with the same game server spec?