It's not unusual to worry about whether or not you have the ability to finish a technical task.
Minimal Working Examples
Your main problem boils down to how you develop... by adding bits and pieces into the existing game until it becomes difficult / complex to know what comes next, or how to solve bugs, especially if you don't completely understand the initial game code you built upon.
It is often preferable to do small "experiments" or M inimal W orking E xamples, i.e. a small program proving a part of your game can work as you imagine -- should take 1-3 days, and no more than 10 days. If it takes longer than that, you should consider splitting it into multiple MWEs.
MWE's are seperate from your game's codebase, for later integration if they work out.
Not only do MWEs minimise the complexity you have to deal with by not being combined with your game initially, but they are an excellent form in which to share your code if something goes wrong that you need help with, e.g. here on gamedev stackexchange or over on stackoverflow.
Over time, you may learn to build your projects by a repeat process of building external MWEs and integrating these into your game one after another until you have a complete working product. Integration itself is nearly always a challenge, so time also has to be set aside for that.
In an ideal world, you'd write these as modules that can be tested seperately from the main game, but maintaining them to be runnable separately does require additional effort over time.
This approach furthermore encourages modular design and separation of concerns .
Prioritising Technical Risks
It is essential to identify the most severe impending development risks as early in the development cycle as possible, prioritise them according to highest risk, and find out whether they are possible to achieve or not, before addressing simpler tasks wherever possible.
The moment one becomes aware of high risk factor issues looming, one should immediately note them down, consider them, consider alternatives, and if we decide to go straight into the risky issue, reduce the priority of other tasks accordingly.
We aim to resolve high risk issues in the shortest timeframe possible: we either prove the technical feat viable, or prove it non-viable and focus on coming up with and implementing alternatives.
For larger, more complex projects, some time is often allowed to pass between recognition of a looming technical issue, and addressing of that issue. This is the idea of "no sudden moves". A deeper analysis is often necessary (a) to thoroughly understand the required set of changes and the logical implications thereof, and (b) to justify the cost in time / human resource to solve it.
References
"Technical risk management priority" is my Googling suggestion for you, specific to "games development". There are a ton of resources on risk management within IT projects in general.
You should also Google "emergent complexity", a major issue in games development and a major source of interest in game design.
Two excellent books which address risk, complexity and timeframes specific to game dev are:
- Agile Game Development with Scrum by Clinton Keith
- Secrets of the Game Business by François-Dominic Laramée.