+ 10

Why so slow?

I created a game on HTML5 and it works fine on a computer. But on the phone it slows down. Watch my game and share what your FPS. https://code.sololearn.com/WWkBJcm6X0yJ/?ref=app

13th Oct 2018, 9:12 AM
K137(){/**/};
K137(){/**/}; - avatar
16 Answers
+ 8
O thanks. I'll see. I forgot about Apple.
13th Oct 2018, 10:07 AM
K137(){/**/};
K137(){/**/}; - avatar
+ 7
Interesting. I fix width and height of the game. But I have no idea why it does not work on iPad.
13th Oct 2018, 9:39 AM
K137(){/**/};
K137(){/**/}; - avatar
+ 7
What kind of errors do you see? Can you write me a text of em?
13th Oct 2018, 9:56 AM
K137(){/**/};
K137(){/**/}; - avatar
+ 7
I have no errors on my Nexus. In menu 30 fps. In game 0-1 fps. Sad.
13th Oct 2018, 9:58 AM
K137(){/**/};
K137(){/**/}; - avatar
+ 7
Another version of the game is here. Transpiled to ES5. https://code.sololearn.com/WBGSFKX9P742/?ref=app
13th Oct 2018, 12:49 PM
K137(){/**/};
K137(){/**/}; - avatar
+ 6
Thank you for tests. I fix buttons. But slow FPS on phones is result of a lot of math in my code and mine not enough knowledge of JS.
13th Oct 2018, 3:07 PM
K137(){/**/};
K137(){/**/}; - avatar
+ 6
Of cource it have. Objects have a flag or a method 'drawable' and if they are off-screen, they are not drawn or checked for collisions. Thanks.
13th Oct 2018, 9:47 PM
K137(){/**/};
K137(){/**/}; - avatar
+ 5
Update: Now the game runs 10 times faster 20-22 fps compared to 2 fps before. Still to start i had to tap in the dead center below start button. Similar behaviour was observed with other buttons too. Previous: The game gets 54 fps while loading. But after that its 2fps. Clicking the 'start' button does not work -- possibly due to certain overlapping issues-- and once inside 'controls' or 'about' can't exit. I tried your code via a web browser outside sololearn and there weren't any overlapping issues and i could start the game too. but it was 2 fps so i quit.
13th Oct 2018, 2:13 PM
Lord Krishna
Lord Krishna - avatar
+ 4
ive got an ipad mini 3 and an iphone 6. on the ipad im getting 'loading' on the page and a console script error at the bottom. on my phone, i'm getting the ui for the start of the game and two concloe script errors at the bottom so i cannot continue to the actual game. i looked at your code but the solution is not obvious to me
13th Oct 2018, 9:50 AM
Eleanor
Eleanor - avatar
+ 2
it isnt working at all on my ipad
13th Oct 2018, 9:23 AM
Eleanor
Eleanor - avatar
+ 2
it literally just says script error. maybe youve only developed it for androids and pc? try looking up cross platform mobile developing. its an issue i always got with making my own games
13th Oct 2018, 10:03 AM
Eleanor
Eleanor - avatar
+ 1
No mate! It runs on 60fps. But it is not adaptive to my screen and half of the game is out of my screen
13th Oct 2018, 9:21 AM
Ilias
Ilias - avatar
+ 1
Guy, Is there any optimisation code? can you check if an object is in the visible screen? If it isn't you shouldn't render it and that will make it run faster
13th Oct 2018, 9:39 PM
Ilias
Ilias - avatar
+ 1
the button got it after press play doesn't works fine. It get pressed when I press down of it
13th Oct 2018, 9:51 PM
Ilias
Ilias - avatar
+ 1
I got only up to 60 GPS but the buttons not really working fine on my phone though.
14th Oct 2018, 1:47 AM
Xander Lim
Xander Lim - avatar
+ 1
some buttons don't work
14th Oct 2018, 4:31 AM
Inkosi
Inkosi - avatar