XNA Game Development – Part 5

Tiny tweaks, massive impact

During our last development evening, I needed to look over the code that was done in the wonderful world of JavaScript (enough said).  My friend had made a small tweak to his code and he was unable to determine what was causing this funny behaviour on screen.

He would begin the debugging and his ship would start, centre of the screen and then slowly move to the left and down, and then it would only stop at the bottom left, only because of the restriction it has within the screen boundaries.

This problem was stumping me and certainly him as we couldn’t determine the location it was all happening in.  So with little to know work done on my project we finally got it working.  What was it.  2 lines of code that would move the ship, it was being called regardless if a key was being pushed on the keyboard to move the ship.

Dare say the tiny tweak he made to the code make a huge problem.  I can also say it might have taken him longer to solve this problem than both of us stepping through this.  What is the purpose of me posting this information.

Well there are a couple of reasons

  • Is sometimes when you are in the process of developing your project you will add and remove code all over the place.  Sometimes on purpose other times it happened to get caught up in the frenzy of selection. 

NEVER delete the code.  Always comment it out, this way you can always see what code was there before.  This would have helped a lot had the code was commented out as I could have seen it and determined it quickly.  In Visual Studio, Select the block and Press CTRL + K + C.  This will comment out a single line or a block of code.  CTRL + K + U will also uncomment it.  Or use the toolbar icons.


  • There is also no doubt that a lot of time was spent on this.  I am also very much afraid to ask how much time was spent pre my involvement.  Thankfully this is not paid work and cost us other than time.  But in reality this could have cost money.  And if you look at the amount of time, 2 people at 2.5 hours, at we will take an arbitrary amount for senior developers of about $50 an hour, that is $250 just to find the problem.  $250 isn’t much, but that is 5 hours of production time that was missed, therefore you could say it is really twice that cost.  If the above is done with the commenting then this item is moot.
  • The final one is the 2 heads are better than 1.  The number of times I have been staring at a problem only to have someone else point the above problem out.  But that said, sometimes going away and coming back to it the next day works as well.  But there is a limit to the number of heads and the increased betterment of it, beyond that efficiency goes down and it increases the time to find the solution.

Posted on October 31, 2012, in Development, Tips and Tricks, TriWars and tagged . Bookmark the permalink. 1 Comment.

  1. Awesome info and entertainingly written. Keep up the fantastic stuff!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: