I need to render a "tile" game, which are like these:
or
or
I don't know how to render them in correct order. I intend to perform a sorting operator before every rendering (depending on their Y position). However, I find it may be expensive, and very few objects change their Y positions.
Is sorting the best way to achieve this (I mean, the performance)? Is there any other way? What data structure should I use?
Please note: my question is, the way to draw entire game field with good performance, every frame (ignore the HUD and background).