The time of day cycle included in the MSGT is versatile, easy to customise and completely ready to be hooked up to external/third party day/night cycles. It includes a clock, to help your players track in-game events and cycles, a dynamic world-temperature cycle, settings to control the day/night ratio and speed, and much more. By default, it hooks up to the Epic Games skysphere.
By default, the MSGT time of day system requires at least a couple of specific things present in the world to work correctly. This can be disregarded if you are using a custom system (see Considerations).
In order to work with the MSGT’s time of day system, and allow the day night cycle to synchronise over multiple players, a small amount of logic was required to be placed into the gamestate file included in the template. Called SurvivalGameState, this file can be found within Content/SGT/Blueprints/Game/ and is used exclusively to manage the time of day cycle and some associated functions. No settings are required to be set inside of this file, and it is recommended that, unless you are required to use gamestate logic, you do not edit this file.
This actor is a standard actor supplied with the engine and is used in most of Epic Games’ own template projects. The only difference required with it’s use in the MSGT is that, as you will likely have many of these in your game world for various lighting effects, you need to add a component tag to this one and set it as “SGT_Sunlight”. As we will also be using the time of day system to animate the sun, this light must be set to movable to allow dynamic lighting.
Note: Dynamic lighting, particularly in large complex worlds, can be quite expensive for performance. It’s definitely not going to break your projects performance on it’s own, but as with any big changes, it’s always good to keep in mind.
This is the default sky sphere blueprint included in all of Epic Games’ own template projects. No additional tagging or settings is required on this blueprint, just that one exists in your project. This will be used to control the sky’s visual appearance, animate the sun, etc.
As an optional extra, which can be used to enhance the day/night transitions, as well as improve the visual fidelity of the overall cycle, a skylight actor (also a standard actor included with the engine) can be added. This will, like the Directional Light, need to be be set to movable in the transform settings and be given the same component tag “SGT_Sunlight”
Once the requirements mentioned above have been set up, the system is ready to go. You need only to ensure your player controller has a C_Manager-TimeOfDay actor component attached to it and that this is set up to initialize properly. By default, this is all handled automatically in the included SurvivalController blueprint.
|Update Interval||This controls how often the time of day cycle updates. A higher update rate (ie, lower value) will mean that things like the sun movement, shadows, temperature blending, etc. is much smoother, but will come at the cost of performance and, potentially, network bandwidth. The setting is expressed as a value of seconds, so for instance, a value of 60 means that the system will update once every minute. This setting should be set based on the importance that your time of day system has in your game, as well as the length of your day/night cycle. If you have a long day/night cycle, for instance 10 hours, then it is not as important to update this every second. However, if your day/night cycle is relatively short, for instance 10 seconds, then you may want to ensure that this update rate is high to maintain a high visual fidelity when the sun is moving across the sky rapidly.||1.0|
|Disable System||This checkbox will disable the time of day system and is useful in testing/debugging scenarios.||False|
Time of Day
|Use Custom System||Using this checkbox, you can disable all animation and impact on the default Epic assets and simply use the Time Of Day manager to manipulate the base time value and temperature values. Ensure this is checked to true if you want to hook up Orbit, TruSky, Ultra Dynamic Sky or something else!||False|
|Cycle Length||This defines the total length of time, in seconds, it takes to go through one full day/night cycle. It is not recommended to go above a value of 86400 seconds (a full 24 hour cycle). Likewise, pushing this value below 500 (ten minutes) will lower the visual fidelity of the day/night cycle and potentially cause network bandwidth issues.||3600.0|
|Start Time||This is the time of day that the first day in the server starts at and is expressed as a factor of Hours:Minutes:Seconds.Milliseconds. This operates on a 24-hour cycle, so for 5PM, you would input 17:00:00.000.||10:00:00.000|
|Transition Length||This value determines how long the system takes to process sunrise and sunset. In effect, this will be how long it will take to go from full sunlight to zero sunlight on sunset, and reverse on sunrise. This value is expressed as seconds.||30.0|
|Day Percent||The Day Percent is used to define how much of the day/night cycle belongs to the day time. Night is defined as the time between sunset and sunrise, and day as the other portion of the cycle. If that ratio does not match the same percentage here, then the system will automatically "speed up" night so that it passes quickly, whilst slowing down the daytime to ensure that the cycle length is maintained. This can be used to maintain clock-time integrity but still allow the night to be over quicker than the day. This values is expressed as a decimal percentage (0.01->0.99).||0.7|
|Sun Rotation Curve||The curve asset used to control the sun's rotation over time. See default curve for reference.||SGT_SunPitch|
|Sunrise Time||Defines when sunrise occurs in the cycle.||05:30:00.000|
|Sunset Time||Defines when sunset occurs in the cycle.||18:30:00.000|
|Show Days||If enabled, the UI clock will show the current day.||True|
|Use Clock||Controls whether the clock is displayed on screen or not.||True.|
|Use 24Hour Time||If enabled, the time will be displayed in 24 hour time rather than AM/PM format.||True|
|Show Minutes||If enabled, time will be displayed with minutes as well as the hour.||True.|
|Use World Temperature||Enables/disables the world temperature cycle.||True|
|Temperature Curves||An array of available curve assets. The temperature system will, each game day, pick one of the curves listed in here at random to be used for that day.||SGT_Temperature_001-009|
|Minimum Temperature||Defines the temperature when a curve reaches the value of 0.0.||6.0|
|Maximum Temperature||Defines the temperature when a curve reaches the value of 1.0.||50.0|
Using a third party sky system
If you are using a custom sky system, it is important to realise that you will need to hook up the MSGT time of day cycle to this system. You can use the value CurrentTime from the C_Manager-TimeOfDay component to power these other systems. Some conversion may be required. By default, this value is expressed as a value representing the seconds in the day, with one full day being 86400 seconds. As an example, Ultra Dynamic Sky uses time as a factor of hours, so midnight is 0, 8am is 8, 10pm is 22. All that would be needed here would be to convert between the 86400 second cycle to the 24 integer cycle and input that into the UDS system. Tutorial content on each individual system will be covered on this site in due time.
Temperature curve blending
As the world temperature system uses data curves, it is entirely possible that the temperature in one curve at the early morning midnight does not match the data curve of the prior one at late night midnight. In order to avoid the temperature jumping about between days, the system automatically checks the difference and blends between the two between 11pm (2300) and 1am (0100) every day. It is still recommended to have day cycles start and finish in similar portions of the graph if trying to maintain any level of realistic transition, but the system will smoothly blend between the two.