I see a lot of people asking for “bug” help but it’s just problems with their code as to why something won’t work in the first place. What I’m having problems with is 200 enemies working completely fine then all of a sudden 1 enemy flying 600mph across the screen. I’m not sure how the exact code of the same instantiated enemy works just fine, then all of a sudden 1 enemy will be invincible to bullets, one resource will just not be able to be picked up. I’m not sure how to even go about dealing with this because obviously my code works and the enemy/resource works just fine, until it doesn’t randomly for 1 or 2 out of like 500 that have spawned. I have tried using the “remote” section to see if I can see an issue while I’m testing the game but there is no issue there. Can anyone point me in the right direction for beginning to get these issues fixed? I’m new to game dev but doing pretty good at learning I just have no clue where to start in fixing these “actual bugs” that develop in my game. I’m pretty good at using google too so even an idea of the right route to go as far as googling would help me out.
thanks!
Godot has some really good tools to debug scripts.
Getting down into the source code is more advanced, but not unheard of for being the source of a problem.
Another thing to look into is unit testing. Which can be tedious to do for every class and function, but if you have a complicated system, that you don’t want to test manually, write a system-test/integration-test to test inputs and outputs. I would recommend GDUnit from the asset store. And GUT is also a popular unit test plugin.
Once you have a test scenario that fails you can use breakpoints to walk through your code to find the issue. The upside is you now have a test that can be run if you ever make a change and want to make sure your code still works!
I will say collisions can be interesting to debug. A flying enemy could be a spawn on top of issue that the physics engine adds way to much force to separate bodies. And missing collisions could be logic issues.
I would say you need to create some stress tests. For example does it happen with 100 enemies? What about 50 enemies or what about 500 enemies which may give you results faster. In any case think of divide and conquer to narrowing down bugs but it does involve introducing debug code and printing output. Oh and make backups before altering your project.