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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question State of 2D packages for DOTS?

Discussion in 'Entity Component System' started by Shaosil, Jun 19, 2022.

  1. Shaosil

    Shaosil

    Joined:
    Feb 3, 2013
    Posts:
    7
    I've been trying to learn the ECS patterns over the past couple weeks so that I could efficiently draw 2,000+ sprites with physics on the screen without dropping to 30fps like using GameObjects does. I've had some success with it (200+ fps for what is basically the same functional code is amazing).

    However, my old GameObject project was using the 2D packages, with sprites and 2D physics, which I understand to be using Box2D instead of a Unity engine. I've got my ECS project working by using quads with textures and sphere physics shapes constrained to a 2D plane, but that isn't an optimal solution. I'm also running into Z-layer ordering issues with the quads (see this thread).

    I haven't put too much effort into fixing that though because I assume 2D packages for DOTS are still in development, but I couldn't find it on the roadmap. Is there any news on when we can expect to be able to use 2D tools for entities 0.50+?
     
    Last edited: Jun 19, 2022
    charleshendry likes this.
  2. elliotc-unity

    elliotc-unity

    Unity Technologies

    Joined:
    Nov 5, 2015
    Posts:
    228
    I personally wouldn't hold my breath; I would put effort into finding a solution with stuff that is published now.
     
  3. Krajca

    Krajca

    Joined:
    May 6, 2014
    Posts:
    347
    AFAIK you are on a good track. Quads + UV material override + custom sorting is the best (and easiest) replacement for 2D in the hybrid renderer. As for physics, I see that PhysicsShape has a plane type but not a sprite. You can always make mesh colliders with sprites or try and recreate them with spheres and planes.

    @elliotc-unity I sound it very strange that the project Tiny had SpriteRenderer conversion but it never was a part of HR. Do you know why?
     
  4. elliotc-unity

    elliotc-unity

    Unity Technologies

    Joined:
    Nov 5, 2015
    Posts:
    228
    Internal org chart issues, i.e. no great reason. Tiny people worked on the SpriteRenderer conversion, and when the Tiny team dissolved, nobody kept working on it, and the hybrid renderer team didn't get any extra people to deal with 2D things.

    In general it's hard to advocate internally for 2D + dots specific stuff, because it's less common for 2D games to have as serious scaling/speed issues, and dots's main selling point is speed (speed of loading, speed of simulation, speed of rendering, editor staying more performant in humongous projects, etc). Plus, as the OP demonstrates, it's much more doable and effective to roll one's own 2D dots situation than it is to roll one's own anything else, e.g. terrain, animation, authoring tooling, 3d rendering, codegen, job system, etc.
     
  5. d3st1ny33

    d3st1ny33

    Joined:
    Apr 28, 2014
    Posts:
    5
    I just came here to show my support for 2D DOTS.

    The engine supports 2d and 3d and is one of the main selling points of the Unity engine. DOTS' main selling point never mentions 3D by name as far as I can tell. This is probably why most of us kind of expect 2D support.

    There are many 2D physics and tools available in Unity. OP implemented a fraction and is already annoyed enough to check if they should wait for a 2D dots package. Is it doable? maybe. Effective? debatable.

    I also worry about the future Unity ecosystem. What do tutorials, scripts, and assets look like when the best practices/most performant methods are not available if your game is 2D?

    If you need a financial reason to support DOTS in 2D look no further than the asset store
    . Seriously, do you think the average non-coder will know these nuances before buying an asset? Do you think developers will develop specific 2d packages for their algorithms/scripts? No, you will see more refunds and fewer asset store sales.

    Sad that the 2D engine has to be advocated for. It often seems to be forgotten from this side of the table.

    Even sadder that it's not even "Under Consideration"
     
    Last edited: Jul 28, 2022
  6. Ruskul

    Ruskul

    Joined:
    Aug 7, 2014
    Posts:
    72
    Even sadder, because 6 years ago they said they were making it to have low level access, in a response on a thread about the need for 2d physics callbacks (after a collision has occurred, but before the solver solves it). Ivʻe been holding my breath ever since. You can do all sorts of fancy things (like even write your own methods to resolve collisions) if you have access to those callbacks.

    The big one is that you can set tangental forces. Unity will claim theyʻve provided this with the surface effector, but it wonʻt power the object it is sitting on. I can make a conveyer belt to move objects with it, but I canʻt make a conveyer belt move itself with it (a tank anyone?)
     
    OldMage likes this.
  7. Micz84

    Micz84

    Joined:
    Jul 21, 2012
    Posts:
    441
    There are a lot of 2D games that can benefit from DOTS. For example, games like Factorio, Stardew Valley, Terraria, Vampire Survivor, Prison Architect, RimWorld.
     
    Dakkawoof, kvfreedom, Ruskul and 5 others like this.
  8. Rytif

    Rytif

    Joined:
    Dec 28, 2012
    Posts:
    8
    Or just using the ECS architecture like nearly every roguelike does. But nerp. Let's make it "performance only" and a big PITA to code.
     
  9. unity_F63123C2CD71F9D79C2A

    unity_F63123C2CD71F9D79C2A

    Joined:
    Dec 13, 2022
    Posts:
    1
    Can you have some example on ECS architecture that roguelike game does ? I just curios btw
     
  10. Dakkawoof

    Dakkawoof

    Joined:
    Oct 1, 2010
    Posts:
    6
    Bah shame.

    I saw that dots released officially and i finally wanted to give it a go. Project is 2d, so i'm (more than) a bit bummed out that it doesn't have support or even consideration of such... :T

    Well... it is what it is I guess... Hope the winds change within Unity as there are definitely lots of use cases for 2d. In the meantime ill just have to be salty and do yet another workaround and wonder why I am not using something that would be better suited for the job...
     
  11. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,295
    Or, you could just use NSprites
     
    Dakkawoof likes this.