Welcome to ehealth!
What you are describing sounds alot like migraine w/aura. It can disrupt your vision before and/or during the actual migraine attack.
You should see you doctor about this. There are many medications that they can prescribe that will help after the attack has already started.
Migraines are (normally) caused by triggers. And you have already described three possible triggers (lack of sleep, stress, and caffeine).You may want to keep a pain journal. That would track if any foods or activities trigger them as well.
You should definitely cut back on your caffeine. It is not healthy to consume to much and can really play a part in your headaches. Your pain diary should help you figure out what other triggers you may have so that you may be able to prevent some of the headaches.
But you should schedule a doctors appt to make sure they are migraines and to get on some meds that will help shorten the duration and deintensify the pain.
I hope you are feeling better soon. Keep us posted!