home about the studio about the team luxe game engine join the discord

You've successfully subscribed to Studio Any Percent!

Subscribe to Studio Any Percent

Stay up to date! Get all the latest & greatest posts delivered straight to your inbox

mossfield origins - dev #8

time of day

Finally some variation in screenshots

I love the orange look... but I was just noticing all the dev logs stack, and my twitter feed... just orange.

The good news is changing the visuals has an important tie to the mechanics, where knowing the time of day is relevant and having it signaled nicely in the world is key.

Time of day

Lucky my rendering pipeline is pretty easy to tweak, I added a color tint to the ambient diffuse lighting, added a fade amount to shadows, and added a fade amount to the color grading so I could easily hide transitions a little better (not perfectly, but enough for now). I also changed the skybox to a solid color and tinted it based on the same tint color.

This isn't anything fancy and was quick to add thankfully. I made a big list of colors, one per hour of the day, and lerp between then based on the time of day. I set that color to the sun color, and the environment tint color (used by the sky and the ambient lighting). During certain key hours, I fade the shadows out and then in. I also change the color grading settings during this transition (there's one for day + one for night). During the hours when the sun is up (6 - 9pm) I rotate the sun's position so the shadows move. That's all for this first pass, it works well!

Note that it looks fast but the game is set to 4x speed and you don't usually play at that rate.

Here's how it looks in motion.

Time of day mechanics

There are 3 splits in the day cycle at the moment, 8 hours each. The morning and some of the afternoon is dedicated to improving life for the residents, like building things, rearranging things and so on. "Work" is the wrong word, but conceptually they only work during those hours.

After that passes, they spend the rest of the time on recreational activities. This plays an important role in the game but at the moment there's not a lot for them to do during that time, so I sped it up. I'll expand on the recreation time when I get to it, how it factors in.

The last 8 hours are sleep, which would factor into previously mentioned 'rest' metrics.

Task types

I mentioned before (I think) how a task is intended to be suspended or left in the world for someone else to do later or tomorrow.

This is now implemented as intended, and there are the 3 phases of tasks. For example, a residence will generate a Sleep task which pulls the resident home, and then marks them as home (which makes them lie down visually, as we'll see below).

The tasks a resident was busy with when the clock changes over, get left in the world where they were, and their resident is unassigned. They're added back to the front of the queue, so that they get done first the next time window.

One other key fix I did today was make move requests track an ID, so that an out of order request from something else, doesn't accidentally cancel a new task's move request.

Sleep vs Daylight Savings

These residents are having a tough time adjusting to the new time...

With the timing bug fixed, they correctly go to their residence, lay down, and get up just before work hours.

They also lay down if they have no residence yet, so it's consistent visually.

All together

This is a mostly random video trying to set up a residence.

If you look closely you'll see them drop resources on the construction site and they teleport to the resident the next morning. I've gotta make it so they travel to the task first, so it doesn't teleport.

UI Improvements

I redid the time display on the top of the UI because it was unclear before. A tiny triangle marker and making the hours clearer made a huge difference in how useful the time display is.