Search Unity

Samples

Discussion in 'Data Oriented Technology Stack' started by MartinGram, Mar 20, 2018.

  1. Micz84

    Micz84

    Joined:
    Jul 21, 2012
    Posts:
    232
    I understand that it is the first element in a given key of MultiHashMap, but it same entity won't be twice in different keys as they are a hash of position. But maybe I am still missing something.

    I wish code had some comments :) explaining why everything is done as it is it would help.
     
  2. OleJuergensen

    OleJuergensen

    Joined:
    Mar 21, 2018
    Posts:
    11
    Yes, it does not seem to make sense. The HashPositions job would have to add the same entity to the hashMap multiple times. Or at least the same index, so maybe the index is not unique? Actually I find several thousand boids, but indeices always seem to be in the hundreds. So I guess the index is not unique.
     
    Last edited: Feb 10, 2019
  3. OleJuergensen

    OleJuergensen

    Joined:
    Mar 21, 2018
    Posts:
    11
    Okay, so the HashPositions job that originally fills the HashMap is a
    IJobProcessComponentDataWithEntity, which uses chunk iteration. The indices it writes to the hashMap as values are chunk indices and therefore multiple entities have the same index. I think the naming of many signatures in ECS could be improved. The lack of documentation and comments does not help either XD
     
  4. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    290
    Is that normal to have poor performance in the samples ?
    upload_2019-3-19_23-13-44.png
     
  5. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    5,222
    Out of interest, what is your hardware specs?
     
  6. recursive

    recursive

    Joined:
    Jul 12, 2012
    Posts:
    584
    Do you have burst jobs enabled? What level do you have set for stack trace logging?
     
  7. Scott-Michaud

    Scott-Michaud

    Joined:
    May 26, 2015
    Posts:
    14
    I occasionally get massive slowdowns through Semaphore.WaitForSignal. It often clears up on its own... sometimes without even restarting Unity or changing scenes.

    There's a thread on it here: https://forum.unity.com/threads/extremely-slow-editor-in-2019-2-0a7.640354/#post-4318279

    Sometimes it happens in editor. Sometimes it happens in a standalone build. I've experienced it on 2018.3 and 2019.1. The original author of the thread experienced it on 2019.2. It hasn't been a problem for me for a few days.

    Long story short: If it's affecting you (and if it's the same problem) then you might be able to just reboot or wait and it'll run faster again.

    A bug has been opened but I don't think Unity has been able to replicate it.
     
  8. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    290
    It was apparently "Burst Safety Check" the issue.
    Weird things is that in the menu it was shown as disable. By toggle it twice, it seems to fixed the issue.
    Some kind of a refresh issue apparently

    Edit: Btw I'm running on 2019.1.0b6
     
    Last edited: Mar 20, 2019
  9. futurlab_peterh

    futurlab_peterh

    Joined:
    Jan 23, 2018
    Posts:
    22

    I'm getting massive Semaphore.WaitForSignal on PS4 and Switch builds using 2019.1.0b9. I've tried playing around with Burst settings as suggested, but that made no difference at all.

    What did help me was to uncheck Development Build on the build settings; on Switch this made our current builds go from 28fps to 48fps. Of course there's more to it than just the WaitForSignal thing, but I don't recall having such a performance improvement by just unchecking it.

    We do lose the ability to profile and debug builds, but it's useful as a workaround.

    upload_2019-3-29_9-49-14.png
     
    Alverik and learc83 like this.
  10. Kombiice

    Kombiice

    Joined:
    Jan 20, 2015
    Posts:
    64
    Same problem with Semaphore.WaitForSignal here, too.
     
  11. Kombiice

    Kombiice

    Joined:
    Jan 20, 2015
    Posts:
    64
    Created a test scene -

    Using GPU Instancing on grass (Which is placed individually, using the same material).
    Sometimes I find myself not seeing GFX.Waitforpresent at all, in really empty scenes, though. Vsync is disabled, also via Geforce settings.

    2019.2.0b1


    Grass enabled:

    upload_2019-5-11_15-37-23.png
    upload_2019-5-11_15-37-57.png

    Grass disabled:
    upload_2019-5-11_15-36-38.png

    upload_2019-5-11_15-34-58.png
     
  12. Kombiice

    Kombiice

    Joined:
    Jan 20, 2015
    Posts:
    64
    With gpu profiling turned on, the render thread usage and gpu usage is suddenly really high, which seems to be the correct data, compared to before. Weird.


    Edit:
    There seems to a lot really wrong. These gpu rates weren't that high with same scene setups and tests before 2019.1, the drae call rates are sometimes off, the render usage rate isn't right until using the gpu profiler, and Semaphore.waitforsignal causes higher cpu usage because the gpu usage is high, with a nearly linear increase... soo, always higher cpu usage, it serms like.


    Edit 2:
    It's all running with way less problems and much faster in 2018.3 (14f1)

    Edit 3:

    Also, 2018.3 is not causing the TAA artifacts / frame smoothing, the editor is much faster (also, occlusion baking is faster and there are not the GI baking problems I had with 2019.1+ (Where baking took really long and sometimes GI wouldn't be displayed).


    Edit 4: By the way, the problems with 2019.1 + were present in builds too, not just the semaphore.waitforsignal thing.

    Edit 5: Okay, Gfx.WaitForPresent is still there in 2018.3(14f1), causing high cpu usage, but still, everything's running much faster and there are less editor problems.


    Edit 6: I closed the profiler (GPU profiling was enabled, too) entirely, the fps rate is much higher in 2018.3(14.f1) now. And the render thread usage dropped from around 20ms to 5ms again. Similar to the time when I enabled gpu profiling in a newer unity version which showed that gpu usage wasn't at around 7ms, but 50-60ms (Also in the stats tab in game view)

    Edit 7: Also, when having gpu profiling enabled, it can be seen that volumetric fog takes around 30ms in newer unity versions, and just about 3ms in 2018.3

    Edit 8: Disabling gpu profiling sets the render thread usage way down.
    Closing the profiler entirely sets render thread usage down to about 3ms from around 18 MS in a testscene (Similar to disabling the gpu profiler), and cpu usage way down, too, giving me over 100 fps in that certain testscene, to around 60 with the profiler opened. There are many inaccuracies using the profiler and testing inside the editor at all
     
    Last edited: May 14, 2019
    futurlab_peterh likes this.
  13. WAYN_Group

    WAYN_Group

    Joined:
    Mar 16, 2019
    Posts:
    59
    Hello,

    I am working on "modular game mechanics" (move/jump/shoot/...) using as much preview package as possible, including DOTS and the new input system.
    You can find it here.

    As you can guess the usual disclaimer is that it's all subject to changes, it has some issues that I'm discussing on the forum and it needs a bit more documentation (WIP).

    Still I hope it can be of some value to anyone.
     
    alexnown likes this.
  14. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    39
  15. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    4,646
    We have an open issue with chunk fragmentation right now, it's being fixed.
     
    FROS7 likes this.
  16. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    39
    Very great. I shall await the proceedings of this. :3c
     
  17. Lite5h4dow

    Lite5h4dow

    Joined:
    Mar 9, 2019
    Posts:
    5
    its been almost a month since the sample stuff has been updated, and I've been left in the dust with ECS and im struggling to update my code. could anyone direct me to some up to date samples / documentation?
     
  18. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    5,222
    One month is actually not long at all.
    You can use earlier stable release for now, which is compatible with samples.
     
    Lite5h4dow likes this.
  19. The-Exceptional-Bruce

    The-Exceptional-Bruce

    Joined:
    May 10, 2015
    Posts:
    27
    Looking for ECS samples and tutorials? This is a good series by Code Monkey :
     
    azurstreams likes this.
  20. whoa928

    whoa928

    Joined:
    Oct 31, 2016
    Posts:
    1
    Where can i get the "Twin Stick Shooter" demo or url?:(
    I got nothing about it on the top...
    THX.:)
     
  21. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    5,222
    Current samples
    https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/Samples
    Throwing error
    Library\PackageCache\com.unity.burst@1.0.4\Editor\BurstAotCompiler.cs(638,32): error CS7036: There is no argument given that corresponds to the required formal parameter 'exceptionType' of 'BuildReport.AddMessage(LogType, string, string)'
    during importing into Unity 2918.2.0b10
    I haven't tried load other burst preview yet.

    Edit:
    Upgrading to burst preview 1.1.1, seams resolves matter.
     
    Last edited: Jul 26, 2019
  22. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    5,222
    Testing Physics samples. Other samples including boids work well.


    But somehow Physics NonUniformScale sample is extremely slow / laggy for me.
    Any reason for that?