Skip to content

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

Steps

1. Check the map's lights

The director drives the lights already in your map; it does not bring its own.

  1. Select the map's Directional Light and set Mobility to Movable.
  2. 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_SimpleVolumetricCloud material 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

  1. In Place Actors, search for XenoCore Environment Director and drag one into the map. Its position does not matter. Place one per map.
  2. 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.
  3. 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.
  4. 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

  1. In your folder, right-click › Data › Data Table, and pick the row structure XenoCoreWeatherChanceRow. Name it DT_MyGame_Weather_MyArea.
  2. Add a row: Weather XenoCore.Weather.Rain, Percent 10.
  3. Add a row: Weather XenoCore.Weather.Storm, Percent 3.
  4. Leave Phases empty on both, so they can roll at any time of day.
  5. 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

  1. Open your Area Definition (the asset your XenoCore Map Area actor's Area points at).
  2. Under Weather, set Weather Table to DT_MyGame_Weather_MyArea.
  3. 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

  1. Press Play in your map. The minimap shows the area name, a weather icon (none when clear) and the time.
  2. Open the console (`) and run XenoCore.Time.Scale 60: an hour passes every second. Watch the sun set, the moon rise and the stars come out. Run XenoCore.Time.Scale 1 to go back.
  3. 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.
  4. Run XenoCore.Weather.Set Storm lock snap, then XenoCore.Weather.Lightning. The sky flashes and thunder follows.
  5. Run XenoCore.Weather.Reroll to hand the weather back to your table.
  6. 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.