Hello,
I couldn't find info on this topic so if someone here has experience about this, it would be great.
I'm trying to do a scrollable, *ZOOMABLE* top-down tile based game. Zooming should be smooth and done with a slider, as it was done in Interplay's MAX for instance. - If you don't know this late 90's game, so you missed something

-
My concern is obviously with perf problems. I can think of two ways of doing it.
I assume tiles are 40 pixels in side.
1° I will have to draw and maintain a 1:1 scaled image and then scale and copy the part that is visible to the canvas. What it takes :
* memory for the 1:1 picture (let's say at max zoom out it would allow displaying 160x160 5 pix tiles map on a 800x800 canvas which makes an offsceen 1:1 pic of 6400x6400 32bits = about 16.4 MB)
* memory for the unitary ground textures and units (1:1 scale)
* a scale operation of the 1:1 pic each time the visible part of the map changes (unit movement, scrolling, zooming in/out) and a copy of the complete result to the canvas.
possible optimization : only scale and copy the part that has changed (for scrolling and unit movements only; not possible when scale factor changes - but i fear artifacts at the borders of the updated zone).
2° Maintain an offscreen buffer sized as the canvas and paint already scaled ground textures and units on it.
What it takes :
* memory for offscreen buffer (less than for the 1:1 pic however)
* memory for the unitary ground textures and units (1:1 scale)
* memory for the scaled textures and units
* a scale operation on the textures and units when zooming in/out and a complete redraw of the offscreen buf (only required for the visible ones).
* a 1:1 copy to the canvas of the part of offscreen buf that has changed.
I'd like a rather smooth graphical result when scaling. And I have the intuition that picture would be better with a global scaling as in 1° than with a assembly of "unitary" scalings as in 2°.
I can't rely on pre-scaled pics as scale level should also be smooth. I could probably have 2 or 3 textures scaled for each unit as an optimization but not more.
So do you have any advice on this or maybe a third option ?
thanks for your help