Dreams continue to perplex scientists, and sleepers alike, but recent research is shedding light on why we dream and even ways to control dreams.

When your head hits the pillow, for many it's lights out for the conscious part of you. But the cells firing in your brain are very much awake, sparking enough energy to produce the sometimes vivid and sometimes downright haunted dreams that take place during the rapid-eye-movement stage of your sleep.

Why do some people have nightmares while others really spend their nights in bliss? Like sleep, dreams are mysterious phenomena. But as scientists are able to probe deeper into our minds, they are finding some of those answers.

Here's some of what we know about what goes on in dreamland.

1. Violent dreams can be a warning sign

As if nightmares weren't bad enough, a rare sleep disorder — called REM sleep behavior disorder — causes people to act out their dreams, sometimes with violent thrashes, kicks and screams. Such violent dreams may be an early sign of brain disorders down the line, including Parkinson's disease and dementia, according to research published online July 28, 2010, in the journal Neurology. The results suggest the incipient stages of these neurodegenerative disorders might begin decades before a person, or doctor, knows it.

2. Night owls have more nightmares

Staying up late has its perks, but whimsical dreaming is not one of them. Research published in 2011 in the journal Sleep and Biological Rhythms, revealed that night owls are more likely than their early-bird counterparts to experience nightmares.

In the study 264 university students rated how often they experienced nightmares on a scale from 0 to 4, never to always, respectively. The stay-up-late types scored, on average, a 2.10, compared with the morning types who averaged a 1.23. The researchers said the difference was a significant one, however, they aren’t sure what's causing a link between sleep habits and nightmares. Among their ideas is the stress hormone cortisol, which peaks in the morning right before we wake up, a time when people are more prone to be in REM, or dream, sleep. If you’re still sleeping at that time, the cortisol rise could trigger vivid dreams or nightmares, the researchers speculate. [Top 10 Spooky Sleep Disorders]

3. Men dream about sex

As in their wake hours, men also dream about sex more than women do. And comparing notes in the morning may not be a turn-on for either guys or gals, as women are more likely to have experienced nightmares, suggests doctoral research reported in 2009 by psychologist Jennie Parker of the University of the West of England.

She found women's dreams/nightmares could be grouped into three categories: fearful dreams (being chased or having their life threatened); dreams involving the loss of a loved one; or confused dreams.

4. You can control your dreams

If you're interested in lucid dreaming, you may want to take up video gaming. The link? Both represent alternate realities, said Jayne Gackenbach, a psychologist at Grant MacEwan University in Canada.

"If you're spending hours a day in a virtual reality, if nothing else it's practice," Gackenbach told LiveScience in 2010. "Gamers are used to controlling their game environments, so that can translate into dreams." Her past research has shown that people who frequently play video games are more likely than non-gamers to have lucid dreams where they view themselves from outside their bodies; they were also better able to influence their dream worlds, as if controlling a video-game character.

That level of control may also help gamers turn a bloodcurdling nightmare into a carefree dream, she found in a 2008 study. This ability could help war veterans suffering from post-traumatic stress disorder (PTSD), Gackenbach reasoned.

5. Why we dream

Scientists have long wondered why we dream, with answers ranging from Sigmund Freud's idea that dreams fulfill our wishes to the speculation that these wistful journeys are just a side effect of rapid-eye-movement (REM) sleep. Turns out, at least part of the reason may be critical thinking, suggests Harvard psychologist Deirdre Barrett who presented her theory in 2010 at the Association for Psychological Science meeting in Boston.

Her research revealed that our slumbering hours may help us solve puzzles that have plagued us during daylight hours. The visual and often illogical aspects of dreams make them perfect for the out-of-the-box thinking that is necessary to solve some problems, she speculates.

So while dreams may have originally evolved for another purpose, they have likely been refined over time for multiple tasks, including helping the brain reboot and helping us solve problems, she said.

Follow LiveScience for the latest in science news and discoveries on Twitter @livescience and on Facebook.