sprite speed on html5 canvas.

Monkey Targets Forums/HTML5/sprite speed on html5 canvas.

Jesse(Posted 2011) [#1]
I found this post and thought it was quite interesting:
http://sebleedelisle.com/2011/02/html5-canvas-sprite-optimisation/
I think it's helpful since I notice that Monkey does draws in float number and might improve performance for any one interested in modifying their game JS file.


AdamRedwoods(Posted 2012) [#2]
Sorry to dig up old threads, but this seems like good info, especially if OSX is slower.
Just do an OR with x,y and 0 (ie. x | $00) to convert it to a whole number.

the bunny example sped up from 15fps - 60fps on OSX safari.


Beaker(Posted 2012) [#3]
You might get also get a speed up if you draw your static game background behind the canvas. Not actually tested, but I have seen it used elsewhere.


slenkar(Posted 2012) [#4]
maybe this could be used with the mojo image filter,

in drawsurface and drawsurface2 i put

x = ~~ (x+0.5);
y = ~~ (y+0.5);

which did the job,

how exactly do you do you do it with OR?


Tibit(Posted 2012) [#5]
Has this been implemented?

Look at this:
http://seb.ly/demos/bunnybench/bunnies_canvas.html

Monkey should be able to do the same, right?

Would be nice with a html5 speed boost, especially when the solution is THAT simple!

He made the original for Flash, and also he tested it on WindowsPhone7. Seems like an excellent demo to port and test in Monkey :)
http://blog.iainlobb.com/search?q=bunny

Render 4000 bunnies at 30 fps
http://www.iainlobb.com/bunnies/BitmapTest.html
"This was replicated by readers on all Mac and Windows browsers except for Mac Safari, where it was down to 10-20 fps"

"Bitmaps faired very badly on Android - it couldn't even render 10 bunnies at 30fps."

Source to his Benchmark in flash: http://www.iainlobb.com/bunnies/BUNNYMARK.zip


slenkar(Posted 2012) [#6]
It doesnt seem to make any difference in chrome but does in firefox.

It could be enabled with the mojo image filter option