How do I get a good night's sleep?
I bit the bullet and decompiled the source code, and here's what I've been able to glean from it.
In summary, there are two factors that contribute to an energy penalty:
- If you are exhausted, you'll lose half your energy the next day. This only kicks in when you're properly exhausted and become sluggish, not when it just says "you're starting to feel exhausted".
- If you stay up past midnight, you'll lose up to half your energy, depending on how far past midnight it is (if it's only 12:10am, the energy loss is so small that you probably won't even notice it).
These two factors are applied cumulatively, so it's possible to wake with even less than half your energy.
One important (and possibly unintuitive) thing to keep in mind is that, as long as you're not exhausted, the energy you go to bed with has absolutely no effect on the energy you wake up with. If you go to bed late, it's entirely possible to wake up with less energy than you went to bed with. And if you work yourself down to near-exhaustion (but not full exhaustion) and go to bed early, you'll wake up with full energy.
Here's the step-by-step process of how your energy is calculated when you wake up:
- Your energy is set to its maximum.
- If you went to sleep exhausted, you lose half of your maximum energy, except for one point (so if your maximum energy is 270, you'll get 136).
You lose a fraction of your energy based on how far past midnight it is. The formula's a bit complicated to describe, so here's a table (note the sudden leaps at 1:00am and 2:00am):
Sleep time Energy loss (as percentage of maximum energy) 12:00am 0.0% 12:10am 2.5% 12:20am 5.0% 12:30am 7.5% 12:40am 10.0% 12:50am 12.5% 1:00am 25.0% 1:10am 27.5% 1:20am 30.0% 1:30am 32.5% 1:40am 35.0% 1:50am 37.5% 2:00am 50.0%
- If it's past 3:00am, you'll lose half of whatever remains. I have no idea how it's even possible to get to 3:00am, but that's what the code says.
If you stay out past midnight or use energy until you're exhausted, you'll wake up the next day with half-energy.
When the game says "you're starting to feel exhausted..", you're not actually exhausted yet. It doesn't happen until you see the icon above your energy bar that looks like a blue face.