Hello everyone!
This my first java-related post in here. I have read a variety of other topics in hope to find some clues that help me solve my problems. But I couldn’t find a solution to this one, so maybe you can help me out this time.
A short version of the problem:
I am using LWJGL and slick-utils to program a 2D top down shooter. I have a spaceship, 4 enemy-spaceships for testing, a scrolling background made of tiles and a status screen with user interface. The main problem is that with the tiled background the performance is really breaking down. I am still testing, so the background isn’t moving and I am drawing far too much of it. It consists of 500 tiles that come from a texture that i cut into regions so that I won’t have to bind a texture that often. Of course these are the main work of the loop. If I stop drawing anything, then the avarage cycle takes 0.3 millisec. If I draw them, the cycle goes to 5 millisec. A tile is 24x28 pixels in size. The application runs in windowed mode and the resolution is at 720 x 680. Oddly…
I don’t really have any idea what makes the rendering of the tileMap so time consuming. I am currently using VBOs for rendering, before that I used vertex arrays. I have around 60fps with my Core i3 M330 and AMD Radeon HD 5650M.
I might have forgotten something important. I will paste some of my code in here. First the game loop:
http://pastebin.java-gaming.org/6bfe88b2032
And here is the code for the tiles:
http://pastebin.java-gaming.org/bfe8b902231
I would be glad if someone had any idea what could be the problem. Are 500 textureRegions really that much? Am I doing something wrong.
Thank you for your help in advance! If something is missing or if you need more information, tell me please.