Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

8 years ago by empika

Hi there

It seems the default res for Impact games is 240x160? I'm thinking of 480x320 but was wondering what impact this might have on performance.
Does anybody have any experience using higher resolutions or has anyone done any tests?
I'm wondering for both in browser and potentially on iOS too.

Cheers
Edd

8 years ago by Graphikos

Impact (and canvas) is capable of running at whatever resolution you want just know that the bigger the size the more that has to be drawn which requires more processing. I run Galaxis at full browser (and full screen) but I'm very mindful about how many draws are going on.

Mobile devices work best if you run at native resolutions.

8 years ago by empika

Thanks Graphikos.

I presumed that a larger canvas will affect draw time. I suppose i'm wondering what the kind of limits are. Like 240x160 will buy me 100 draws at 60 fps but 480x360 would only get me 50 draws.

Any idea if drawing an image is quicker than drawing straight to canvas? ie, is drawing an image 1 draw and drawing a rectangle using fillRect also 1 draw?
So I can get equivalently complex images from from using an image as opposed to creating something directly on the canvas?
Also, how does image size affect draw speed and performance?

I guess I don't expect you to know this.. perhaps Domonic can answer some of these questions. Either that or i should just benchmark myself! ...although the reason i started this thread was because i was getting some bad fps in that i was not expecting, this seems to be intermittent and I suspect is just chrome freaking out as I get the same issue it at variable resolutions.

8 years ago by Graphikos

It's not a 1 to 1 sort of comparison... and using the term "draw" is a very loose term even for Impact. Each type of drawing function you do with canvas will have it's own performance.

I believe that bitmap drawing is faster in a lot of cases rather than canvas draws. Most the time its recommended that if you are going to do canvas draws then cache it to an offscreen canvas and then draw that every frame (as benchmarked here). Doing that is probably almost identical in performance as to drawing and image.

With Galaxis I do a lot of context draws and in the case of this map it's all context draws so I cache it to a offscreen canvas which really boosts the performance.

/><br />
<br />
However there are also times when canvas drawing probably out-performs bitmaps, especially when opacity is thrown in the mix.  It's been a good while since I've benchmarked bitmap vs rect drawing with varying levels of opacity but in the end I went with rect draws.  Things might be different now... especially with the hardware acceleration advancements that have been made with the browsers.<br />
<br />
A quick google search came up with this jsperf test that might give you a bit more insight as to performance.  In this test, on chrome, bitmap is still  much faster than canvas draws.<br />
<br />
<a href= http://jsperf.com/canvas-draw-tests

8 years ago by empika

That's super useful, thanks! I never thought about the pre-render stuff.

I think there are a million optimisations I can make to my code now.

8 years ago by SlouchCouch

i roll at 1200x800 and it works fine with a couple hundred draw calls.
Page 1 of 1
« first « previous next › last »