Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

ECS: Hybrid Collisions + Pure Rendering?

Discussion in 'Graphics for ECS' started by Antypodish, Jul 30, 2018.

  1. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,754
    HI again.

    While investigating possible solution, for porting my project to ECS, I am learning, on what ECS can and can not do as of yet. My recent study, was based on the game design approach discussed in

    Unite Austin 2017 - Massive Battle in the Spellsouls Universe



    Discussion includes subject regarding tackling rendering and collisions, for thousands of entities. All nicely and highly applicable for their type of the project. They highlight, as the game entities (minions) behaves as particles, similar to the water, where when too close to each other, then they repeal their nearest neighbor.

    But such approach, is not the realistic collision behavior, for what for example rigid body does in classic programming methodology. And yet what I need.


    Hybrid ECS with RigidBodies

    In my project, I expect having many entities (building blocks) of possible some different convex shape. For OOP based programming, there are GameObjects. Each can have collision behavior, hence colliders and RigidBody, as well as rendering component. Since unity ECS do not support collisions yet, I was considering take a time and try write collision physics, or (leaning toward) stick to hybrid ECS approach for now, for tackling collisions. From my understanding, this is very achievable at this moment. And then let Hybrid ECS apply relative forces as required. I hope I got that last bit right.


    Pure ECS with Mesh Rendering

    Now the matter of rendering above objects. If my understanding is correct, this is least problematic, to get object rendered. By building pure ECS and assigning relevant meshes / textures to the bootstrap equivalent, or entity component, I should be able to render many of objects. However, I may expect, that some blocks have different shapes / textures. So I presume, is just matter of creating components groups / filters, which can store meshes, textures varieties.


    Pure and Hybrid ECS all together

    Now, I need just to just confirm, that coupling both pure and hybrid ECS, to control collides and render meshes respectively, is the right approach. I read from discussion, there is nothing against, with such approach. At least, should keeps code cleaner, and hopefully closer, to port into pure ECS in the future.


    Recap Questions
    The question is, Is the right way to build a systems of Hybrid and Pure ECS, to drive collision and rendering?
    Are there any additional potential traps, which may hinder such development?
    Or, how would you deal, or dealing with such matter?


    Cheers.
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Hybrid won't do this kind of performance, full stop. You're looking pure ECS and Jobs for this kind of performance. Hybrid is more of a thing to get to know how it works and play around with it using familiar Unity components. For pure, you'll need to wait a bit.

    Related thread: https://forum.unity.com/threads/physics-in-pure-ecs.531716/
     
    Antypodish likes this.
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    When it comes to sheer volume and mass units like the Nodeus demo showcases then you're basically required to use a Pure ECS approach with the Jobs system and Burst Compiler. Hybrid doesn't do what you need, which is an entirely different approach to data mapping and memory management which ECS/Jobs/Burst provides.
     
    Antypodish likes this.
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,754
    Fair enough. I may then just keep study on topic and do some prototypes.
    Yep, I have seen the thread on physics with ECS. Super excited.
    But neither is ready, not clear when will be, nor is officially supported by Unity (as far I am aware).

    Even responses are not what I hopped for, never the less, I am happy for for them, as it clarifies what contains are existing and which approach to take next.

    Until then, I will try sit tied. ;)

    Many thanks.