16
Support / Frame rate issue
« on: March 03, 2011, 12:31:17 am »
Hi,
Im currently working on a simple game to try to get familiar with jpct-ae but Im having a problem with my frame rate.
It generally runs at about 55-60 frames a second but every now and then it drops to 35-40 and I can see in the logs that its being caused by java doing a garbage collection (which seems to be forced upon me). 35-40 frames a second would be sufficient for the whole game but when it goes up and down randomly it feels very glitchy - the user would definitely see the slowdown for the moments when it drops.
So does anybody know of any way to make this smoother? Perhaps a way to limit the number of frames per second to 40? Or is there a better way to control speed? At the moment the games speed is based entirely on frame rate but it would be better if i cant limit the frame rate to have those frames skipped and ensure that all objects are where they should be based on the real speed. Im not sure if im explaining this well enough but any help would be appreciated.
Many thanks.
Im currently working on a simple game to try to get familiar with jpct-ae but Im having a problem with my frame rate.
It generally runs at about 55-60 frames a second but every now and then it drops to 35-40 and I can see in the logs that its being caused by java doing a garbage collection (which seems to be forced upon me). 35-40 frames a second would be sufficient for the whole game but when it goes up and down randomly it feels very glitchy - the user would definitely see the slowdown for the moments when it drops.
So does anybody know of any way to make this smoother? Perhaps a way to limit the number of frames per second to 40? Or is there a better way to control speed? At the moment the games speed is based entirely on frame rate but it would be better if i cant limit the frame rate to have those frames skipped and ensure that all objects are where they should be based on the real speed. Im not sure if im explaining this well enough but any help would be appreciated.
Many thanks.