4
votes

Greeting everyone! I´m trying to convert from C# XNA 4.0 to Java Android dev in Java. First, I HAVE to say that Microsoft did really great job about game development for their mobile platform. It´s a shame that around twenty people around the world actually own one of Win Mob 7.* phones...
Developing in XNA is really easy to understand and everything is done for you. But I wanted to get my apps to people, not just to friends of Bill or whoever has those few WM phones...

And here came trobles... I can´t even draw ONE! bitmap with satisfying speed. I went through this book:

(www.apress.com/9781430230427) Beginning Android Games by Mario Zechner

So I thought it won´t be that bad - actually drawing. But, ... I tried different styles of drawing...one from the book (presenting Screen class to RenderView), then method from this tutorial http://www.edu4java.com/androidgame/androidgame3.html and then the simpliest http://mikeyhogarth.wordpress.com/2010/10/09/how-to-develop-pong-for-android/ pong with primitives.

I can´t understand, why even drawing primitives and moving 3 primitive objects can be such slow.

I tried to move 1! bitmap (from the edu4java tutorial) and it couldn´t move constantly. Even if I applied the sleep() method for pausing Thread and renedering in 10( or 20(or 30)) FPS, it was still horrible. I tried it in the emulator (much worse than the Microsoft one) as well as real device (Wildfire S)

Ok, ok, Wildfire S isn´t the fastest Android ever, but drawing ONE! bitmap can´t be that hardcore.

And I know I have to have a new Thread for drawing, I have to do it via SurfaceView, to draw to a Canvas, etc.

I couldn´t find anything around the interwebs that would help me. I hope it could be the simpliest answer ever and I would look like a gratest noob in internet history, but I will bear it...

Is there enybody who knows what to do better?

(I am not using OpenGL EP since I am interested only in simple 2D games (yet))

Thank you even for reading.

Erhan

1
You need to supply more specifics to know where you went wrong. Even the slowest of Android phones can draw a bitmap the size of the display at greater than 30 fps. Have you matched the bit depth of your bitmap to that of the display? Are you asking the system to draw it fully opaque? Are you keeping the bitmap data in a bitmap object and not repeatedly reading it from the resources? Give some details and then "we" can answer your question.BitBank
Please post a code snippet so that we can find out what is wrong.Ragunath Jawahar

1 Answers

3
votes

This might help with performance: If you are building on a high API level, you should be able to turn on Hardware Acceleration within your manifest. Its simple to use, and should make things more smoother. The trick though is to enable it when you need it and disable it when nothing intensive is happening. http://android-developers.blogspot.com/2011/03/android-30-hardware-acceleration.html