I’m developing a 2D game in java. Our group is normally developing on a Windows and Mac platform. No problems appear during the game and we have a constant frame rate of 60 fps.
Yesterday we ran our game on a Linux computer and the frame rate was only about 10 frames per second!
Does anybody have heard something like this? Having problems on running Java games on Linux? Holding up a good frame rate on Linux?
I don´t know which code lines(at the moment more then 12000) I should show you, so you could understand my problem. But I’ll try to explain a little of our concept so maybe you know a solution or you can give us a hint :)
We build a Content Manager Service, which loads and holds our images which should be drawn on the JFrame. Typically we are using images in a png format.
A very short extract:
//Load our images which are later drawn on the Frame
URL url = this.getClass().getClassLoader().getResource( the right image Path);
this.image = ImageIO.read(url);
//extract of draw
this.graphicsDevice.getGraphics().drawImage(ourImage, x , y , null);
We have about 25 different images at the same time, which are directly drawn on the graphic device of the JFrame.
I don´t have any experience with Linux, that’s why I can´t understand the source of the terrible frame rate. (Remember, on windows and mac pcs it´s constant 62 fps, with the same code :( )
If anybody needs some more information to help, I would try to add some.
Thanks for reading!
Best regards FireDragon
I would ask the user experiencing such problems which version of X, video card drivers and jre he is running and if compositing is on.
I experienced dramatic increase of RAM/CPU usage with the same application after updating to newer version of openjre.
There's no such thing as Linux machine, there are machines with (AMD|nVidia|Intel) video cards running (latest|outdated) (proprietary|free) drivers and (KDE|Gnome|whatever) and (openjre|sunjre), and each combination of software/hardware would show different results.
I would try to test an application on AMD and nVidia machines, with proprietary and free drivers and with openjre and sunjre to have an idea what causes low fps.