First of all, you should profile your game - take a look at
android.os.Debug.start/stopMethodTracing and identify the
bottleneck(s).
Then, if you've never written a game, chances are your game loop will
suck (that is, if you *had* a game loop, you're merely invalidating
and redrawing the screen) - take a look at LunarLander's source code,
also Alien Bloodbath, etc. - there are lots of resources on the net on
the topic of writing a game loop - google for "Fix your time step" to
find a very good one.

HTH,
Stoyan

On Sun, Jan 25, 2009 at 8:49 AM, Beshoy <odsl...@gmail.com> wrote:
>
> Hello all,
>
> I haven't written in Java for about 5 years... but I've re
> familiarized myself with java, and was able to write a game.  The game
> is 4Ever Fall.  You can find it on the android market, it's free.  I
> am having problems with the game because it lags too much; especially
> when there are background processes trying to work.  The game's
> simple:
>
> I have platforms rising, a background who's also rising, and a ball
> who's falling and gets stopped by the platforms.  I am using
> SensorListener to get the current accelerometer readings to control
> where the ball goes.  From there, in my "onDraw" function, I move the
> platforms, background, and ball.  This seems to be an overload since
> I've got 10 platforms (5 levels with 2 Drawables per level to account
> for the gap in between), 2 background Drawables for smooth
> transitions, and the ball's Drawable.  That makes 13 objects being
> maintained and moved by onDraw.  This seems to really bog down the
> phone when things are running in the background.
>
> I'm trying to figure out how to make the game run better.  I've looked
> at openGL and wow... that gets complex really quick and I'm not even
> sure where to start.  I've also looked into threading but I don't
> really know too much about it.  I use threads sparingly when I need to
> do a ProgressBar while submitting a score or something of that sort.
> If you have any ideas on how to make the game's rendering better, I
> would greatly appreciate it.
>
> I don't quite understand how openGL works, and whether or not I can
> use it to handle the platforms, move them, etc.  I would like to use
> images rather than drawing them, but if I have to draw them that's
> fine too.... Anything to make this game run better... PLEASE HELP!
> Thanks in advance for any help you can give! :)
> >
>

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

Reply via email to