why do games in the browser seem choppy not smooth

Monkey Forums/Monkey Beginners/why do games in the browser seem choppy not smooth

dubbsta(Posted 2017) [#1]
other peoples games seem so smooth but when i launch anything games seem stuttery?
i havent used delta timing dont know if thats it. my pc has decent specs, legit copy win 10
...


Gerry Quinn(Posted 2017) [#2]
Can be so many different reasons, it's impossible to simply answer.

What sort of stuttering - do sprites not move smoothly, or does the game seem to pause for a fraction of a second? The former can be delta timing or (if subtle) conversion of floats to ints. The latter might be due to loading stuff during updates. Also HTML5 has a quirk in that colourising images is super-slow. If you are drawing large images with colour set to anything but (255,255,255) it will hit you hard - other targets will have no problems with this. (There are other things that can cause slowness, but in my experience this is the most likely in a game that is not hugely graphically or computationally intensive.)


Phil7(Posted 2017) [#3]
One thing I noticed with monkey games in html is a stuttering every second or so if I run it in firefox. No issue with that in chrome. But I didn't find the reason for that...


dubbsta(Posted 2017) [#4]
took all the setcolor out and seemed a little smoother but still had some occasional stutter, oh well guess its not too important for a protype anyway.. maybe
forgot to mention i use chrome and ie was worse.


Gerry Quinn(Posted 2017) [#5]
i probably wouldn't set up a new target just for this, but if you have a target other than HTML5 available, it would be interesting to see if the stuttering is still there.


Raph(Posted 2017) [#6]
SetColor is very slow in the basic HTML target (it's an HTML5 limitation). Loading art and drawing that instead is much faster.

There are some "webGL HTML5" solutions for Monkey, and they make a dramatic difference in the speed.


skid(Posted 2017) [#7]
Chrome has some very useful profiling in it's developer tools.


Gerry Quinn(Posted 2017) [#8]
SetColor is amazingly slow in html5. I have literally seen the Android emulator running faster than html5 when I use it a lot.