Hi Miguel,

Thanks for the suggestions.

Egg Savior relies a lot on scroll, so updating just the modified part
of the screen would only help on some situations. I have a HUD on top
of the scroll, which voids the typical scroll optimizations also.

First of all, I would suggest using traceview to identify the
bottleneck. Are you sure that it is in the rendering phase?

In OpenGL, having a lot of individual textures hurts performance a
lot, because you have to issue a lot of state changes. Try to avoid
state changes as much as possible. Most engines, sort objects by state
before drawing, to increase state reuse. In your case, I would go with
a texture atlas with every asset on it, and use texture coordinates
for indexing each individual image before rendering.

By the way, another optimization that I have already implemented is to
bake all the static objects in a single image. For example, all the
platforms are baked into the background at game start, avoiding a lot
of drawBitmap calls. Then, I just have a bunch of rectangles for
collision detection with platforms. I understand that in your case
this is a bit more difficult because the character can walk behind
static objects, but at least you could bake one-cell objects or even
bake everything and just redraw one object again when the character
walks behind it. What do you think?

I have seen your map editor in HTML/JS, it is pretty awesome. I
thought something similar for Egg Savior, but ended with plain old
ASCII text for the maps :)

Regards.

On 24 nov, 00:01, Miguel Morales <[email protected]> wrote:
> Thanks for the response, you are actually getting a better framerate
> than I am and I'm using OpenGL.
> However, my approach is pretty simple.  I load a bunch of png images
> and just draw them (some sprites may be drawn twice) there is a lot of
> room for improvement.
>
> However, my game is 2D with simple tile animations, the scene is only
> updated when a character moves.
> This is why I use 'RENDER_DIRTY' with OpenGL which means it doesn't
> render the scene as fast as possible but only when the scene has
> changed.
> This made my app reduce about 50% CPU usage which means better batter
> life.  Just something to put out there, framerate is not necessarily
> the ultimate goal when making a game for Android.
>
> Even with some movement the framerate only goes up to 7FPS or so and
> it looks the same as if I had it rendering as fast as possible (which
> I get like 20 - 30FPS.)
>
> Handling input is a pain, I remember watching a talk on Replica Island
> where the author mentions implementing an input queue.
> I hadn't done this until I started having some issues with sleeping in
> the onTouch() method and receiving callbacks from my service (which
> runs in the same thread as the UI thread.)
>
> I'm just pretty much using queues now for both the network calls and
> the onTouch calls to keep everything in order in the UI/render thread.
>
>
>
>
>
> On Tue, Nov 23, 2010 at 3:48 AM, Ruben <[email protected]> wrote:
> > Hi Miguel,
>
> > I'm getting solid 60 fps on my Samsung Galaxy Spica (800 mhz
> > processor) for most levels. I have heard that does not work so well in
> > the HTC Magic...
> > CPU load is quite balanced between updating the scene and rendering
> > it, thus I could improve performance by optimizing the update phase
> > (collision detection is a good candidate) without changing the canvas
> > approach. I am an OpenGL lover, but unfortunatelly my phone has poor
> > support for it :(
>
> > The biggest problem was the handling of input events. It hurts
> > performance a lot by default. My solution is to save every motion
> > event data in the same variable, and processing the most recent one in
> > the main render loop/thread. This, incidentally, avoids some thread
> > synchronization problems.
>
> > On 23 nov, 09:13, Miguel Morales <[email protected]> wrote:
> >> Nice, I enjoyed the part of content creation.  I'm going to keep your
> >> suggestion of using a single bitmap with all the sprites instead of
> >> individual images.
> >> Although it's not terrible it does indeed have a performance impact.
>
> >> Are you getting good performance using this approach with canvas alone?
> >> In either case, good job.
>
> >> On Sun, Nov 21, 2010 at 2:51 PM, Ruben <[email protected]> wrote:
> >> > I have just written an in-depth article covering the workflow of 2D
> >> > game creation for Android with blender, based in my own experience
> >> > with the game "Egg Savior". I hope you find it usefull.
> >> > Feel free to share your knowledge and propose other alternatives to
> >> > these ideas.
>
> >> >http://organicandroid.blogspot.com/2010/11/creating-2d-games-with-and...
>
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups "Android Developers" group.
> >> > To post to this group, send email to [email protected]
> >> > To unsubscribe from this group, send email to
> >> > [email protected]
> >> > For more options, visit this group at
> >> >http://groups.google.com/group/android-developers?hl=en
>
> >> --
> >> ~ Jeremiah:9:23-24
> >> Android 2D 
> >> MMORPG:http://developingthedream.blogspot.com/,http://www.youtube.com/user/r...
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> ~ Jeremiah:9:23-24
> Android 2D 
> MMORPG:http://developingthedream.blogspot.com/,http://www.youtube.com/user/revoltingx

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to