Search Unity

Samples

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

  1. Micz84

    Micz84

    Joined:
    Jul 21, 2012
    Posts:
    255
    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:
    326
    Is that normal to have poor performance in the samples ?
    upload_2019-3-19_23-13-44.png
     
    tigerleapgorge likes this.
  5. Antypodish

    Antypodish

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

    recursive

    Joined:
    Jul 12, 2012
    Posts:
    634
    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.
     
    tigerleapgorge likes this.
  8. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    326
    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
     
    tigerleapgorge, 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
     
    tigerleapgorge likes this.
  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
  13. WAYN_Group

    WAYN_Group

    Joined:
    Mar 16, 2019
    Posts:
    105
    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:
    131
  15. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    4,830
    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:
    131
    Very great. I shall await the proceedings of this. :3c
     
  17. Lite5h4dow

    Lite5h4dow

    Joined:
    Mar 9, 2019
    Posts:
    6
    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:
    6,813
    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 :
     
  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:
    6,813
    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:
    6,813
    Testing Physics samples. Other samples including boids work well.


    But somehow Physics NonUniformScale sample is extremely slow / laggy for me.
    Any reason for that?
     
    Xskey likes this.
  23. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    131
    futurlab_peterh and Kender like this.
  24. Jimmy_Lin

    Jimmy_Lin

    Joined:
    May 8, 2015
    Posts:
    9
    Nyanpas, Nanomid and schaefsky like this.
  25. unity_4OO7ki0ZyTomYA

    unity_4OO7ki0ZyTomYA

    Joined:
    Aug 5, 2019
    Posts:
    2
    SoonTM
     
    tigerleapgorge and Nyanpas like this.
  26. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    6,813
    @MartinGram
    @Joachim_Ante
    Just to let know, in ReleaseNotes, Samples Version 30
    https://github.com/Unity-Technologi...18c4c2e9bf114d0c50/ECSSamples/ReleaseNotes.md
    3rd bullet point, link to docks is broken.
    https://github.com/Unity-Technologi.../ECSSamples/Documentation/entities_foreach.md
     
    tigerleapgorge likes this.
  27. Ruberta

    Ruberta

    Joined:
    Mar 5, 2019
    Posts:
    64
    When will DOTS sample come? I means the one that come with third person controller and DOTS animation.
     
  28. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    2,219
    Also interested in this, its been a long wait...
     
    Nyanpas likes this.
  29. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    222
    I think it will come soon after 2019.3 will be released.
     
    Ruberta likes this.
  30. wilson_p

    wilson_p

    Joined:
    Nov 4, 2018
    Posts:
    38

    Hey everyone, We just made a "Star Wars" like demo using ECS + ML Agents + VFX + ShaderGraph, a Unity 2019.3f one stop solution.
    Great thanks to Unity Boids Sample!
    Hope you like it!
    Making Neural Networks with VS Tool tutorial will be released soon, about one week after VS tool Drop6.
     
  31. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    6,813
    Really nice video. Thank you for sharing.
    Did you face any additional challenges, using current URP? Or did it work pretty much out of the box (Shader Graph)?

    Do you plan implement each boids spaceship, to shoot as well at the target?
     
  32. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    2,219
    Really impressive use of ML agents. Would love you guys to write a guide/article/tutorial on the general workflow you did to get to this stage.
     
    pyramid_seph and Antypodish like this.
  33. wilson_p

    wilson_p

    Joined:
    Nov 4, 2018
    Posts:
    38
    starwarcover.jpg
    That's a long story.
    I came along with bugs everyday. Such as:
    1. you cannot install ShaderGraph7.1.6 and VFX7.1.6 together in Unity2019.3f, they are conflict with each other. I installed VFX7.1.5 instead, but it seems VFX7.1.5 cannot save your VFX file correctly. You need to leave VFX graph open when you press play button, otherwise some effects will not work correctly.
    2. cannnot find namespace MLAgents sometimes, and cannot find MLAgents in the reference list of AssetBundle.
    3. Unity 2019.3b is only stable on Windows Family Edition, in some other Windows system environments I cannot even open Unity.(most of my works are done in 2019.3b environment)

    Below is a reference list of background knowledge for implementing such kind of project:
    1. Machine Learning: Neural Network(TensorFlow, RESNET), Deep Learning, Reinforcement Learning(SAC/PPO). Python base.
    2. ML Agents: Hyperparameter adjustments, Feature Engineering, Imitation Learning.
    3. Singleton class: NativeContainer that can pass data across Monobehaviour world and ECS world.
    4. ECS: Boids Sample, which tells you tipical workflow of jobcomponentsystem.
    5. Shader Graph: GPU way of manipulating data,Computer Vision knowledge base.
    6. VFX: Coordinate transformation such as World-to-Local and Local-to-World transformation.

    It took me several weeks from ground zero to this demo, I'm afraid I don't have enough time to re-implement it and make a tutorial, sorry.
     
    Last edited: Dec 13, 2019
  34. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    2,219
    Thats fair enough, that info is good enough!
     
  35. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    6,813
    @wilson_p thank you, for taking time.
    This is good inside anyway.
    Thx for letting us know, the challenges with Shader Graphs and VFX. Do you think current Unity 2020.1a could resolve of some issues? Weather they have been fixed? Did you report such bugs to Unity?
     
  36. wilson_p

    wilson_p

    Joined:
    Nov 4, 2018
    Posts:
    38
    I belive Unity will get better and more powerful, that's why I choose Unity instead of any other engine.
     
  37. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    131
    Maybe a silly question, but I just watched the Pong-video DOTS-example, and is it so that the scripts taking from the JobComponentSystem (like PaddleMovementSystem) do not need a reference in the scene hierarchy to run, or did I miss something?
     
  38. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    195
    I didn't watch that yet, but the Job systems do run, without any prompting or game objects controlling them from a scene.

    The job systems run when the game runs, so you may want to keep that in mind, as jobs will look for work on any loaded scene. So things may happen, or errors come up, if you forget that all systems are running in every scene.

    Good Luck Have Fun!
    Micah
     
    Nyanpas likes this.
  39. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    131
    Thank you for answering.

    However, this is a little bit concerning if you have large projects and need to control which jobs should be running as to not have a processing overload, or if you just miss a folder of jobs running. What steps can be taken to address this?
     
  40. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    753
    You are confusing jobs and systems. Jobs are scheduled from systems. If a system doesn't schedule a job, the job doesn't run. Systems get run from ComponentSystemGroups in a hierarchical fashion where the root systems are injected as delegates into a player loop. You can turn on and off systems with the Enabled property. And you can turn on and off a whole group of systems using the property of the ComponentSystemGroup.
     
    Nyanpas and AggressiveMastery like this.
  41. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    195
    Great comment!

    Just be sure @Nyanpas that you do not have work for jobs, and if you are writing your systems right, they should not find work, and so not have any overhead... well very little.

    Like Dreaming said, you can also fully disable the system/s.
     
    Nyanpas likes this.
  42. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    6,813
    Is anyone was/is able to run successfully compound demo in Unity 2020.1a ?

    EntityComponentSystemSamples/UnityPhysicsSamples/Assets/Tests/Compound/
    https://github.com/Unity-Technologi...ter/UnityPhysicsSamples/Assets/Tests/Compound

    I used the extract from samples and I can manage to create single dynamic body, like BoxCollider and manipulate with it in 2020.1a.
    But if I try using CompoundCollider, raycast throws range of errors, basically saying
    NullReferenceException: Object reference not set to an instance of an object
    It works no problem in 2019.3.

    On side note:
    Opening git samples in 2020.1a also throws range of errors on its own.
     
    KwahuNashoba likes this.
  43. ZexScal4

    ZexScal4

    Joined:
    May 25, 2018
    Posts:
    8
    Is there any sample which shows how to give an object a compound collider that has a body for the object and a sphere trigger collider to see what around a certain area of the object?