Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (794)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
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 rendering performance  (Read 13694 times)
0 Members and 1 Guest are viewing this topic.
Offline jobiho

Senior Newbie

« Posted 2013-06-27 18:12:01 »

Hi there,

I am currently developing a game where I need to render a lot of dynamic small tiles.
One tile is 6x6px targeting a resolution of 1024x768 resulting in a tile-count of 170x128=21760 tiles.

On the desktop I get a decent framerate of 400fps whereas on my test device (acer a500 tegra2) I only get about 20fps :/.

Keeping in mind that the gamelogic, ki, etc. is excluded in this test, I would be happy with a framerate of about 50fps on the tablet.

I am only! rendering tiles that are visible and there are no unnecessary texture binds involved.

Here is the code that is called for each tile:
   public void renderTile(short tileId, int screenX, int screenY) {
      batch.draw(tileTexture, screenX - tileMap.getTileSize(), screenHeight - screenY - tileMap.getTileSize());

Is there any chance to improve this?

Thanks in advance Smiley
Offline jobiho

Senior Newbie

« Reply #1 - Posted 2013-06-27 18:39:01 »

Of course all (all tiles) batch.draw() calls are called between batch.begin() / batch.end().
Offline Cero
« Reply #2 - Posted 2013-06-27 18:53:25 »

Check out this thread:
Rendering many tiles requires some optimization

Btw: 6x6 tiles ? why so small D=
never seen anything under 16x16

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

Senior Newbie

« Reply #3 - Posted 2013-06-27 19:01:39 »

Hm thank you for the link but I guess caching is no solution to my problem.

The tiles (and that's why I choosed 6x6 for them) are part of a dynamic sandgame style map.
That means each tile could interact with each other tile at any given moment.
Offline davedes
« Reply #4 - Posted 2013-06-28 14:03:42 »

Maybe you would benefit from building your own batcher.

But it sounds more like you need a highly optimized particle system. Or something like this, with some tweaking to work on OpenGL ES:

21,760 tiles is a lot. To break it down; that's 43,520 triangles, or 130,560 vertices. If each vertex has position, (packed) color, and texcoords, then you are sending 5 floats per vertices, or 652,800 floats to the GPU per frame. Maybe there are some ways you could reduce this. For example; perhaps you could make some of the data static on the GPU.

Also ensure that your problem isn't coming from setColor or some other part of your code. Do some basic profiling to see what's up.

Pages: [1]
  ignore  |  Print  

hadezbladez (3118 views)
2018-11-16 13:46:03

hadezbladez (1130 views)
2018-11-16 13:41:33

hadezbladez (3082 views)
2018-11-16 13:35:35

hadezbladez (616 views)
2018-11-16 13:32:03

EgonOlsen (3905 views)
2018-06-10 19:43:48

EgonOlsen (4374 views)
2018-06-10 19:43:44

EgonOlsen (2610 views)
2018-06-10 19:43:20

DesertCoockie (3428 views)
2018-05-13 18:23:11

nelsongames (3549 views)
2018-04-24 18:15:36

nelsongames (4599 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 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‑
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!