Do it right the second time

Today I realized that I needed to completely rewrite the system for handling selecting ships. This was for two reasons:

  • It was buggy because I had tried to graft on the extra feature of being able to select either all ships that are not the player’s escort or select only ships that aren’t the player’s escort onto a system that had not been designed for that level of specificity so it was only work half the time and was unpredictable.
  • The way it had been built it could only ever work for the player’s ship and not for any NPCs, which was fine when my NPC AI was simple but eventually I am going to need NPCs to be able to select their own targets and change target when appropriate, so I need a general purpose system that works for any ship.

As part of this I decided to finally (better late than never!) start clearly annotating my code or, at least, writing comments so I know what the heck it does a year from now when I need to touch it again for the first time.

I know I really should have been commenting my code from the beginning, but I was letting the fact that I hadn’t get in the way of me starting to do it right. So, here I go with spending more time commenting the code now to save time later when I inevitably need to figure out what the me of the past had been thinking.





Leave a Reply

Your email address will not be published. Required fields are marked *