theInsomniacGameMaker

View Original

"Friendly" Ducky

I was in my Engine Development class where we obviously learn to make an engine from scratch. We learnt different things like Frustum Culling, Camera Algorithms, Particle System etc. The lab for this class was to making Bounding Volume Hierarchy to reduce the number of collision checks and resolutions. This was one of the hardest labs. I was still working on my lab and ither friends of mine had finished this lab and got the BVH to work. I was still struggling with it.

Looking at the code I had done everything right. There was no problem with the logic or anything like that. But it wouldn’t work. I tried to look for the error and couldn’t find it. I looked online for a solution, I couldn’t find it. I was stuck and was just going over the same thing again and again trying to figure out what the problem was. I gave up and called my friend to ask to for help. He asked me to go over the code I had written.

I started to explain the code going over it step by step. Then I as I was explaining the code I said, “If the distance is greater I add I to the tree.” It struck me, the check shouldn’t be for a greater value but it should be for a lesser value. We both paused and figured out the mistake. Obviously as soon I completed the simple task of switching the sign in the if statement the code worked.

One of the greatest tools in a developer’s tool box is the Rubber Ducky. It is a method for debugging. The programmer explains his code and goes through it with a rubber ducky in front of him and while explain the code, the developer might find the error. After this episode I know the Rubber Ducky method is an effective weapon in my arsenal.