Game running slowly on android

Previous topic - Next topic

UBERmonkeybot

Hi SuperKnowledgabelForumPeeps.

Noob question 40092

I have compiled my game to android to find it is running really slowly compared to windows,I think it is down to my polyvector stretch from 1280 x 800 to the resolution on my tablet (Galaxy S4 2560 x 1600).
From what i have read it would appear that i have to re-scale my graphics and game coords for each and every resolution,Is this really the case?
It seems rather mad that i can't just change the resolution on the tablet especially seeing as it will be running full screen.
I do remember seeing a post with someone saying they just used the 3d commands in a 2d implementation anyone have any thoughts on this?

Thanks in advance.

erico

I draw my game on a 428x240 virtual screen and at the end I zoomsprite it to fit resolution.
It works ok on the resolution you mentioned, your case should work too.

Got some code?

spacefractal

Proeprty im could set a max surface set for the resolution, which is possible, but this would property been a KitKat feature with fullscreen me thinks. Something like that could been done by a setting in strings.xml or directly in the androidmanifestxml manifest.

This due im could only been possible to set a fixed resolution once. If im tried to set a another one, then its will crash out.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

kanonet

You can not really change the resolution on devices like tablets, phones etc. So you need to some scaling by yourself. There are 3 ways that I see ATM:
-render everything to an offscreen and then stretch to fullscreen, see CREATESCREEN
-scale each image individually using ZOOMSPRITE or POLYVECTOR
-simulate 2D in 3D, but there is no Build in Way in GLBasic to do this, so you would need to write something yourself
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

spacefractal

#4
Render off screen might been even more slowdown.

You do need to scaling by your self. Also cpu on a android is not as strong as on pc. It's a common issue on Android. Why a high resolution screen might slowdown too much on such devices.

I'm did have similar issues on ouya and such device too, which did not have power to deliver 1080p at all, so I'm set the surface directly as 720p in Java, before creating the surface.

I'm do might look into intro this one to set a max surface resolution in either manifest or strings xml.

This is however not possible on ios through, but did also not have speed issues (on a least as 30fps).

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

UBERmonkeybot

I am sure if i go through my code i can speed it up in certain areas but it appears to be running 3 times slower than my PC and it appears to be mainly down to teh scaling.

I have tried zoomsprite  and also polyvector

I have also been messing around in android manifest.

and set these settings to this but it doesn't seem to make any difference.
android:smallScreens="true"
android:normalScreens="false"
android:largeScreens="false"

Here is a link to the code    https://drive.google.com/file/d/0B_jPlZixO8uQcmtreUVTb0t1QU0/view?usp=sharing

if you wish to disable debug comment out line 15 in jetpac page


Thanks for your time guys.

spacefractal

#6
Sadly, Its normal on Android.

Android Devices is slower than on PC, and they are not very good dealing with extreme resolutions like those. As im wrote previous im did have similar issues with slowdown on Ouya with 1080p, even with a 30fps target.

But im will in next version of Android Extras (12.11.4), so you in istribute\Android\res\values\Strings.xml, can do something this:

Code (glbasic) Select

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">JetPac</string>
    <string name="Force_TV_720">0</string>
    <string name="Max_Y_Resolution">720</string>
    <string name="Double_Scaling">1</string>
</resources>


Double_Scaling=1 would make sure, when the screen resolution is more than a double than the defined max y resolution, its will just halve the resolution for the surface.

PS. SETSCREEN is impossible to get working on Android. Im have tried to fix that.

PS. JetPac have just been rereleased by Rare for thier Rare Replay for Xbox One.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

erico

What I meant be ´some code´ was only about the scaling part. ;)
I did check the code and it seems fine.
I compiled for my note 2 and it also worked full speed.

I´m not sure what exactly could be the problem.
What you have going does not seem to be too much for android to handle.
Also, your code quits after a few seconds on android and pc, is that normal?

I´m using this system to scale things on my game:
http://www.glbasic.com/forum/index.php?topic=9848.0



UBERmonkeybot

#8
hmm i don't know why it's quitting so quickly,It's fine on my windows setup,maybe i left some debug code in that version.

I am not planning on selling or even finishing this game as it is just a tester to see how i get along with the language.

I just can't understand why the android system is like this,It seems insane to have to hardcode to a desired resolution especially when there are so bloody many of them...DOH!

UBERmonkeybot



Code (glbasic) Select

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">JetPac</string>
    <string name="Force_TV_720">0</string>
    <string name="Max_Y_Resolution">720</string>
    <string name="Double_Scaling">1</string>
</resources>



I have added that to strings.xml and it seems to make no difference

spacefractal

#10
of course :-). Im have just changed it in SDLActivity.Java today and need it to been uploaded and tested as 2.11.4. Those is new possible settings for Android Extras. Im upload later today.

Also in meantime, you should checkout PaintImage() im created in this thread:
http://www.glbasic.com/forum/index.php?topic=9848.0

This one uses virtual screen and then scaling it automatic for any resolution. This cant been used with hires graphics, but games with lower resolutions, this is property that you want.

PS. Yes Android can been PITY to work with, when compared to Windows. Here iOS is easier to dealing with resolutions.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

UBERmonkeybot

Ahhh i see.Haha ok.

I have had a look at your scaling routine,I will look in more depth.

Thanks very much

erico

yep, compile that scale routine and it should fit any android resolution, I think Spacefractal also added an auto re-scale touch controls routine too. :good:
Maybe you could then test with that? cheers!

MrPlow

I use similar Scaling to that of Space Fractals system...and I have good perforance results
for my Android apps.

Also are you using a Timer routine and what FPS are you setting your app at?!

I typically use 40 FPS for Android apps.


Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

#14
I'm target either 30 and 60fps. Greedy Mouse was target 30fps on Android, but a recent update, it's possible to run unlocked.

I'm thinks CatchOut run 60fps on most devices, but not all.

You do need doing frameskips and timing by your self.

PS. I'm forget to do that AE update. I'm are now in a little vacation trip and is first home later this week.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/