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)
- 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.