I'm happy to present you the first day/night with season cycle! But before I start, I need to say that I work on lighting since 2 years and this map is the sum of my experience. If someone got ideas to improve it or want to share his new seasons cycle, this is the right place for.
I would like to thanks Obliviron, who gives me the basics about lighting and day/night cycle. The link for his tutorial is at the bottom of this page.
All the remaining text will be in FAQ mode, so if you have question about that, you can add it in this thread and I'll will put that question in my page to answer it as soon as possible. Let's get started!
What is, in your game, a day length and a season?
It's simply a normal day/night cycle on 24 hours, but also with, sometimes, a 4 seasons cycle (summer, fall, winter and spring). I mean, by a season, that the day is longer than the night during summer and vice- versa during winter. I said 'sometimes' above because the season's cycle will depend on your coordinates on the planet. I use the lattitude system to determine in which zone you are: equator, tropical, polar or arctic. To add more realism when I change a season in the polar or the arctic zone, I have a total of 8 half-seasons (summer, 1, fall, 3, winter, 5, spring, 7). These 4 more seasons make a lighting change less drastic.
How works lattitude?
Lattitude are lines that are parallel to the equator, the central line of the planet. Lattitude are measured in degrees and after comes the minutes and the seconds.The 2 last datas are primary used to add more precision, but in my map, it is only for aesthetic.
Also, lattitude starts from -90° at the south pole to 90° at the north pole. To resume, the equator zone in my map have all the degrees between -22° to 22°, the tropical zone is between '-44° to -23°' and '23° to 44°', polar is between '-65° to -45°' and '45° to 65°' and arctic is between '-90° to -66°' and '66° to 90°'.
In what way this cycle affects the units?
It's only a behavior that is linked with a validator. Units also have a sight bonus which is ajusted with the dawn and dusk. If you want to change the dawn and dusk hours, you must go to the lighting tab in the data panel (not in the lighting window).
How the validators works?
If you go in the validator tab, you can see that I have 10 combine validators and in each of them, I have 2 'time of day' validators. For example, if I go on the validator "After Dawn - Daytime 0", you can see that it returns true when the hour in the game is greater than or equal to 2:00. To end the day time, I must enter another validator (Before Dusk - Daytime0) that return true as long as the hour in the game is less than or equal to 22:00. In short, the seasons 0 is polar summer, so I will only have a night of 4 hours. All my combine validators that matches during day have the 'and' type and the night validators have the 'or' type. Remember this when you will add it to your map, or else your validators will not work.
Why there is a light around my templar during night?
This light is a actor of type 'model addition' that fires when the templar's behavior, recharge, return true. This behavior also drains 10 mana each seconds, like if the templar recharges its energy during day.
Why do you have 8 kind of the same behavior?
Because they all have a different function in the game. The first five are to match the current season (0 is polar summer, 2 is fall, etc.), the 'alltime' behavior is always active (during arctic winter), the 'notime' does nothing to the unit, but I use it to set the next season (during arctic summer) and the 'start' behavior is for when you create a unit (this behavior fires a trigger that returns the current season and creates the matching behavior).
How have you make a realistic daylight in your map?
Hmmm... that part is very complicated. I took Obliviron's tutorial to make my first night lightset and after that, I made many many test to find a good mix. Remember that a light is a combination of like 20-25 different settings. The complexity of the lighting window allow us to make an infinite possibilities of light environment (solar eclipse, nuclear explosion, red or green sun, etc.).
If I can give you 1 tip, make 5 different lightsets at the same time and test them with 5 triggers in-game, you will have 'the right time' about the lighting effect ( lightings in the editor are, sometimes, different than in-game). And if you want to create or copy a lightset, I recommand to do this by the data panel, not the lighting window, or else it will not work (after it is created, you can modify it by the lighting window).
Does the lighting will affect all the map?
In my settings, yes. But if you want to make tests about that, I recommand you to split the map in 2 lighting zones via the terrain editor and after that to create 2 different lightsets that match with its specific zone (You can find these settings in the 'region' tab in the lighting window). If you want to have behaviors that match with the right region, it is possible, but it will be a little bit more challenging.
How can I change the sun's rotation?
If you want to modify the sun's rotation, you must go in the 'key' tab and changes its place depending on the hour. In the '2' lightset, the sun is at right at 6:00, center at 12:00 and at left at 18:00. Farther the sun will be from the center, longer the shadows will be at the ground. Don't forget to do this change to all the lightsets, or the sun will turn in one direction and after in the other way.
You can also add more suns for a season with the 'fill' and 'back' tabs. With this, for example, you can have a sun during day and a moon during night.
In the trigger panel, I can see that you have too much action definition about the season's cycle. Is there a way to optimize it?
Sure, I made some repetition in my script for more clarity. It's sure that you must add some if/then/else functions, but it can be easily optimized.
What actually happens when a season changes?
In short, when a season begins, the triggers sets 2 variables (one to set the actual season and one to set the timer before the next one) and after it picks all units in the map with the last season's behaviors and replace them by the new.
If I create a unit during the game, how the script will know what behavior will matches the right season?
As I said above, when you create a unit, it fires a trigger that checks if you have a 'start' behavior. If it returns true, this triggers checks for the 'actual season' variable and it replaces the 'start' behavior by the matching season's behavior.
How can I modify a season (or day) length?
Inside the 'initialization' trigger, you have an action named 'Setting A Year'. This action is used to set the length of 1 day (in seconds, no minutes or hours) and the number of days for a season. If you modify this action, remember one thing: you must always put an even number for the second parameter (number of days for a season) like 2,4,6,etc. or else the half-season change will be done during day (you will see a drastic lighting change and all the seasons behaviors will not be transformed).
I made a behavior that is disabled during night and it doesn't change with the seasons. Why?
That's a problem about the condition 'unit has behavior'. If a behavior is disabled while this condition is checked, this condition will return false, EVEN IF THE UNIT HAVE THIS BEHAVIOR. So this is important to make a season change while ALL THE BEHAVIORS ARE ENABLED, or else your cycle will crash.
If I want to test the arctic zone, as example, how can I do this?
I made 4 disabled triggers about that. You only have to activate them and enter the season you want to test in the chat box. I recommand you to restart the game before checking another season, or some strange bugs will appear.
P.S: I suggest you to go to my other libraries to leave comments and suggestions and I have finally done a wish list on the official forum of Starcraft 2. My only demand is that people who see, like and use my libraries could go on the battle.net forum and like my comments about the improvement for the editor. It's not an obligation, but It would me make very happy! Here is the link for the forum : http://us.battle.net/sc2/en/forum/topic/6307501153?page=6#110