Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Android. Touch = Half FPS  (Read 1086 times)
0 Members and 1 Guest are viewing this topic.
Offline Cero
« Posted 2012-05-26 21:29:32 »

Premise: My phone is a weak LG e720, which has a slow single core processor, angry birds space runs like 5 FPS on it, previous angry birds was fine.
Using libgdx.

In my Android game, whenever I hold down the finger on the screen, on my device - I have not seen it yet on other devices, my FPS halfs.
Runs on a solid 60 FPS, but holding down the finger just halfs it.
It's not really what happens due to finger down; because what happens is scrolling. However automatically scrolling runs 60 fps. Mere holding down and not moving results in 30 FPS.

Using DDMS I couldn't really profile it, I just didn't understand it really.

Also, running it on PC without Vsync, the FPS are exactly the same when holding down or not: ~ 2000fps on my machine

Another interesting thing is, I have witnessed this before: When I installed a NES or SNES emulator, whenever I would hold a button down, the game would dramatically slow down, but only then.

You guys got any ideas, besides "well, it's a slow phone" - since I do want the game of course to run on slow phones.

Offline princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2012-05-26 22:36:42 »

I think it's using the CPU to process the finger tracking stuff in the OS, and it would seem to be using rather a lot of it.

Cas Smiley

Offline ruben01

Senior Devvie


Medals: 4
Projects: 3



« Reply #2 - Posted 2012-05-27 06:40:56 »

There was an issue with android on older version of the OS (supposed to be older than 2.0 but there are reports of people with the problem on newer versions, like 2.1 and 2.2) the problem is that the native side of the android os floods the android application with touch events, and that is why you see the game slow down, the touch handling is taking a lot of your cpu.

In newer versions this is patched and is not an issue, but on older versions the recommended fix (not a total/real fix but at least it makes it better) is to add a sleep() call in your input handling method to keep the native code from calling the input handler so much.

Since you are using libgdx you can use the class com.badlogic.gdx.backends.android.AndroidApplicationConfiguration when you create your android app and set the parameter touchSleepTime on it to 16 like it is recommended in the javadocs for the class.

hope it helps, and I would love to know if it does fix it for you, and what version of the android OS you have.

Rubén

EDIT: this is an issue about this on the android project - http://code.google.com/p/android/issues/detail?id=7836

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #3 - Posted 2012-05-27 14:32:32 »

Since you are using libgdx you can use the class com.badlogic.gdx.backends.android.AndroidApplicationConfiguration when you create your android app and set the parameter touchSleepTime on it to 16 like it is recommended in the javadocs for the class.

Ah nice, I didn't notice that.


I would love to know if it does fix it for you, and what version of the android OS you have.

Well 40 FPS instead of 30 FPS.
Android 2.2.1

Offline badlogicgames

« JGO Bitwise Duke »


Medals: 71
Projects: 2



« Reply #4 - Posted 2012-05-29 17:31:13 »

That's pretty much as good as it gets. I originally started working on a HTC Hero in 2009, had the same issues. There's no fix i'm afraid. 40fps is plenty though. Welcome to Android :/

http://www.badlogicgames.com - musings on Android and Java game development
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (8 views)
2014-11-26 15:22:04

toopeicgaming1999 (9 views)
2014-11-26 15:20:36

toopeicgaming1999 (6 views)
2014-11-26 15:20:08

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (24 views)
2014-11-25 11:26:43

Gibbo3771 (22 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (74 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!