[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-22 Thread TonyDoc
using logcat to output you fps will reduce your fps. On Jan 22, 6:37 am, Andre andranik.abra...@gmail.com wrote: Hi Jason, Thank you very much for test and code example Best Regards, Andre On 22 янв, 01:19, Jason Arora jaso...@gmail.com wrote: Hi Andre, I got around 60 fps without

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread Andre
Link to my .apk file: http://rapidshare.com/files/338665093/Asteroids.apk.html You can use following command to see output from the app: adb logcat dalvikvm:D Asteroids:D *:S There is a little issue with gc somewhere during the app init, not solved yet..., and after this I have no gc calls

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread skink
On Jan 21, 9:22 am, Andre andranik.abra...@gmail.com wrote: Link to my .apk file: http://rapidshare.com/files/338665093/Asteroids.apk.html You can use following command to see output from the app: adb logcat dalvikvm:D Asteroids:D *:S There is a little issue with gc somewhere during the

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread Andre
Hi skink, thanks for test. On what device you tested? What FPS you got, when not shooting bullets? Yes, I think I should avoid any rotation operation on Canvas... Best Regards, Andre On 21 янв, 12:41, skink psk...@gmail.com wrote: On Jan 21, 9:22 am, Andre andranik.abra...@gmail.com wrote:

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread skink
On Jan 21, 11:54 am, Andre andranik.abra...@gmail.com wrote: Hi skink, thanks for test. On what device you tested? What FPS you got, when not shooting bullets? Yes, I think I should avoid any rotation operation on Canvas... Best Regards, Andre a friend of mine tested your apk on his

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread TonyDoc
Hi all, interesting thread, here's my tuppenceworth. My first attempt at a simple game took the same approach, things looked favourable when I first threw a few dozen sprites onto the canvas along with some simple game logic to try and get a handle on fps and timing. I was getting around 40-45fps

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread Andre
Hi TonyDoc, I agree with you, recently I've started to study Open GL ES... But I think it worth to know, what limitations exist for Canvas? And what kind of games can be implemented with Canvas? As we know, thanks to google, simple 2D games like Snake, Tetris and so on, can be created without

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread Jason Arora
Hi Andre, I got around 60 fps without bullets on my Google Ion device. When touching the screen it would go around 53 and when shooting it would dip just under 40. Before doing my test, I closed all apps with Task Killer. You can remove the status bar by calling the following in your

Re: [android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread Kevin Duffey
Question.. I havent ran your app yet.. going to on my moto droid. Do you show the fps, or do I need to run it attached via USB in debug mode to see this info? On Thu, Jan 21, 2010 at 2:19 PM, Jason Arora jaso...@gmail.com wrote: Hi Andre, I got around 60 fps without bullets on my Google Ion

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread Jason Arora
Kevin, you have to use logcat while its connected via USB (debug mode): adb logcat dalvikvm:D Asteroids:D *:S On Jan 21, 2:32 pm, Kevin Duffey andjar...@gmail.com wrote: Question.. I havent ran your app yet.. going to on my moto droid. Do you show the fps, or do I need to run it attached via

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread Andre
Hi Jason, Thank you very much for test and code example Best Regards, Andre On 22 янв, 01:19, Jason Arora jaso...@gmail.com wrote: Hi Andre, I got around 60 fps without bullets on my Google Ion device. When touching the screen it would go around 53 and when shooting it would dip just under

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-20 Thread Andre
Hi, thanks for reply Yes, I can share my .apk, if you tell, how to upload something here? I agree, that emulator should be much slower than real device, but let me quote a snippet from the document Designing for Performance at http://developer.android.com/guide/practices/design/performance.html:

Re: [android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-20 Thread Kevin Duffey
After I wrote you, I realized that issue too. I remember reading that and after I responded.. wondering if my response was inaccurate. I wonder how much the speed/cores of your cpu play into the emulator performance? I know that my small test apps run faster on my moto droid than they do my

Re: [android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-20 Thread Dan Sherman
I'm not running any sort of beastly machine, quad-core 2.8ghz, with an nvidia 9800gtx, and almost all the time, emulator performance is lower than physical device (especially with openGL, but even with canvas). Might have something to do with the emulator specifically on linux, so your results

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-20 Thread Robert Green
I'm running a Core 2 Duo T9500 (2.5Ghz, 6MB cache, etc) w/8GB RAM on Win7 x64 and G1 still runs a little faster than Canvas and a lot faster on OpenGL. It's not going to be a direct comparison because the emulator is emulating ARM so there's a huge loss in speed there from the emulation. You

Re: [android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-20 Thread Frank Weiss
I wouldn't expect a emulated code to run faster than on the target hardware. Perhaps you are assuming that the emulated code is using the graphics directly. Question is, does it? On Jan 20, 2010 9:42 AM, Dan Sherman impact...@gmail.com wrote: I'm not running any sort of beastly machine,

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-20 Thread Zsolt Vasvari
I was previously involved with game emulator development. No way that the speed of the emulator for a 500+ Mhz processor will be faster on a 2GHz computer than the real device. It doesn't matter if it's dual-core or not -- processor emulation is pretty much single threaded. On Jan 21, 2:15 am,

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-20 Thread Jason Arora
Hi Andre, Everyone here has brought up great points: 1) Matrix manipulation is slow. Instead, rotate and store bitmaps ahead of time (note: initial loading time will be longer). 2) Don't use getter/setters, instead make commonly used attributes public. 3) Don't call System.currentTimeMillis() or

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-20 Thread Zsolt Vasvari
if you must, use width 1. You gotta be kidding here -- are you saying that the Android compiler won't do this for you automatically? Even compilers 20 years ago could so such basic optimizations. -- You received this message because you are subscribed to the Google Groups Android

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-20 Thread Andre
Hi to all, Thanks a lot for many helpfull posts! Agreed, I think that the main purpose of the emulator is emulate not emulate as fast as possible. My dev machine is much slower than yours (I have old laptop with Athlon 2.4 Ghz, 768MB RAM and Ubuntu 9.04 Janty). Now, with your help, I got ~25 FPS

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-19 Thread Andre
Hello, thank you all for many helpful posts. I tried to replace all getters and setters with member variables and asteroids[i], bullets[i]... with corresponding asteroid, bullet... variables. Though this is very important issue, as I supposed, this doesn't improve FPS in my case. I agree, that

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-19 Thread Andre
Hello Robert. I want to thank you for sharing your experience with beginners, your dev journal is extremely helpful! I will change my code to work with Matrix as you suggest and post the result here... If I correctly understood your question about surface opacity - Yes my surface is opaque, I

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-19 Thread skink
On Jan 19, 9:41 am, Andre andranik.abra...@gmail.com wrote: Hello Robert. I want to thank you for sharing your experience with beginners, your dev journal is extremely helpful! I will change my code to work with Matrix as you suggest and post the result here... If I correctly understood

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-19 Thread skink
On Jan 19, 10:33 am, skink psk...@gmail.com wrote: On Jan 19, 9:41 am, Andre andranik.abra...@gmail.com wrote: Hello Robert. I want to thank you for sharing your experience with beginners, your dev journal is extremely helpful! I will change my code to work with Matrix as you suggest

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-19 Thread Andre
That's OK, I've already tried use RGB_565 and other bitmap configs, this makes sence if you using background image (wich should be RGB_565 for faster draw). On 19 янв, 12:37, skink psk...@gmail.com wrote: On Jan 19, 10:33 am, skink psk...@gmail.com wrote: On Jan 19, 9:41 am, Andre

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-19 Thread skink
On Jan 19, 10:57 am, Andre andranik.abra...@gmail.com wrote: That's OK, I've already tried use RGB_565 and other bitmap configs, this makes sence if you using background image (wich should be RGB_565 for faster draw). and you are sure that your bitmaps (asteroids, bullets, space ship) are

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-19 Thread Andre
Currently I use: Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.spaceship); in that case: bitmap.getConfig() == null; as I mention earlier, I checked all kinds of bitmap configs with little difference in performance On 19 янв, 14:01, skink psk...@gmail.com wrote: On

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-19 Thread skink
On Jan 19, 1:56 pm, Andre andranik.abra...@gmail.com wrote: Currently I use: Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.spaceship); in that case: bitmap.getConfig() == null; hmmm, null is a bit weird. it means that bitmaps config is not any known public

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-19 Thread Andre
Hi, Yesterday, I've changed my code, to work with the matrix more effectively... My GameEntity class now looks like this: --GAME ENTITY-- public class GameEntity { public Bitmap mBitmap; private Rect mBounds; private Matrix mMatrix; public int

Re: [android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-19 Thread Dan Sherman
I run my app on emulator, and currently have not tested it on real device. The emulator is not, in any way, going to run the same speed as a real device. Run it on a real device and see what FPS you get. Or if you want, publish an APK and someone here will run it I'm sure (I'll do it =P) -

Re: [android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-19 Thread Kevin Duffey
Was just watching the video from back in May by Chris Pruett. He had a performance slide comparing canvas to opengl and as he noted there, canvas is much slower. I am sure you know this, but getting 30fps on a Canvas with more than a dozen or so sprites might be difficult when you factor in game

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread Marc Reichelt
Hi Andre, you should definitely read the Designing for Performance document from: http://developer.android.com/guide/practices/design/performance.html I think you might speed up your onDraw() method a little bit this way, though I think you might not reach more than 30 or 35 FPS. At first you

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread skink
On Jan 18, 10:16 am, Andre andranik.abra...@gmail.com wrote: From this output I can assume, that my main problem here is draw game stuff wich includes:   - draw 1 spaceship   - draw 5 asteroids   - draw from 1 to 30 bullets in drawAsteroids() i would assign GameEntity asteroid =

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread Andre
Hello Marc, thanks for quick reply. I have read this document very carefully, though this is not my production code, I try to use some principles described there (local variables instead of class fields). Especially in those methods where I have loop: drawAsteroids, drawBullets, updateAsteroids,

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread Andre
Hello skink, thanks for advice I agree, my array manipulations is not quite well. And I think you right about getters too...(this is one of the key principles in designing for performance document), I don't yet replace them with members, just becouse my updatePhysics is take ~1ms to execute...

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread skink
On Jan 18, 1:01 pm, Andre andranik.abra...@gmail.com wrote: Hello skink, thanks for advice I agree, my array manipulations is not quite well. And I think you right about getters too...(this is one of the key principles in designing for performance document), I don't yet replace them with

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread Andre
Yes, now I can do following: private void drawAsteroids(Canvas canvas) { GameEntity[] asteroids = mAsteroids; GameEntity asteroid; for(int i = 0; i MAX_ASTEROIDS; i++) { asteroid = asteroids[i]; if(asteroid.isAlive()) { canvas.setMatrix(null);

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread skink
On Jan 18, 2:03 pm, Andre andranik.abra...@gmail.com wrote: Yes, now I can do following: private void drawAsteroids(Canvas canvas) {     GameEntity[] asteroids = mAsteroids;     GameEntity asteroid;     for(int i = 0; i MAX_ASTEROIDS; i++) {         asteroid = asteroids[i];        

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread Andre
Let me clarify... Lets look at two methods: - updateAsteroidsPhysics() - drawAsteroids(Canvas canvas) They both use getters instead of members, and asteroids[i] instead of asteroid variable, the only difference between them, that drawAsteroids (Canvas canvas) is also use canvas calls, and I

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread skink
On Jan 18, 2:49 pm, Andre andranik.abra...@gmail.com wrote: Let me clarify... Lets look at two methods:   - updateAsteroidsPhysics()   - drawAsteroids(Canvas canvas) They both use getters instead of members, and asteroids[i] instead of asteroid variable, the only difference between them,

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread Robert Green
The little stuff definitely adds up and helps but when talking about such a small number of objects, I don't think it will double his FPS to fix. First of all, thanks Andre for actually posting your code so that we have some context to work with and I'm also glad to hear that you've read my dev

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread guiha...@gmail.com
Hi, 1. Get rid of all get/set methods. 2. Eliminate some of the System.currentTimeMillis (two consecutive calls leads to the same number) 3. Save a reference to the current object inside the array instead of accessing an array lots of times (e.g.: asteroids[i]) 4. Most important: don't call

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread skink
On Jan 18, 7:19 pm, Robert Green rbgrn@gmail.com wrote: The little stuff definitely adds up and helps but when talking about such a small number of objects, I don't think it will double his FPS to fix. agreed. i haven't noticed that number of objects is that small... pskink -- You

Re: [android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-18 Thread Kevin Duffey
Another thought.. you have the asteroid[i] array.. and then you do the if (asterod.isAlive()) method. First.. eliminate the method call as you've been told. But for this particular example.. why are you keeping an array of objects that may not be displayed? By this I mean.. if you have 30