Hi,
I’m developing a platform game using java 2d. I’m working mainly on windows, but also testing on linux.
Speed is not an issue on windows, since java can use my graphics card - but linux seemed to be a lot slower.
I’m doing rendering on a seperate thread (a while loop in the run() method), and using thread.sleep(x) to control the speed.
I was getting about 33fps on linux with scrolling and a few sprites moving around. I was sleeping for about 12ms per frame. Then I set the sleep to 0 and I started getting 200fps!! But if I set the sleep to 1 I only get about 50fps.
I assume this is to do with how threading is handled on Linux - is there a better way to control the speed in my game?