Making a Game in Unity 020: Day Night Cycle

Making a game in Unity 020

After I finished making ships sink, I got to work on my wave simulation code. I replaced my sine wave-based formula with Gerstner waves, as they look a lot more realistic. This was something I had wanted to do for quite a while, but I never really got around to it. I’m super happy with the way the water has turned out, it looks so much better now!

Next, I added a day night cycle to the game. Although I decided to tackle the procedural skybox shader at a later point in time, I managed to get some nice looking sunsets going in Unity—simply by making the sun color, ambient light color, and the fog density and color dependent on the time of day. This has really made the world feel more alive, and I can’t wait until I reach the point where the game is playable!

As always, if you’re interested in more videos like this, leave a like (it really helps out with the YouTube algorithm), and consider subscribing. Also, come check out the Discord server where you can share your progress, ask for help, and hang out with other game developers.

See other posts in this series.