Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question

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, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
This is impossible for anyone to answer with the information you've provided, the size of the class is irrelevant. What matters is the code being called. Have you read the FAQ yet? I've asked multiple times. –  Byte56 Oct 6 '12 at 7:23
1  
Good work on your accept rate. –  Zehelvion Oct 6 '12 at 7:26

1 Answer 1

up vote 2 down vote accepted

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.

http://en.wikipedia.org/wiki/Code_refactoring

share|improve this answer
    
How do I fasten it up? –  SystemNetworks Oct 6 '12 at 7:39
2  
@SystemNetworks Remove the bottlenecks. There is no single answer for that. –  Jonathan Hobbs Oct 6 '12 at 7:41
    
There is no 'magic answer' that will make code run faster. You simply identify the parts of the code that consumes the most processing time and think of ways to improve those parts for better efficiency. –  Zehelvion Oct 6 '12 at 7:47
    
@ArthurWulfWhite If you insist on answering questions that are off topic, you should at least make them community wiki. Answering questions that are off topic encourages users like SystemNetworks to continue to ask questions that are off topic, since they know they'll get an answer anyway. –  Byte56 Oct 6 '12 at 14:59
1  
@ArthurWulfWhite When you make your answer, check the community wiki check box in the bottom right. If we didn't ignore the off topic questions, people could ask whatever they wanted and get an answer. Just my thoughts. –  Byte56 Oct 6 '12 at 15:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.