Migrate my production game to Shapes?

Avatar
  • updated

I have a mobile game in production (Exoracer) with a very powerful level editor. At the moment, you can place sprites of basic shapes to build 2D levels. Players built more than 80k levels and some have been pushing the limits of the editor: certain levels reach thousands of sprites arranged in beautiful landscape (see attached image, entirely made from circles, rectangles, triangles, etc)

Image 767


I'm looking to bring the editor to the next level, and Shapes had a lot of potential: crisps shapes at any size, variable rounded corners, variable border thickness... All those things are hard to reproduce with standard sprites

However I'm running into some performance issues. First with frustum culling, which I solved by setting all "Bounds sizes" to 1, and forcing myself to never use shapes bigger than 1, and use scale instead (which breaks rounded corners and borders)


But the biggest issue is I must render all shapes in the exact order set by the player (i.e. like in Inkscape), aka every shape will have its "SortingOrder" property set to a different value. And this breaks GPU instancing for understandable reasons

I was so excited to bring my level editor to the next level with vector graphics, but I'm starting to think this is not a good use case for Shapes. I just wanted to confirm I'm not missing something!

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Avatar
Freya Holmér creator

hm, yeah I think the sorting order issue makes this case tricky, GPU instancing and sorting doesn't always go super well together like you say. You could of course selectively use it for only the more complex things, like dynamic rings/circles etc, but it's possible it'll be hard to get it performant if used globally. You could use immediate mode drawing, which gives you direct control over draw order, but it's possibly too much control! as it won't auto-sort with other objects in the game anymore, and you won't get any early culling of those shapes

Avatar

That makes sense, thank you for the super fast reply! :)