Other

Ren’Py Day & Night Cycle Script

June 25, 2023
Ren'Py Day & Night Cycle Script And Tutorial

One thing I’ve seen people ask about in forums is “how do you create a day and night cycle in Ren’Py?”, meaning how to make a game that progresses time in some way. Some also wonder how they can use this sort of system to only allow certain actions to be done if it’s a specific day or time in the game.

It’s not actually too difficult to make and doesn’t need a lot of code to work, but also depends on what kind of time-progressing system you want.

There are some visual novels and games in general out there that works with time. If you study these, you’ll find that many don’t work with actual clock-time like in the real world, that ticks away every second, but have limited it to action-based time progression. When actions have been done, the time progresses and might result in another time of day or a new day.

Working with times-of-day makes it much easier to code, and allows the player to plan out their days in the game as they know, or learn, that certain actions takes certain time to complete. If they have tasks to do which can only be done at certain times and days, they have to be more strategic about it which can make for some fun gameplay.

So the trick is to make it quite simple. This way you don’t have to work with different Python modules like DateTime and Time and figure out how to work with them, especially if you’re quite new to programming in general.

So I decided to make a tutorial and example script for my patrons to download over at Patreon. I did a post first where I asked them if they’d like to see a tutorial for it, and I got some positive comments and also some feedback on functionality they wanted to see.

The script works by accumulating “activity points” whenever the player completes certain actions like, reading a book, eating at a restaurant, playing a game on the computer etc. The actions themselves are done with choice menus where the activity points increase with a specific amount. The time of day then progresses depending on the points.

Ren'Py Day And Night Cycle Script

When enough points have been gathered for a whole day, then no more activity points will be gained, even if certain actions are still available to be done. It will therefore stay nighttime until the player goes to sleep.

Ren'Py Day And Night Cycle - Night Time

After sleeping, the next day arrives which I coded in a way to make it easy to set which time of day the player will wake up at. The days are based on real weekdays (Monday, Tuesday, Wednesday etc.) but no months.

Ren'Py Day And Night Cycle Script

The script also shows how you can limit certain choices to certain days or time of day. I made a choice to be able to go eat at a restaurant, and set it so a specific secret dish would only be revealed on the menu if it’s a Saturday evening.

The restaurant would also be inaccessible in mornings, evenings, nights and Sundays.

Ren'Py Day And Night Cycle Script

The script can be used in different ways to make a fun “time” based game for your players. As mentioned, this is just an example script that you will have to modify so it fits and works the way you want for your game. But it shows you how to do different things with it, so you should be able to learn from it and the tutorial video to make it work like you want.

Download the script and watch the tutorial on my Patreon

You can watch a preview of the tutorial video to see how the script example looks like in the game on my Patron before you join if you’re interested in it. After joining, you’ll then get access to download the script and use it in your games however you want, both personal and commercial games. You’ll also be able to watch the entire tutorial to learn how it works so you can adjust the code as you need!

    Leave a Reply