Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
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  
  No Stable Frame Rate - with Demo  (Read 2887 times)
0 Members and 1 Guest are viewing this topic.
Offline kevglass

JGO Kernel


Medals: 170
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Posted 2009-09-19 19:37:46 »

I'm still having trouble getting a really stable smooth framerate on Android devices and I wondered if anyone has got it right? I'm using Android 1.5 with OpenGLES. I use two threads - logic thread and render thread (part of GLSurfaceView). I render with RENDER_ON_DIRTY. Essentially logic loop is:

- calculateWhenTheFrameShouldEnd
- doLogic
- requestRender
- waitTilTheFrameShouldEnd

Render, doesn't do anything exciting, just splatting a few quads to the screen.

While this runs pretty smoothly it still glitches regularly. I've observed this behavior in any GL based animation game that I've tried (including the ones here). They run ok, but it doesn't feel really smooth. To illustrate I knocked a silly game together the last few nights:



Applet: http://www.cokeandcode.com/applets/defend/

Android: http://www.cokeandcode.com/applets/defend/defend-2.apk

While it's just about playable (from a game play point of view) the jitters are still fairly evident. The game creates zero garbage outside of the Android SDK and the logic going is really pretty simple.

Bit confused, not sure why it should be bad, has anyone got a simple example of something that runs really smoothly on the handset and uses GL?

Kev

Offline Ranger
« Reply #1 - Posted 2009-09-20 06:58:49 »

I don't use GLSurfaceView.  I manage the GL thread myself and use EGLContext.getEGL().  Then in the GL thread I use a wait and the game loop calls notify (this is mostly likely how RENDER_ON_DIRTY works).

So I have 3 threads:
- Game loop
- GL thread
- EDT

The game loop thread will spend a lot of time sleeping (as I only target 30fps).  I think this allows other processes to run in the background and gives a more stable frame rate.

I read somewhere that the next version of Android will stop widgets and other background processes from hogging the CPU.
Offline kevglass

JGO Kernel


Medals: 170
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #2 - Posted 2009-09-20 08:52:49 »

Yeah, it's the same thing. I get the same behaviour in Craig's Race too.. most of the time it's smooth then jitter.

Kev

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Nate

JGO Kernel


Medals: 149
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #3 - Posted 2009-09-20 09:11:14 »

The 1.5 Android SDK generates garbage. This is ridiculous IMO, but true. There is a thread on their newsgroup somewhere about it. Connect up DDMS using the batch file, not Eclipse, and you can watch the memory allocations in both your code, if any, and the SDK. The SDK causes garbage collection about every 20 seconds on my G1, probably depending on how much OpenGL stuff you are doing. Maybe they'll fix it at some point!? Haven't tried 1.6.

FWIW, I use a modified (ie completely gutted) version of GLSurfaceView. There are two threads, the Android UI thread (where events come in) and the GL thread. I run my event listeners (onTouch, etc) on the GL thread to keep things sane. I don't use the request render stuff, I just try to render at 60fps. Hopefully soon I'll post my code.

Offline kevglass

JGO Kernel


Medals: 170
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #4 - Posted 2009-09-20 09:24:38 »

Yeah, I took a look at GLSurfaceView after you mentioned it before. I'm using a hacked down version (simplifing and running events nicely). Still no luck.

FWIW, in SingSong when it's scrolling along the music/lyrics I see the same thing.. just slight jitters that make draw your attention.

On another note, the demo above also shows how the touch screen isn't quite responsive enough for action games.

Interesting the SDK causes a lot of garbage... bit of a pain in the bum that. I've tried frame smoothing also and still no real luck. It almost feels like the timing isn't quite right.

Kev

Offline Nate

JGO Kernel


Medals: 149
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #5 - Posted 2009-09-21 05:05:10 »

Re-reading my post I realize I wasn't as explicit as I meant to be. It is the OpenGL stuff in the SDK that generates garbage, so there is nothing we can do if we want to use OpenGL. I haven't tried frame smoothing, I just considered it good enough as I had a lot of other things that needed attention.

Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #6 - Posted 2009-09-21 08:30:09 »

I don't have any issues with Craig's Race, could it be other processes on the device?, have you tried a scene with no widgets?, tried killing other processes?. Just a thought. Might be totally the wrong path, but it's a thought Smiley.

Endolf

Offline kevglass

JGO Kernel


Medals: 170
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #7 - Posted 2009-09-21 08:33:31 »

I've tried lots of things Smiley It's more likely that if you're just focused on playing the game you don't notice the slight hiccups - but if you just want it scrolling you'll see slight blips - not enough to worry about probably but enough to make it not look quite perfect Wink

Kev

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.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (19 views)
2014-09-24 16:12:06

Grunnt (44 views)
2014-09-23 14:38:19

radar3301 (26 views)
2014-09-21 23:33:17

BurntPizza (62 views)
2014-09-21 02:42:18

BurntPizza (32 views)
2014-09-21 01:30:30

moogie (39 views)
2014-09-21 00:26:15

UprightPath (50 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!