My framerate lastime exceeds 1000 now the highest is 15. I have thousands lines of code in one class(I was still fresh last time and did not think of putting it in another class) Is it the class that makes the game slower?
|
closed as not a real question by Byte56, bummzack, Nicol Bolas, Jonathan Hobbs, David Gouveia Oct 6 '12 at 8:25
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.
|
How to identify the issue: To find out what is slowing down your game (also known as bottleneck), you could use Profiling. http://en.wikipedia.org/wiki/Profiling_%28computer_programming%29 It is not classes that slow down frame rate, it is the amount of processing time it takes to complete the instructions in the code (for instance instructions that reside inside functions). Using Profiling could help you check how much time is spent running each function and how many times each function is being ran. Here are some suggestions on how to use Profiling with Java: http://stackoverflow.com/questions/2422289/any-recommended-java-profiling-tutorial Then you would know for sure what is slowing the code down. How to improve speed: After you find the part of the code that is causing the slowdown, consider how to refactor the code. You may need to consult others or you might find out that you could use the resources in a new efficient way for the same result. |
|||||||||||||||
|