Forum Discussion
kbenson
15 years agoVisitor
"NanoZim" wrote:
To see the performance discrepancy, you need an HD set. I put my work-in-progress game here:
https://owner.roku.com/Account/ChannelCode/?code=N0RDJ
Believe me, I'm well aware of the performance limitations of the canvas. We've had plenty of discussions here about it. 😉 There are techniques (hacks) to mitigate the problem, and you can find hints about how to use them effectively in prior threads. In short, you use multiple canvas objects. If done intelligently, I think you could probably use a separate canvas for the background image and foreground tiles. It's a little tricky because you have to re-show the background if you move something in the foreground (or it leaves the pixels changed), but if you change the way you show the selected tile, you can probably get away with just re-showing the foreground canvas every action. Even if you have to re-show the background canvas, after it's been shown once, calling .show() on it again without any changes is very quick (probably less than 20ms, but you have to test).
It's a lot of work, but it can yield somewhat better performance.
P.S. Have you tried shipping with two background images, one for SD and one for HD to see if a non-scaled HD image yields better performance? Sometimes it's little actions you don't expect to be problematic that cause the most trouble.