How to find the bug

Started by
1 comment, last by jbadams 18 years, 8 months ago
There are several bug in my game and difficulty to find it, have some trick to find it? Thanks!
Advertisement
A debugger can very useful. If your app is crashing you can do a backtrace and examine the stack and heap to see where it crashed. If your bug is not segfaulting your app you can try stepping through your program line by line and examining the memory layout as you go. The first step is actually finding the faulty function. Once you know where its located then things should be easier.
For compile errors, use the error messages to try to isolate the problem. They'll normally include a file which contains the error, and an approximate filename (the problem won't always be on the exact line listed). Depending on what IDE you're using, you probably have other debugging tools at your disposal to help solve these kinds of problems.

For things that compile fine but aren't behaving as expected, it can be much trickier to find where you went wrong. Try to reproduce the problem, and figure out what is effected. You then need to think about what could be causing the problem, and look through the relevant sections code. For example, if an object in your game was moving too fast, you would check the functions responsible for moving objects, and make sure everything is as it should be. You would also check the specific object (which may be defined as a class/struct/whatever) in order to make sure there is nothing wrong with it that is causing the problem.


If you're really having problems, you can always ask specifically on the forums and often someone else may be able to help you find the problem. If you decide to do this, make sure you:
- Don't post too many unrelated problems at once if you can.
- Post relevent sections of your code, using code (small sections of code) or source (larger sections of code) as appropriate, which you can read about in the FAQ if you need to.
- Describe the problem as best as you can.

Does that help you out at all?

- Jason Astle-Adams

This topic is closed to new replies.

Advertisement