Hi!
let's say for example I intend to make a game like Age of Empires 2 ie overhead view, huge map and potentially lots of different sprites intersecting with the current view.
What is the optimal way to do something like this, in terms of RenderTextures ? I admit I'm a bit confused.
The simple solution would be :
- have single rendtexture of the size of the view
- redraw at each frame everything that is viewable
Now, let's assume for instance that the ground texture takes a significative amount of time to draw (for instance, because shaders, or could be tons of textures blended), and that I somehow want to cache it. The same problem would also happen if I wanted to make a game like Baldur's Gate, where the whole map (maybe 10k*10k pixels) is apparently a huge image with no repetitions, and I wouldn't want to load from disk chunks of the map at each frame, when the camera is moving.
I was thinking of doing something like that :
- split the whole map into RenderTextures of 512x512 pixels that would have the cached ground texture
- depending on the current view, draw first the correct cached textures, then draw on top the sprites
My question is : how is that approach scalable with respect to the map size ? I don't really understand how RenderTextures are actually working: is the data stored on GPU ? what's the max number of RenderTextures I can cache? How to compute this max number ?
Basically, what would your advice be for this specific use case ?