The day-night cycle system

Hey cowboys,

today we are going to talk about one of the most exciting features sported by Chico: the day-night cycle system.

Since Chico is basically a screen saver and it may go on forever ( sometimes coffee break can last hours ) it would be boring if our poor hero had always to be hanging around in the daylight.

The day-night cycle we implemented in Unity has a lot of features in order to give the world a beautiful appearance by rendering some specific colors for the sky, the sun, the light, the ground and some more ( I don’t remember all of them ) at different times of the day; here a screenshot from the Unity inspector:

The first thing we had to set up is the Unity procedural skybox needed to show the sky itself; the Unity skybox also includes the sun ( unfortunately not the moon ) and a powerful shader to achieve some interesting effects, such as for example atmosphere thickness, equator convergence, sun color and size. As you can see in the inspector the day has been splitted in four parts, each one holding colors and other specific settings which are then interpolated one another to reach the desired result.

On startup the day-night cycle system will set the game day time in order to match the timezone you are living in ( so if you run the game at midnight and you can’t see Chico walking alone on the peak think he might be sleeping ) and you will see the sky changing slowly like it happens in real life; in fact an entire cycle will last 24 hours by default, unless you speed it up like we did ripping the following video ( you will be allowed to speed up or slow down the time in the option menu ).

….but first a set of screenshots……

During the night our hero can even look at the stars if he has an insomniac; in fact we have realized a spherical shaped particle system ( don’t worry, it is a very very light particle system ) in order to recreate the whole starry sky. 

Another great feature concerns the buildings which you can build all around: many, if not all, of them are provided with a candle near the entrance; each one is then managed by the day-night cycle system which will light all the candles up when the night comes, giving the game some amazing lighting effects ( our Chico also have a torch while hanging around at midnight ).

That’all for today folks.

As ever, if you have any suggestions feel free to message us.

Leave a Reply

Your email address will not be published. Required fields are marked *