State of 2D packages for DOTS?

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+?

2 Likes

I personally wouldn’t hold my breath; I would put effort into finding a solution with stuff that is published now.

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?

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.

7 Likes

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”

10 Likes

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?)

1 Like

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.

8 Likes

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.

Can you have some example on ECS architecture that roguelike game does ? I just curios btw

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…

Or, you could just use NSprites

1 Like