It feels a bit strange that, after all this time, I finally get to repost the script that started this blog, a long while ago, long before I had made myself a name - that is, long before the ACMS. :p The loop is getting looped, and it feels like a nice parting gift with all of my faithful RMXP followers.
The Daily Life project initially is my own attempt as a day/night system. If you would like a day/night system and...
- you think most of those look ugly or otherwise unrealistic
- you would like to control the flow of time
- you would like to make variations on events based on the time of the day or day of the week
- if you would like a realistic, dynamic lights system
Then it is exactly what you need.
Natural-looking day and night.
- time does not advance automatically - unless you command it to with a parallel event. You get to control how time changes with game variables, down to the second.
- a wide range of variables and switches allows you to set event to appear/occur only at specific times - specific hours and/or days in the week and/or months and/or years...
Natural-looking day and night.
- progressive transition between dawn, day, dusk and night
|Progressive change in daylight on a summer solstice|
- progressive change of daytime duration according to the season (daytime lasts longer in summer)
|Progressive change in daylight on a winter solstice|
- fading overlay effects according to time of the day (sunbeams at noon and haze at night)
- events named "Shadow" automatically fade out as night gets closer
- day/night can be disabled when inside closed spaces, and luminosity set manually
|Closing the curtains forces the luminosity to zero despite the fact it is noon|
Realistic, dynamic lights
- any number of light sources can be set and blend naturally into each others
- real-time calculation allows light sources to flicker and even move around
- adjustable radius and strength
- lights tear through darkness but do not overlay ambient light
- This script is known to make the interpreter lag, depending on the user's machine. It is not the script's fault. RPG Maker's graphic engine has such poor performances, that how the script works will necessarily confront it to its limits sooner or later. It is pointless to ask me for an optimization, since there's absolutely nothing more I can do to address this issue. However, here are a few guidelines to avoid lagging:
- More light sources mean more calculations - do not make too many of them
- Map scrolling requires recalculation at each frame - avoid making maps that exceed the screen size
- Having light sources flicker or move around also requires frequent reclaculation - do not overuse those effects
- The darkening overlay which gives the illusion of night is arranged in small blocks. The DARKNESS_PRECISION constant in the Constants - Custom entry controls the size of said blocks - the smaller they are, the better the quality and the worse the lagging. It is set to 2 by default, which I found to be the best quality/performance ratio. Setting it to 1 will make the overlay appear blocky but will cut the load in quarter.
- The DARKNESS_FRAME_SKIP constant in the Constants - Custom entry allows to force the calculations to wait for a set amount of frames, thus effectively cutting the load. It is set to 0 by default (no skipping) but you can set it to small numbers (like 4 or 5) so that the overlay does not appear too jumpy, and you gain a little performance boost.