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 0.4.0 released

Discussion in 'NetCode for ECS' started by timjohansson, Sep 17, 2020.

  1. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    The netcode package will automatically do that for you so you do not need to do anything. (It does it by storing a list of components to remove in a blob asset)

    That depends on exactly what you mean, if you mean the game objects in a subscene which are converted and destroyed - those are not loaded at runtime, only the conversion result is loaded.
    If you mean game object in a subscene which are still game objects in the runtime (subscenes can contain hybrid components which requires game objects) - you would need to disable automatic loading of those subscenes and load them manually on the client only to avoid loading them on the server.
    If you are talking about game objects which are in the root scene and not converted - what I usually do is store those in a separate scene which is additivly loaded from the client world.
     
  2. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
  3. Ali_Bakkal

    Ali_Bakkal

    Joined:
    Jan 26, 2013
    Posts:
    84
    Thank you it worked when i used the build settings files.. Do you have any documentation on how to use it ?
    If i understood well, the build menu is useless when there is subscenes is that right ?

    Best
     
  4. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    159
    Thanks @florianhanke, Perhaps that it what I don't understand. As far as I can tell ghosts are for objects I want to synchronize over the network. However, I want to have a bunch of entities/ game objects that exist only on the client. They are not synchronized, nor need to be. I want to make sure these objects do not appear on the server so they don't use server resources.

    Before, for entities, I just used ConvertToClientServerEntity and targeted only the client. Then they would not be in the server world. Perhaps that was a mistake. I also had ghosts that were synchronizing between everything with interpolation and prediction etc.

    Maybe you can clarify how one "hides" the client's world (objects, background, environment, lights etc) from the server, such that only the synchronized object appear there. It would be great if they would be excluded from server builds too. When I did a cursory try of the subscene workflow, the server had the subscene in it just like the clients did. So I'm definitely doing somethign wrong, and so net code doesn't quite do it "Automatically" as far as I can tell. I'm definitely missing something that is not automatic :) I apologize for my ignorance.

    BTW I'm familiar with systems using UpdateInGroup clientsimulationgroup attributes (and equvalent for server). But that doesn't solve problems relating to the client-only assets being included in server world and server builds.

    Some extra background in case it helps:
    I'm using AR foundation with ARKit to do some face tracking. That happens in monobehaviour land. I also have some monobehaviours and gameobjects for background, a viewing screen, some props etc.

    I synchronize the user's tracked head position to an entity in client world. Then I create a command system for a ghost to take that tracking input information, similar to the cube movement in the cube tutorial. So now I have the ghosts working great and getting synchronized between clients. However, the gameobjects, and objects around the face tracking (Room, avatars, background, etc) were appearing on server when I run it in editor (They're still in hierarchy and also get rendered).

    So how can I only get ghosts on the server, and everything else on clients? Subscenes seem to appear on both client and server fully. Do I make everything a ghost? Wouldn't that be a huge waste of bandwidth?

    Sorry if I'm missing something very fundamental, still newish to DOTS and this Netcode. Thanks for all of your time and help
     
    bb8_1 and florianhanke like this.
  5. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    You have some very relevant questions. With the jump to 0.4.0 and subscenes, I think we lost some options.
    Whenever I want an entity synced, but have different components attached to the entity on the client and server then we can use GhostComponent, and if we only want components partially synced, we can use GhostField, to specify the fields that are synced.
    But that leaves out the case you mention, where in 0.3.0 I could mark something as to be instantiated only in the client or on the server, which I believe is not possible, or at least not as easy anymore (the minimal documentation on subscenes does not help either).

    What I think would be extremely helpful: A grid which covers all/most possible cases, and how to solve them, and which cases are not covered at the moment.

    In any case, I also hope I'm not missing anything, and would welcome any pointers – thanks in advance!
     
    AdamBebko, Lukas_Kastern and bb8_1 like this.