Crabs!

I start dipping below 60 FPS after 1300-1600 crabs, seems to depend on my phone’s mood. I really hit a wall after 2300 crabs, drops down to 5fps and stays there til they start dying off.

Yeah, I wonder why drawing 128x2000 = 256000 triangles is slow on a phone. I mean, you’re just drawing a quarter of a million triangles. :cranky: Try to run that on low end desktop graphics card, and it’ll be about that slow too I bet.

The circles don’t stay on the screen. There’s maybe five of them on the screen at a time tops.

You’d still have to do a quarter of a 0.75 million vertex transforms to find out if they are on the screen or not.

At the 600 mark, I just left it and it goes from 16fps to 60fps and cycles. Some heavy garbage collection going on?
I’m using a custom rom on my Milestone 1 on Android 2.3.5.

Also I just got it to crash:

[quote]10-07 20:21:36.233: ERROR/AndroidRuntime(1025): FATAL EXCEPTION: Main Loop
10-07 20:21:36.233: ERROR/AndroidRuntime(1025): java.lang.NullPointerException
10-07 20:21:36.233: ERROR/AndroidRuntime(1025): at com.shavenpuppy.jglib.sprites.GeometryStyle.render(GeometryStyle.java:420)
10-07 20:21:36.233: ERROR/AndroidRuntime(1025): at com.shavenpuppy.jglib.sprites.SpriteEngine$RenderQueue.add(SpriteEngine.java:322)
10-07 20:21:36.233: ERROR/AndroidRuntime(1025): at com.shavenpuppy.jglib.sprites.SpriteEngine.build(SpriteEngine.java:797)
10-07 20:21:36.233: ERROR/AndroidRuntime(1025): at com.shavenpuppy.jglib.sprites.SpriteEngine.update(SpriteEngine.java:701)
10-07 20:21:36.233: ERROR/AndroidRuntime(1025): at net.puppygames.minandroid.MinimalAndroidActivity.update(MinimalAndroidActivity.java:707)
10-07 20:21:36.233: ERROR/AndroidRuntime(1025): at net.puppygames.minandroid.MinimalAndroidActivity$MainLoop.run(MinimalAndroidActivity.java:103)
[/quote]

new crabs, LG E720.

Well I 'm not sure, when I was at 200 crabs, 60fps, crabs were deleted when I added more, I hope this is on purpose and not garbage collection

if thats the case then around 200. phone should be single core, not as powerful

Crabs only last 60 seconds so you do need to do some furious tapping to get the numbers up. The NPE is more of a worry though. Strange only one person has got it :confused:
Especially as an NPE is impossible on that line. Hm. Running the version which creates 10 crabs per tap, yes? Shows crab count and FPS?

Cas :slight_smile:

[quote]Especially as an NPE is impossible on that line. Hm. Running the version which creates 10 crabs per tap, yes? Shows crab count and FPS?
[/quote]
Yep and yep. I crashed by spamming.

Also I noticed that if you phone goes to sleep while its running, it will remove all the crabs but still have the old counter when you wake it back up.

I’ve managed to crash it twice, didn’t get any message as to why it crashed, after the main screen went away my whole phone froze for a few seconds and then I ended up back at the home screen. I’ve got all afternoon to try again :wink:

Endolf

Uh yeah, don’t let it sleep, I haven’t figured out the lifecycle management part yet… for one thing I can’t figure out what to do about the fact that it seems that Android destroys the EGL context whever your app is pushed in the background. That can’t be right, surely. Smithers! More work at the labs.

Cas :slight_smile:

[quote]I’ve managed to crash it twice, didn’t get any message as to why it crashed,
[/quote]
You need to check the Android log file. I personally look it up in Eclipse. But you can get Android app to look at it or I believe there might be a hidden log file where it stores it.

hard to say where the limit is because creating them slows the game down, and also a periodically slow down (garbage collection?), but sometimes it goes back to 62 FPS but then slows down again

I think I’ve removed virtually all the GC in there - I think the only bit of garbage being created is actual Crabs (not very many!) and a couple of String.valueOfs() to show the crab count and fps, every frame. Not much can be done about that. I was hoping GC wouldn’t be noticeable at all on 2.3 (which has an incremental GC), and especially not on 2.3 with dualcores.

Cas :slight_smile:

New version uploaded - this time with transparency, scaling and rotation. I just looked at it on a vanilla HTC Desire and strangely the framerate was only very slightly affected by all those transparent sprites. This leads me to believe that there is something else amiss with the circle rendering that’s punting it into some sort of software emulation.

There are two suspicions:
firstly, I’m using GL_SRC_ALPHA, GL_ONE as the blend equation for the circles (your typical “glowy particle effect”), the sprites use GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, a relatively normal sprite blending mode.

secondly, I’m using slightly odd texture coordinates for the circles, emulating GL_TEXTURE_1D which isn’t available in OpenGLES for some reason.

More experiments…

Cas :slight_smile:

380 seems the limit now, the circles are way more slowing down than the crabs
even when idling with only 200, at 60 fps it drops to 52 every now and then

Waaaaait a minute… n00b error alert! I put the fps counter in the logic thread not the screen update thread - doh. Now my Galaxy is only managing a more realistic 600 crabs at 60fps before it starts to permanently waver.

I’ve tweaked the circles.

New version uploaded!

Any difference for anyone?

Cas :slight_smile:

yellow circles now ?

something seems wrong now, because the game is fluent as hell, but the fps counter says 20, and its 60 by the looks

Well, that’s the strange thing… the logic is running at 60fps but the drawing is occuring at the rate shown - that is, render() is only being called that many times per second. Yet on phones it still looks incredibly smooth, even down to about 20fps. Which I suppose is good news - I think I’m going to cap the game logic and update rate at 30fps in order to cope with Desires and the like which are still very common phones, and it’ll still cope and feel smooth enough down to about 15fps by the looks of things.

Cas :slight_smile:

but its much slower now
100 crabs result in idle 9 FPS