Give a map its time of day and weather¶
Level designer · 20 min · No code
Result: your map's sun crosses the sky with the clock, night falls with a moon and stars, and the area rolls its own weather: here, rain one time in ten and a thunderstorm now and then. The minimap shows the time and the weather icon.
Before you start¶
- Read Time of day and weather.
- A map that runs the XenoCore Experience, with a XenoCore Map Area actor and an Area Definition (the minimap needs the same two). See Give a map its minimap.
Steps¶
1. Check the map's lights¶
The director drives the lights already in your map; it does not bring its own.
- Select the map's Directional Light and set Mobility to Movable.
- Make sure the map also has a Sky Light, an Exponential Height Fog and a Sky
Atmosphere. A Volumetric Cloud using the engine's
m_SimpleVolumetricCloudmaterial is what rain and storms close up; without one the weather still dims and greys the scene, but the sky stays open.
Fails silently: a sun that is not Movable
The clock runs and the minimap shows the right time, but the sun never moves. One warning is logged at Begin Play. Set the directional light to Movable.
2. Place the director¶
- In Place Actors, search for XenoCore Environment Director and drag one into the map. Its position does not matter. Place one per map.
- In its Details panel, under Environment, set Profile to
World/DA_XenoCore_SkyProfile_Default, or to a copy of it in your own folder if you want a different day. - Leave the light slots under Environment › Lights empty to use the map's first of each, or pick the actors if your map has more than one.
- If your grass sways with a wind material parameter collection, set Environment › Wind › Wind Collection to it, and the parameter names below it to the ones your foliage reads. Rain and storms then blow it harder.
3. Make the area's weather table¶
- In your folder, right-click › Data › Data Table, and pick the row structure
XenoCoreWeatherChanceRow. Name it
DT_MyGame_Weather_MyArea. - Add a row: Weather
XenoCore.Weather.Rain, Percent10. - Add a row: Weather
XenoCore.Weather.Storm, Percent3. - Leave Phases empty on both, so they can roll at any time of day.
- Save.
Whatever the rows leave under 100 (here 87%) is clear weather. Gaur Plain's table,
Maps/Areas/DT_XenoCore_Weather_GaurPlain, is a working example.
4. Point the area at it¶
- Open your Area Definition (the asset your XenoCore Map Area actor's Area points at).
- Under Weather, set Weather Table to
DT_MyGame_Weather_MyArea. - Save.
An area whose Weather Table is empty is always clear.
5. (Optional) A night track¶
On the map's XenoCore Area Music actor, set Field Music Night. It crossfades in at nightfall and back out at dawn, never mid-battle. See Give a map its music.
Test it¶
- Press Play in your map. The minimap shows the area name, a weather icon (none when clear) and the time.
- Open the console (
`) and runXenoCore.Time.Scale 60: an hour passes every second. Watch the sun set, the moon rise and the stars come out. RunXenoCore.Time.Scale 1to go back. - Run
XenoCore.Weather.Set Rain lock snap. Rain falls round the camera, the sky greys and the music drops. Stand under an arch or roof: no rain falls there. - Run
XenoCore.Weather.Set Storm lock snap, thenXenoCore.Weather.Lightning. The sky flashes and thunder follows. - Run
XenoCore.Weather.Rerollto hand the weather back to your table. - Open the menu, choose Change Time, pick an hour and confirm. The screen fades and the clock jumps.
If it doesn't work¶
Fails silently: the weather never changes from clear
The area's Weather Table is empty, the map has no XenoCore Map Area actor, or the Map
Area points at a different Area Definition. Run XenoCore.Time.Describe to see what the clock and
weather think.
The weather icon shows, but nothing on screen changes
The map has no XenoCore Environment Director, or XenoCore.Environment.Freeze is 1.
Rain falls but shows no icon, or never lowers the music
That weather has no row in World/DT_XenoCore_WeatherTypes (or in the table set in Project
Settings › Plugins › XenoCore Environment › Weather Types). Add one with the same Tag.
Night is as bright as day
Auto exposure is lifting the night. Lower Night Exposure Floor EV100 on your sky profile;
try values live with XenoCore.Environment.NightFloor.
Rain falls indoors
The overhead capture that stops rain is off: tick Rain Height Map (Environment › Weather › Height Map) on the director. Or the roof is translucent, which the capture leaves out.
Going further¶
- Add a new kind of weather: a gameplay tag under
XenoCore.Weather, a row in the weather types table, and a row in an area's weather table. - Change how fast time passes, or the phase hours: Project Settings › Plugins › XenoCore Environment › Clock.
- Time of day and weather.