0

Edit 2. Added screenshot of logcat. If I reduce the number of sprites to 1, I still get this intermittent 'stop/starting' - so I don't think it's my code, as with 1 sprite my frame rate hovers around 85-90 fps. I'm guessing it's something on the phone, there are lots of things being logged by logcat so I'm assuming lots of things running in the background. Is there any way to give me app some kind of priority over other services while it's running?

Edit 1. Please see edit details at the end of the question

I've created a sprite test in which I render aprox 290 sprites.

The frames per second with 1 sprites was around 80 and with 288 it is still at about 30, the problem is that the sprites stop and start every now and then, it's not the frame rate obviously, so does anyone have idea what may be causing this? (Just to be clear it's not slow down, but rather, smooth movement for a while, then everything kind of stops for a fraction of a second, then it's back to smooth).

This also happens with one sprite on the screen - but only intermittently and every 5 seconds or so - the more sprites I add, the more it happens, but the frame rate is never dropping below 30 fps, (which I understand should be OK for smooth movement), so I'm just trying to understand what this could be.

My sprites are created out of a custom class, but there are only 3 actual objects created (the background, a sprite that moves across the screen (so I can gauge smoothness) and then 288 sprites (which are actually the same object re-used) which are rendered in batches of 6.

Thanks for any help.

The hardware is a Samsung Galaxy Ace phone.

Edit OK, so I altered by batching routine and now I'm rendering 24 sprites per call (14 calls = 336 quads + moving sprite + background = 338 quads) and am getting around 47 FPS, so I'm left wondering what could cause this 'jerky' movement apart from the GC or the frame-rate dropping too far?

enter image description here

Zippy
  • 3,826
  • 5
  • 43
  • 96

1 Answers1

0

Sounds like the garbage collector running. To verify this, just look at logcat... do the jerky moments correlate to lines tagged "dalvikvm" and lead with "GC_"?

Reuben Scratton
  • 38,595
  • 9
  • 77
  • 86
  • Hi @ReubenScratton I checked the CG, but it's not running at all during my loop. Very strange. I've will update my question to reflect my further testing. – Zippy Apr 14 '13 at 16:27
  • A 5 second interval still sounds like GC. Sure you've not filtered out debug tags from your logcat view? – Reuben Scratton Apr 14 '13 at 18:05
  • @RuebenScratton, logcat filtering is definitely set up correctly, as CG does appear, but definitely not during my main loop. Any other ideas? – Zippy Apr 14 '13 at 19:53
  • @RuebenScratton, I've been doing some more research of this and I don't actually think it's my code (Not 100% Sure but it seems not). I've added a screenshot. My phone is constantly throwing the messages out that you can see in the my edit - not just when my app is running, but all the time). Any idea what this is? I've Google'd it but I cant find anything. – Zippy Apr 17 '13 at 17:04
  • Those messages are indeed irrelevant. Samsung ROMs tend to abuse system logging and are a pain to work with. – Reuben Scratton Apr 17 '13 at 17:37
  • Thanks @RuebenScratton - are you saying you don't think these are causing my problem? Something on the phone is causing these annoying 'jerky' movements, is there anything I can use to track down the problem? – Zippy Apr 17 '13 at 17:47
  • I'm going to post my code into a new question thanks for your help so far – Zippy Apr 17 '13 at 18:35
  • No I don't think those log lines were causing your problem. Although the original Galaxy Ace was a pretty low-specced phone as I recall... it might be worth running the BasicGLSurfaceView sample app from the Android SDK to see if it too exhibits the same problem. – Reuben Scratton Apr 17 '13 at 19:18