Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Libgdx + Box2d = ~8 fps on android?  (Read 995 times)
0 Members and 1 Guest are viewing this topic.
Offline Nesopharus

Senior Newbie





« Posted 2013-09-03 13:11:39 »

Heyho folks ^^

I was wondering about my performance on an android.
Just to test i made a very simple "Game" where i just make a world (box2d) + renderer and cam.
I have added 1 Body with this code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
BodyDef circleDef = new BodyDef();
      circleDef.type = BodyType.DynamicBody;
      circleDef.position.set(80, 120);
     
      Body circleBody = world.createBody(circleDef);
     
      CircleShape cs = new CircleShape();
      cs.setRadius(1);
     
      FixtureDef fd = new FixtureDef();
      fd.shape = cs;
      fd.density = 1;
      fd.friction = 0.2f;
      fd.restitution = 0.8f;
     
      circleBody.createFixture(fd);
      return circleBody;


here is my rendering method :

1  
2  
3  
4  
5  
public void update(float delta)
   {
      renderer.render(world, cam.combined);
      world.step(1/60f, 6, 2);
   }




now on my comp i have got like 60 fps   thats okay  but after launching on android it drops to ~8 fps o.O and this is not suitable for me =(

its the first time im working with android and my second time working with libgdx.

My question is:
can i somehow get this running on android or should i just forget it?   (btw. i cant connect a real android atm so i use the AVD for Nexus One  made out of the given Device Definitions)

Hi! Cheesy
Offline EgonOlsen
« Reply #1 - Posted 2013-09-03 15:23:59 »

The emulator is crap, even if you enable hardware support for the graphics. Real world performance is usually much better. If you have an APK of your app, just upload it and i can give it a try on some real devices if that helps.

Offline Nesopharus

Senior Newbie





« Reply #2 - Posted 2013-09-03 21:58:23 »

hey  thanks =) then ill test it out on desktop version until i got a phone Tongue

Hi! Cheesy
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline netikan

Senior Newbie


Medals: 1


Zombies!


« Reply #3 - Posted 2013-09-03 22:20:33 »

I can completely agree with the above comment about the emulator performance.
I'm honestly surprised you managed to get around 8FPS out of it!

My Advice
Buy a cheap Chinese Android tablet/phone from Amazon. I'd highly recommend that, because then you get used to developing on lower-end hardware. So you can focus more on optimizing your code.

Why a cheap one?
I got so used to coding on quad core phones and tablets, that my players where complaining about performance on their lower end devices. So I had to completely re-think my development cycle; and do what I said above.

Check out my project Land of Zom - Multiplatform Zombie MMO/RPG!
Soon to be at Eurogamer 2013.
Offline namrog84

JGO Ninja


Medals: 46
Projects: 4


Keep programming!


« Reply #4 - Posted 2013-09-04 00:41:01 »

If you share your APK, I can test it for you, to make sure its just the emulator issue. If you want, that is



Though this is more of a 1 time test, to see if thats in.  Not really a long term development solution

"Experience is what you get when you did not get what you wanted"
Offline matheus23

JGO Kernel


Medals: 113
Projects: 3


You think about my Avatar right now!


« Reply #5 - Posted 2013-09-05 11:08:18 »

Just a side-note: The Box2DRenderer is also much slower than rendering sprites as Bodies.

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Nesopharus

Senior Newbie





« Reply #6 - Posted 2013-09-06 06:24:01 »

thanks for the advices ^^  at the moment it is not necessary to check the code    it was just a test if i could work with box2d
but atm i am working on my first game maybe ill get it to WIP soon ^^

Hi! Cheesy
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (63 views)
2014-11-26 15:22:04

toopeicgaming1999 (56 views)
2014-11-26 15:20:36

toopeicgaming1999 (10 views)
2014-11-26 15:20:08

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (27 views)
2014-11-25 11:26:43

Gibbo3771 (24 views)
2014-11-24 19:59:16

trollwarrior1 (37 views)
2014-11-22 12:13:56

xFryIx (76 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!