2/6/14

Now that was a tough bug to find.  If you have played the demo, you may have gotten a glimpse of a nasty looking guy in the game.  It sometimes happens when targeting an enemy wall for your troops to attack.  I didn't even realize this bug was in the game until after the demo was out, and I gave it a more thorough test.  It was also brought to my attention by a good guy with the username SoleGooseProductions on NintendoAge.com.

In the picture below, you can see some code that I added to fix the bug:
LDA currTroopIndexTakingDamage
CMP #16
BNE +
JMP thisTroopIsDestroyedDone
+

In simple terms, if the wall was being targeted by the player for an attack, then the value for "currTroopIndexTakingDamage" might have been set to 16, which throws off the way this function works. 


One reason that bug was tough to find was not exactly knowing where to look.  In the picture, we have a very small glimpse of the code for Armed For Battle.  Just to get a feel for the size of this game, the picture shows just part of a file that is 1230 lines long.  I'll admit that it's not all code line after line.  There are plenty of lines in there for comments (the green stuff) and that 1230 total includes blank lines as well.  So, I guess when it's all compacted together, maybe you are looking at only 700 lines of actual code.  Big deal.  On the other hand, on the left side of the picture, you can see about 30 files that are visible.  And those range from around 850 to over 7,000 lines of code per file.  Plus, there's about 15 files with more game data which are not seen in the picture.  Then again, it's possible that I'm a terrible coder, and could have been way more efficient.  :)
 
Everyone knows that it's not the size of the code, but it comes down to whether the game is fun to play.  And that is exactly what I'm trying to determine at this time.  I am trying out various settings with the game's data, and testing it out to see what works best.  Troop hit points and speed values, timer settings, resource income settings, you name it.  And any bugs that appear along the way are getting eliminated as they come up.
 
Before I go, I have one other exciting addition to the game to mention.  After a battle comes to an end, there will be a transition screen which shows how many casualties there were in that battle, including the player troops and the enemy units.  More thanks to SoleGooseProductions for planting this idea in my head.