bitcraft / pyscroll

make scrolling games with animated maps in pygame
GNU General Public License v3.0
177 stars 28 forks source link

Sprite scale clamping #28

Closed quarrel closed 6 years ago

quarrel commented 6 years ago

It would be great to have a way to limit sprite scaling. At the moment I have situations where I want to zoom out, and it all works very well except that sprites get very small. If I could just clamp the maximum scale for the sprite scaling that would great. Similarly zooming in a lot.

Unfortunately it seems like the scaling is applied to the final surface, so it would be a bit of an overhaul to change it.

However, it does strike me that there is an opportunity, in that the scaling of map tiles shouldn't be repeatedly happening anyway?

Even thoughts on achieving this. Thanks for pyscroll :)

bitcraft commented 6 years ago

You're correct, scaling is done after sprites and map are rendered. If you want to manage the size of the sprites, then you will have to scale them separately before passing them to pyscroll. Perhaps when when zoom is beyond a certain value, scale all your sprites from the original images to a larger size first.

However, it does strike me that there is an opportunity, in that the scaling of map tiles shouldn't be repeatedly happening anyway?

No opportunity here. Map tiles are never scaled, even with zoom operations; only the final output is scaled. I've done a lot of benchmarks, and the way pyscroll exists now is a compromise of a lot of use cases. Its not as slow as it would seem. Changing the zoom operation would complicate it and possibly make other operations worse. Pre-scaling tiles does lead to better performance depending on the zoom level, but it adds a lot of complexity.

quarrel commented 6 years ago

Fair enough. Thanks very much for the feedback, ideas and the consideration.

bitcraft commented 6 years ago

If you don't mind @quarrel I'd love to see the progress on the game, if you don't mind sharing. My goal with pyscroll is to make pygame easier for people to use pygame, and I like seeing whats possible with it. Your project sounds interesting.