send a tag suggestion

which tags should be associated with each other?


why should these tags be associated?

Use the form below to provide more context.

#starlight engine


hthrflwrs
@hthrflwrs

ok SO:

There are now two types of visual object in my game engine. There's, like, sprites and shit, and then there's splines. Sprites are queued into the SpriteBatch and get flushed to the GPU at the end of the frame, while splines are rendered immediately mid-frame using DrawPrimitive. What this means is that right now, EVERY sprite will render after/in front of EVERY spline. This is clearly not ideal. To fix this, there are two primary options I can see:

  1. Turning every sprite into a spline asset or every spline asset into a sprite. Both of these options would solve the render queue issue, but neither would be ideal for my workflow. I need sprite assets so I can use SpriteFonts easily, and I need spline assets so I can make animations easily.
  2. Adding specific "Spline layers" to my visual layering system, so when it's time to render all the splines, the game runs a SpriteBatch.End() call, flushing all queued sprites to the GPU, then draws the splines one by one, then runs a SpriteBatch.Begin() call so the rest of the sprites can draw afterwards. This goes against LITERALLY the first piece of advice every Monogame developer gets, because the SpriteBatch.End() call is expensive and you only want to use it once per frame. This would increase the number of End() calls from one per frame to one per scene (plus one), which could get pretty pricey. However, I think it would be funny, and if I can make it work I'll feel very proud of myself, so I'm probably going to try this one first.

If there's a third option out there, I'd love to hear it! Right now I'm just Trying My Best.