5 useful debugging and troubleshooting tips for game developers

When you’re developing a game, there can be a lot of triumphs and a lot of frustrating moments where you have no idea why something isn’t working. Spending a lot of time debugging or troubleshooting can get exhausting, but it’s a mandatory part of the job sometimes.

If you’re finding yourself wondering if there are easier ways to debug or troubleshoot the games you’re developing, you’re not alone. There are a lot of devs that want a few pointers on ways to make things easier when they’re trying to figure out why something isn’t working quite right.

Luckily, there are a lot of tips online to help you out. The problem is not every tip online is as useful as you’d hope. You’re most likely too busy to wade through thousands of tips to figure out which ones will actually make your life easier. With that in mind, you’ll find a list here that is based on narrowed down, focused tips that are proven to work.

If you’re hoping to spend only a few minutes researching and then get back to working on your game, you’re in luck. Here are five useful tips for debugging and troubleshooting when you’re developing a game.

1. Use a CICD pipeline

CICD (continuous integration, continuous delivery) pipelines are built to save you a lot of headaches by nature. With a CICD pipeline you can automate many of the steps involved in testing out new, updated, or changed parts of your code. Automating a lot of the steps involved in testing things removes the chance for human error to be the cause of a debugging hiccup.

With the CI part of your CICD pipeline, a change in code triggers an automated test sequence that will deliver feedback to you. Sometimes that feedback can be given in as little as ten minutes or less. The feedback can be sent to you or your entire team if you’re all working together on the same game.

If you’re working with a team of developers, CICD pipelines are even more helpful because, even if you’re not the one changing something, the CICD pipeline is still working. It’s testing every change everyone makes and giving feedback to everyone at the same time. CICD pipelines can keep everyone on the same page which can really save you a lot of time and effort.

You can set up your CICD pipeline to continuously deploy your changes, once they prove to be well functioning code. This means you’re doing exactly as the name suggests. You’re continuously testing and then delivering fixed code.

Since this is all automated and you can customize a lot of what your CICD pipeline will do, this is one thing definitely worth considering. It will make a world of difference.

2. Focus on version control

Version control for debugging or troubleshooting is somewhat akin to using the “track changes” feature in a word processor. When you track changes on a word document you’re likely doing, so because several people are working together and everyone wants to know what’s been updated. Think of version control much in the same manner.

You can use programs like GIT or Mercurial to track changes that are made in each version of your game’s code. Even if you’re developing the game on your own this is still going to be a pretty useful thing to do. Watching what’s changed in each version can help you isolate where the code needs to be fixed or what version of your code is causing the most problems.

If you know you’re going to be editing a lot of your code, or your working as a team and everyone is editing different things, tracking those versions is going to be a lifesaver.

For more on version control, this page on the Git website, is an excellent overview.

3. Talk to a teddy bear

Okay so if you haven’t heard of this method of troubleshooting or debugging then you’re probably really confused right now. Don’t worry, this is a legitimate thing you can do to help when you’re really not sure what’s causing your bug. Sometimes called ‘rubber duck debugging‘, the origins of “The Teddy Bear Method” seem to be a little folklore-like but the end result is actually useful.

The general idea is that you would talk to a teddy bear (or rubber duck, or couch, or even a real-life person who doesn’t understand coding) and explain in basic, very simple terms what your code is and what your bug is. The reason this is effective is that as you’re explaining things out loud in a simplified manner you can often see the solution more easily.

Sometimes the best way to solve a bug issue is to step away from your screen, and that’s the point of this tip. It’s a very common thing developers will do, but you might want to make sure you’re alone before you start talking to a teddy bear or rubber duck. Explaining the reason you’re telling a bear about your code might not be so easy.

4. Use a dedicated debugging tool

You might currently be relying on using print statements throughout your code, but dedicated debugging tools can help even more. While you’re fine to just keep using print statements if you wish, a dedicated tool can give you more information in a more useful way. Debugging tools can isolate lines of code and tell you what the predicted behavior versus the actual behavior is.

Since a lot of errors may simply be due to entering a few pieces of unintended data or ineffective exception handling, a debugger can be very useful. You don’t have to stop using print statements and rely solely on a debugger, just think of it as another tool in your arsenal as you’re developing your game.

5. Stop making assumptions

When you’re debugging your game’s code, don’t become too short-sighted. Make sure you’re looking at the program as a whole, as well as the small part that’s causing you a headache. When you change something, take a few extra minutes to make sure that change hasn’t affected your entire game (another area where CICD pipelines can be helpful.)

If someone comes to you with a bug they’ve found, make sure it’s something you can reproduce before jumping in to fix something. Don’t assume the bug is a true issue until it can be reproduced while you’re there watching. If you can’t reproduce the bug, see if someone else can. Double checking things like this before you make actual changes can save you a lot of time.

Debugging and troubleshooting the game you’re developing can be a little taxing at times. Even if you know the end product will be worth the trouble, it’s still not always smooth sailing. Keep in mind what you’ve read here and implement these tips in ways that make sense for you.

Spending a little extra time trying these tips out early on in the process could save you a lot of frustration as you continue to work on your game. After you’ve made a few tips work for you, enjoy the effort you’ve put in and get back to work. Your game is just waiting to be the amazing finished product you’ve imagined delivering to your end users. You’ve got this.

2019-06-13T10:44:11+01:00June 13th, 2019|Game dev tips|