Hey all, first post here so I hope this is the correct place to ask a question like this.
I'm trying to create a 2d city builder type game (think simcity 3000) and I'm starting with terrain.
The look I'm going for is a 2d isometric terrain map. (something like this:
https://i.ytimg.com/vi/EN8Y-zoknrY/maxresdefault.jpg).
My current approach uses a fixed size VertexArray of tris, each tile is represented by two tris arranged in a rhombus, the 4 points of each rhombus are calculated using trigonometry (this is fairly trivial, I calculate the X and Y offsets of the topmost vertex) - see attachment 1.
I achieve a z axis (height) by creating a heightmap (2d int array), each vertex has a height. This height is added to the Y position of each vertex. Since vertices share a height this creates a really good 2d effect - see attachment 2 & 3.
The problem here is that, since the VertexArray is rendered in one go, this 2d height effect can't be applied to sprites or objects drawn after the terrain. See attachment 2, the house sprite is rendered on "on top of" a hill on the map, obviously, since it's a 2d vertex array.
My question is, what's the best way to draw sprites "behind" features on the terrain.
One idea I had would be to draw buildings as quads on the terrain vertexarray, but I feel like this may lead to significant performance issues since each layer I add doubles the number of vertices required. This also means every graphic I want to conform to the terrain must be stored as points on the vertexarray and so have to be included in the vertexarray texture.
Any suggestions?