NOTE: this post took quite a turn as I was writing it. The post itself is somewhat a reflection of the problem I'm posting about. Please read to the end, if you have the patience to read through my huge rambling post you'll at least be rewarded with an entertaining account of how messed up I am.
I'm making this post because I'm frustrated with my lack of improvement when it comes to programming(and everything else, but that's another story) lately. I've been coding for probably about 2-3 years, inconsistently, but have learned all the basics and feel pretty comfortable with it. I can make simple 2d games and have been doing some small $500 or less freelance jobs to bring in some extra money, most of them are just simple android apps or games. When I first started programming I learned pretty rapidly and enjoyed being able to sit down and teach myself how to do something interesting and new that I couldn't do before. I always had something that I knew I wanted to learn next even when I was still working on the thing before it and learning came naturally.
For the last few months however, all my time spent programming has been wasted on many different projects that I ended up throwing away for various reasons. At first it was because I wasn't good at OOP and my code would quickly become a nightmare to work with, but that isn't as bad of a problem now as good(relatively) code architecture is one of the very few things I have learned lately. Other projects where thrown away simply because I got tired of the idea or because I abandoned them for my next new exciting idea. I probably have about 5 different game projects that are less than half done and that I have no interest in anymore. These abandoned projects, and maybe a better grasp of OOP and the LibGDX library(my favorite to use since I focus on android/desktop game development), are all that I have to show for the last 4-5 months of programming. In the 4-5 months before that I went from making pong using Swing and awt to basically the point where I'm at now, where I feel comfortable with each individual aspect of 2d game development and with several different libraries and could theoretically program any 2d game that doesn't involve anything overly complicated like difficult ai or graphical effects. And even those things I am comfortable enough that I could pick it up on the go if I needed to have it in my game.
Typing this out I'm starting to realize my problem may be more with just getting things done, and being able to see the results of my progress, rather than with being able to make progress at all. I'm still unhappy with my rate of progress though.
The last month I hardly did any programming at all. I tried to write a game for the PUTT contest and was going to use it as a project to learn how to implement Entity-Component Systems, but after I got the basic framework done I just lost the ability to even read the code. I'd sit down to work and open up eclipse but I'd just stare at my code, unable to focus enough to comprehend my own code and add onto it. The inability to focus is more of a motivation thing, not an actual attention deficit, but I am still unable to overcome it with all my willpower. Nor can I force myself to work on something else or start a new project. I just don't have the motivation to want to do it, or the willpower to make myself do it even though I don't want to. I've had problems with motivation like this my whole life, even to the point of failing 9th grade with straight F's despite A's and B's on my finals because I didn't do homework or classwork and would sometimes even sleep through tests.
Sorry this post is kind of all over the place, I didn't have a clear idea of where I was going with it when I started. I guess I'm looking for some help with my motivation problem, specifically with programming but general advice would be helpful as well as this is a problem that effects me in all aspects of life. The difference between me and and an average lazy person is that most people, regardless of how lazy they are, are able to sit down and force themselves to do something if they know they NEED to do it. I just can't consciously override my decision to sit there and browse the internet and waste time. Most normal people reading this probably won't quite know what I mean, and it's hard to explain. The best way I can explain it is that I consciously know what I want and need to do, and understand that it's going to take effort and I'll have to spend time doing things I don't want to do, I totally comprehend that and definitely think the reward is worth the effort I know I'll have to put in, but when it comes time to actually put in the effort I freeze. I struggle against myself in my own head and almost always lose. It wouldn't be inaccurate to say it feels as if there is another me in my head that I fight against for control of my actions, and the other me always forces me to submit.
Okay this post is long-winded and unorganized enough, I'm just asking for any kind of help or advice that anyone can offer. I have used all of the tools and methods I can think of to overcome this but I can't and it's effecting me greatly. I may just be really fuckin lazy and this is a big rationalization, but I genuinely feel powerless against this issue and like I've already tried everything I can, ready to give up.
other info that may be relevant:
I'm 21 years old
I'm Attending community college, I always end up dropping most my classes before the drop date though, because by the drop date I'm usually already quite far behind on my work. This semester was the worst and I dropped all of my classes, because I had a very long sickness I new I was going to have to deal with and was already having enough trouble keeping up(see below). I've gotten A's in all the classes I have completed but have never done more than 2 classes in one semester. And only completed math and computer science classes.
I'm a recently recovered opiate addict, over a year ago I quit my 2-year heroin addiction and put myself on suboxone maintenance. I quit that cold turkey at the beginning of this school year(month or 2 ago). I decided I wanted to stop being lazy and underacheiving and for some reason thought that drugs were causing my problems, even they they were present before I started using them. Since quitting I have been much worse, possibly due to PAWS(post-acute withdrawal syndrome, a mild form of withdrawal following regular withdrawal. it lasts 6+ months after cessation of opiate use while your brain adjusts to creating it's own endorphines(endorphine literally means endogenous morphine) instead of getting it's supply artificially) but I don't think my habit wasn't big enough to cause such serious PAWS. And I don't have time to wait for it to be over to start doing anything.
I'm most likely bipolar and have social anxiety, although I'm getting much better with the latter. I was diagnosed bipolar 2 but medication made me literally go insane. Also diagnosed OCD but I really just don't have OCD. I feel I relate much better to people with Aspergers than normal people but not sure if I actually have it, probably not. I'm definitely pretty severely depressed, the numb kind of depression not the sad kind.
Okay now that you know how F'd up I am does anyone have any suggestions? Sorry if any of this was inappropriate or if I'm too off topic, feel free to change/delete. I just didn't know what to do or who else to ask, and you guys seem like a smart bunch .