Sleeping, Docking, Editing

Hey Folks! Hope everyone had a good weekend. We appear to be experiencing snowpocalypse here in Seattle, and there is no end in sight yet. For reference, the typical snowfall here is maybe a few inches 1 or 2 days over the winter. And the snow removal budget/plans for the city are set accordingly.

So far, we're in week 2 of what would pass for a normal winter in snow country. At least we have decent shovels!

Back at the office, I think I've got sleeping behaving well enough now. My ticker functions are incrementing sleep debt while awake, and decrementing it when asleep. And it basically restores a full day of sleep debt in 8 hours of sleep. And for every hour of sleep debt AI accumulates, they get a bump in their sleep comfort stat. They need sleep comfort of 8 or more to be able to sleep. If they try to sleep with less, they fail. And if they are sleeping when it dips below 8, they wake.

This almost worked, except they would typically wake in the middle of the night due to their sleep debt and comfort stats dropping from 16 to 8, triggering a wake. So I added a +8 sleep comfort to AI as the default. This means a full night's sleep (8ish hours) restores all sleep debt from a normal day, after which they wake naturally. They'll be around 7-7.9 sleep comfort at this point, and cannot return to sleep.

Hours later, they might get just enough sleep comfort to stop sleeping, but they won't be able to sleep long until it depletes below 8 again. I.e. they can nap. And it'll probably throw off their night sleep schedule.

It's fairly simple compared to my older REM sleep stuff, but it's more reliable. And they wake almost instantly if their comfort is affected by something, which wasn't possible before. So I'd say it's a net improvement.

In the process of testing this upgrade, I found and fixed a bug that failed to show the death animation when crew died. Dead crew would also have accelerating conditions due to a time stat bug. There were a handful of bugs in the ship editor which crashed the game due to null pointers, which I fixed.

I also finally moved the thermostat for the character creation station into the same room as the HVAC systems, since having it sealed in a different chamber could frequently cause the HVAC room to burn/freeze without the thermostat noticing. Oops.

Plus, I found a few docking bugs. First, trying to move a ship with crew on it caused a null pointer in the light/shadow code, since crew don't currently have shadow box support. Docking portals also had incorrect shadow boxes when opened, causing a wall of darkness. And one of my orange light states pointed to the blue light when active, so it would turn blue if switched off and on again.

Quite a productive day, overall!

My next step was to try and get my lonely crew to dock with a station and recruit some teammates for testing of needs fulfillment, and eventually work/shift stuff. But that's where the docking bugs happened today. Hopefully, I can resume tomorrow!

Tags: Ostranauts