70
henlo
7y

THIS is why unit testing is important, I often see newbs scour at the idea of debugging or testing:
My high school cs project, i made a 2d game in c++. A generic top down tank game. Being my FIRST project and knowing nothing about debugging or testing and just straight up kept at it for 3 months. Used everything c++ and OOP had to offer, thinking "It works now, sure will work later"

Fast forward evaluation day i had over 5k lines of code here, and not a day of testing; ALL the bugs thought to themselves- "YOU KNOW WHAT LETS GUT THIS KID "
Now I did see some minor infractions several times but nothing too serious to make me refactor my code. But here goes

I started my game on a different system, with a low end processor about 1/4 the power of mine( fair assumption). The game crashed in loading screen. Okay lets do that again. Finally starts and tanks are going off screen, dead tanks are not being de-spawned and ended up crashing game again. Wow okay again! Backround image didn't load, can only see black background. Again! Crashed when i used a special ability. Went on for some time and i gave up.

Prof saw the pain, he'd probably seen dis shit a million times, saw all the hard work and i got a good grade anyways. But god that was embarrassing, entire class saw that and I cringe at the thought of it.
I never looked at testing the same way again.

Comments
  • 2
    But did you figure out what was wrong?
  • 28
    Memory leaks all over the place. I used pointers to create enemies at runtime, but not all got deleted. I think the change of pc affected. I made it on a i5 pc and ran it on a potato pc. It couldn't keep up with d game loop cuz i used clock timers in several places to perform game logic. Shit decision.

    I didn't spend another minute fixing all that cuz i was so goddamn tired(took months to make) and didn't know what to do.(knew jack about debugging) @terraria99
  • 12
    Sounds like it gave you a massive step forwards in your personal development though. Imagine how much less you'd know now if you sat back and did nothing.

    You have to wander down a lot of dead ends to get good!
  • 10
    Right. It kinda destroyed my ego... in a good way. Reading all the other rants, it kinda feels good to know that there are others like me. @nzeetee
  • 6
    @yatanvesh The most important thing is that you were able to point out the problem (no testing) and that you learned something (you will test your code in the future).
    This ability in itself separates average devs from pro devs, and you are on a good way to become a pro.
    Don't let your ego get you ;-)
  • 1
    @yatanvesh You should check out Rust ♥️
Add Comment