Search Unity

DOTS Sample

Discussion in 'Data Oriented Technology Stack' started by benjaminhwh, Dec 18, 2019.

  1. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    4,832
    It is turned off by default. We should probably look at changing the behaviour of it though, so it begins compilation earlier & parallel in order to reduce the time to enter playmode.
     
    awesomedata and Antypodish like this.
  2. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    199
    It seems Debugging and maybe Burst 'checks' don't save well.. As I know the ONLY thing I do, is go in and un-check them a trillion times a day.
     
  3. sybere

    sybere

    Joined:
    Mar 26, 2015
    Posts:
    172
    Any way to create terrain shader which is support the hybrid renderer? my terrains not showing at all,
     
  4. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    199
    If you do a search for "Terrain" in your packages, you will find a HDTerrain material that you can apply to the Terrain and it will render as normal :)

    Cheers
    -Micah
     

    Attached Files:

  5. sybere

    sybere

    Joined:
    Mar 26, 2015
    Posts:
    172
    I using the HDterrain shader and the terrain is not rendering well both in editor and build, this is why i'm asked if there is a way to create a terrain shader which has an option to support hybrid render as the other shaders, i'm didn't find a way to create terrain shader graph.

    i'm added the terrain to a subscene and its only shows if i'm edit the scene under the sub scene script, after i'm closing the scene, only trees and grasses are showing and terrain is gone.
     
  6. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    199
    render_Summary.PNG
    I have my terrain in the main scene, as a sub-scene converts everything to entities.

    So in the attached picture, I have my:
    1. Terrain made by MapMagic in the Main Scene (whitebox_newmeshtest).
    so its not converted to any entity in a sub scene.
    2. Veg Studio, which manages Trees and Fulstrum Culling as entities in my main scene as well, so its not converted to any entity in a sub scene.
    3. The Terrain doesnt collide with the player right now naturally, so I exported the terrain to a mesh, and added that mesh to a sub-scene (020_environment), so that its converted at run time and works for collisions.
    4. Trees, Map Magic generates the placement of the trees and I also used it to generate colliders for the trees, by placing the gameobjects id later converted via a subscene. I then took the tree collider-objects (not renders) off the terrain, and dragged them into the sub-scene environment.

    Now I can see the terrain, use the terrain textures per normal, and shoot/run on top of it.
    I can also see trees, and collide/shoot at them.

    All running at better than 60fps, in editor and in build, at 4k. With 2 clients connected.

    Ill be posting a video summary of this, and ill put the link here as well.
    <Below is my dev Log 3, I tried to cover this>
     
    Last edited: Jan 4, 2020
    keeponshading, sybere and pal_trefall like this.
  7. sybere

    sybere

    Joined:
    Mar 26, 2015
    Posts:
    172

    Moving Terrain to the main scene did the trick thanks!
     
  8. sybere

    sybere

    Joined:
    Mar 26, 2015
    Posts:
    172
    Any way to create similar build like the editor mode so in the build its starting a server +client?
     
  9. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    199
    The "Play" Button does start a Server and Client, within the editor. You can also access the "assets/Build" folder and build stand-alone Server and Client applications to do full stand alone testing. You can also access the "A2" or 'Multiplayer' menus to launch a mix of client or server running editors, and external stand alone apps, together. So you can see what happens on just the server, within the editor, as example.
     
  10. sybere

    sybere

    Joined:
    Mar 26, 2015
    Posts:
    172
    Thats okay, i can do builds, server and client, but i would like to create a build which is similar create server and client at the same time and you can play as its in the editor when the multiplayer settings are Client&Server. its could be useful in 1v1 or for smaller matches, so one of the players are became the host.
     
  11. Michael-Thomas

    Michael-Thomas

    Joined:
    Jul 8, 2014
    Posts:
    20
    I have been trying to explore the DOTS sample by making some theoretically simple changes to the game to see what happens. One of the things I've tried to do is add an alternative weapon - as a first step towards this I copied Weapon_Terraformer to Weapon_Foo and switched Hero_Terraformer to give the hero the new weapon instead of the old one. I adjusted a few controls and such on Weapon_Foo just to make it clear whether I had successfully swapped the weapon. I also then regenerated all the appropriate ghost code.

    This has resulted in some weirdness, and while I've found a workaround, it feels hacky and is probably not the intent so I'm wondering whether there's a better approach someone can point me to.

    Specifically, even though the Hero_Terraformer specifies the hero should get a Weapon_Foo (and they do on the server), on the client the hero instead always gets the Weapon_Terraformer. As far as I can tell, this is because the two weapons are very similar to the point that the system is using the same Archetype. What this means is that when FindSerializer() gets called on the GhostSerializerCollection, both types of weapon would return true on the CanSerialize() check and therefore the first one in the list will be used for both types of weapons, which happens to be Weapon_Terraformer in my case. Looking at the docs for NetCode and Ghosts this seems to be known and/or somewhat intentional. But since I've got two different prefabs and no way to choose between them, information seems to be being lost in this transfer. In my case the thing I noticed was that the activation buttons were always using the Weapon_Terraformer's activation buttons but this would seem likely to be the case for other things, such as if I'd tied the new weapon to a different-looking Part, I'd expect to get the wrong one.

    My workaround here is to add a special marker component to each type of weapon so that they're different and thus end up having separate EntityArchetypes, but this is a bunch of annoying extra empty marker classes and feels hacky, so I'm thinking is not the preferred approach here.

    Am I thinking about this totally wrong? Is there only meant to be one Weapon prefab/archetype and any differences between those weapons need to be sent across the wire to the client? That would seem to be sending unnecessary network traffic about something the client could just know about, but maybe that's not as big a deal as I'm thinking since it's only at creation time? (Although I also think if that's the case then the way the sample has ability activation buttons setup is not properly transmitting since those didn't seem to get reflected on the client.)

    As a slight aside - if you want a somewhat simpler version of this, you can get a similar effect with the NetCube project by duplicating the Cube as Sphere, swapping out its render mesh, and regenerating all the ghost code. If you put the sphere first in the GhostCollection, you will then see that even though the server is still spawning you as a cube, on the client, you are a sphere because that was first in the GhostCollection's list and the change to the render mesh did not affect the Archetype.
     
  12. mhernandez88

    mhernandez88

    Joined:
    Jul 20, 2016
    Posts:
    27

    The answer to your question is both Yes and No. The DOTS Sample is clearly just a sample and as such limited in its functionality. It was built for a specific use case, and that use case was to get a single weapon working. So what you are doing is correct in the current context and also probably recommended, though there are other ways to achieve it.
    A weapon can be an EntityArchetype, the deserialized version of that Archetype can be an instance of a weapon.
    How that weapon looks can be a value on that weapon.

    So I guess what I am saying is you can either think of:
    1. Every weapon type is its own Archetype
    2. A weapon ( firearm ) is an Archetype, and its mutable characteristics are values on that archetypes components such that when you deserialize you can find the correct prefab to spawn or mutate.

    There may be other ways to view the relationship but thats how I see it from examining the code and my rudimentary knowledge of ECS
     
  13. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    239
    I just downloaded the project, selected the Whitebox_Arena_A/Whitebox_Arena_A.unity scene and hit play
    The FPS is abysmal, the profiler states that a PlayerLoop takes 125ms, 41.47ms of those are wasted on WaitForJobGroupID. What kinds of files I need to supply to troubleshoot this?
     
  14. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    103
    Joachim gave a pretty good explanation on editor performance:

     
    AggressiveMastery likes this.
  15. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    239
    After disabling everything above, it still would only run at 55~ fps, where only 2.4 ms were from the render thread according to the stat window. Considering how much DOTS is supposed to speed things up, I still think there is something wrong with my configurations, but I guess I will just wait for more improvements before I start developing with the netcode thingy
     
  16. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    199
    The underlying sample runs well, even with the server code set to single core as earlier pointed out. I was seeing 60fps+ at 4k, with veg studio and tons of vegetation running on top of the sample. Best performance will not be seen in the editor.

    Be sure to turn off burst compile, and wait for all the compiles to be done in play mode. But still, within the editor, you will be hard pressed to see about 60 fps. Also, what are you judging fps against? I took time.deltatime of the last 2 frames, divide by 2, and then took that and saw how many I can fit into 1 second. that is the fps displayed on this video of the modded dots sample:

    But this is just self testing, were you load testing with multiple clients?


    PC is a Intel i7 8700k @ 4.5Ghz (6 core)
    32 GB 4133Mhz DDR4
    Raid0 M2 Drives (3.5GB read, 1.5GB write)
    Zotec AMp Extream 1080TI 11GB
    4k@60hz, 3440x1440@120hz, 1080@60hz
    Asrock Z370 E4 Mobo
     
    Last edited: Jan 14, 2020
  17. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    103
    Right now the DOTS Sample is configured to run everything in a single threaded manner (both server and client are running on one thread) -- the client and server compute times are stacked in the editor. If you compile a server executable and a client executable each will run in their own thread and you will see much better performance.

     
    Guedez and AggressiveMastery like this.
  18. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    239
    If you mean 'how did you measure fps?', the play mode stat window.

    Glad to know that most if not all performance issues are Editor time only, it means I can start messing with it
     
  19. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    484
    Last edited: Jan 19, 2020
    AggressiveMastery likes this.
  20. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    199
    Howdy Keeponshading!!

    This sample is made with DOTS Physics, so we will need to call against physics in DOTS. Which I haven't done, but it will be a distance cast vs entity transforms. Just done with a scheduler every frame.

    So you could pull in the old car scrips, but they are mono-develop (single threaded), and not DOTS(multi-threaded : OVER SIMPLIFICATION GUYS.) So you are then placing the car scripts, as mono scrips, as huge road blocks to each frame. Basically destroying the beauty of DOTS. Unless you have put the DOTS Multiplayer Sample aspect as all you are using in this sample :)

    It will be best, and what I will be doing, but not for a few months... is making a DOTS car controller, as that will be vital to multiplayer. It may be as simple as restricting player movements, so they act as a car. But I want a moving body, you can walk around on with other players. Like the friggin DOTS sample of the FPS sample, never released. /pff

    So it wont be, in any way, as easy as it was in the FPS sample. Unless you abandon DOTS, then ... maybe. Just attach the move script to your car, and find a way to trigger it with dots. And dual your colliders, meaning have one for the old car script physics, and dots, basically bastardizing the physics between dots and old units.

    Just talking theory, and I look forward to showing it in action, some future video :)
    Micah
     
    keeponshading likes this.
  21. mhernandez88

    mhernandez88

    Joined:
    Jul 20, 2016
    Posts:
    27
    I think it would be fairly easy honestly. The most complex aspect of this sample seems to be the new animation and any code that fills in the gaps of missing features. Ill look into the code again shortly and see if i can point out some areas where the raycast car sample would be ported and merged.
     
  22. mhernandez88

    mhernandez88

    Joined:
    Jul 20, 2016
    Posts:
    27
    One thing that irks me about the DOTS Sample is that there seems to be the inability to calculate offsets easily. For instance I am unsure how the creators efficiently determined IK offsets.
     
  23. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    199
    Hey! I was able to get Visual Scripting for DOTS working with the sample. By changing the error about time to reference UnityEngine.Time, and by moving the Visual Script Package folder out of the cache folder and into the package folder so that the modification does not get over-written each reload of the editor. Its great to see class/struct from the overall sample there. ... https://forum.unity.com/threads/dot...-experimental-drop.795807/page-2#post-5408067
     
    keeponshading likes this.
unityunity