I have worked on an AI game for 18 months and just yesterday i launched it here on product launch, but it was a total nightmare, it did not even got into top 100. I had made a mistake of launching it late at around 8am and so the product did not find any recognition.
For a while i got depressed, waiting entire day if it gets featured in at least in top 20 but it didn't happened. My mood was off after that but suddenly this vision of my goal came and i realize that i cannot change what has already happened but i can definitely work for the future.
So i would say whenever you are feeling down and want to motivate yourself to work, think about that vision of goal you had before even you started working in first place. This will give you a boost. You will realize that from nowhere suddenly a certain type of energy will upsurge within you.