I don't know what is up but every time I get a new idea to create a new game or program I feel super motivated and excited but then I lose interest a month or so into the project. I haven't completed a SINGLE game or program in 3 years(My archive folder contains nearly 20 unfinished projects and there is more on my laptop) and I am starting to get frustrated and angry at myself. I have also tried implementing smaller games like ticktacktoe, same story. What can I do to keep myself from getting bored and abandoning projects left and right. Please help.
Welcome to life!
sometimes, things are boring when you are working on them. Take building a new deck on your home. It takes weeks of hard, mind-numbingly dull and repetitive work, maybe even months if you are just hitting it at night/weekends. Dig some holes, place some posts, cut lots and lots and lots of boards, nail lots and lots and lots of boards, paint it, etc. BORING!. Then after a while you have something nice that you can enjoy. The most excitement you get is measuring stuff or hitting your thumb with the hammer.
Nothing is going to make coding less dull during the work part of it. The fun is the creative bits, but you still need tons of standard and fairly dull code around those to make it do the stuff it needs to do... opening files, iterating containers, shuffling data around, etc. The best you can do here is to try to minimize that by using the built in tools and online resources and your own code base to make the boring parts take up less time and effort. But at some level, you have to want the finished product enough to justify the work to get it there. Or you are getting paid for it and don't care much one way or the other ;)
When I find myself getting bored with working on a project I take some time to self-teach a feature of the language. Looking at how that feature might be useful in the project.
Not everyone is so self-obsessed with programming as the real code geeks are. Most people it is just work, or a hobby.
Possibly, you could give yourself encouragement and ideas to keep yourself working on a project. When I get really bored, I just tell myself of the pleasures of finishing a project/game, seeing how it works, showing other people.
Since I'm not a professional, I have the luxury of only working on projects that interest me. I tend to choose things where most of my time is spent thinking rather than coding. This means I don't find myself writing code that feels tedious very often.
Subgoals are extremely important for me. I make a lot of them so that I can try to meet at least one per day. If I can complete a module/function/etc. it is extremely satisfying to test it and see it work. If I don't break the project down into steps like this I find it overwhelming and tend to not get any work done.