Airgoons
Yak52goons.jpg BMS.png
DCS.png

DCS Reference: Editing Dynamic Weather

From Airgoons
< DCS Reference
Revision as of 15:46, 2 September 2019 by Tippis (talk | contribs)
Jump to navigation Jump to search


Dynamic weather editing is mostly done in your chosen text editor, but you still need to keep the DCS mission editor open to do initial adjustments of pressure front locations and to do the preview and testing of the weather.

With the right tools, you can just keep all files open at all times and never have to close anything down — Notepad++ will notice if a file has been updated and will give you the option to reload; good zip manipulation tools will similarly keep the zip file open and just notify you that its contents have been updated; and DCS… will not tell you anything, but you can just quickly reload the mission to include any edited parameters. So get your multitasking on and don't close anything since that just wastes time, and the editing process is time-consuming enough as it is.

Mission editor weather UI

DCS Dynamic Weather controls.

The first step in making dynamic weather is understanding DCS' weather UI. The reason why the weather system was described as opaque and obfuscated earlier starts here: there are two parts to the UI, where the most critical one offers no direct interaction, only visual feedback, and what looks like the key UI part actually only has two controls that are relevant to the process.

The dynamic weather tab

Opening up the “Time and Weather” pane in the editor and clicking on the “Dynamic” tab presents you with the panel shown on the right. It consists of seven different sections, each with a number of controls:

  • Start, where you set the mission date and starting time. The time of year mainly determines the skinning of trees and of certain camouflaged units as far as what season colours they should be using. It does not determine the type of precipitation (rain or snow), since that is controlled by the temperature setting. Also note that some maps do not offer the full gamut of seasons — Normandy has no specific winter appearance, for instance.
  • Conditions, where you set the sea-level ambient temperature. Note that for maps where some airports sit at significant altitudes — Nevada and the inland parts of Persian Gulf in particular — the actual temperatures will be less than because of that altitude. Again, it is this value more than the time of year that determines whether you will see snow or not.
  • Dynamic Weather, where you set up (and to a very minute extent edit) your basic dynamic weather parameters. This section consists of four controls:
    • Baric System, which is an almost wholly pointless dropdown. You can choose between cyclone and anti-cyclone, and this only ever decides whether you will get a low-pressure (cyclonic) or high-pressure (anti-cyclonic) front if you decide to randomly generate exactly one pressure front. Since the whole point of the exercise is to edit these pressure levels manually, this drop-down serves absolutely no useful purpose whatsoever and can and should be ignored at all times.
    • Systems Quantity … of …, is where you can set up how many different pressure fronts you want (rightmost number), and which one is currently selected (leftmost number). This is much the same setup as when editing vehicle groups. This control and the one below it is actually of some use if you want to interactively edit the pressure numbers in the editor rather than doing it manually in the text editor. However, changing the right-most (total number of systems) number will automatically randomly generate a new weather setup with the selected number, which means that anything you've been working on will be overwritten. As such, this control may be useful at the very start if you know exactly how many systems you want — at all other times, stay away from this field.
    • Pressure deviation, where you set up the under- or over-pressure (in Pascals). Entering a negative number gives you low-pressure (cyclonic) region; entering a positive number gives you a high-pressure (anti-cyclonic) region. The fact that you can enter both positive and negative numbers and get your high/low-pressure zones that way is the reason why the Baric System dropdown is worthless: it creates the exact same thing, only with no control over the result.
    • Generate, which should never under any circumstances be used. This button randomly generates a new dynamic weather setup based on the number of total systems you've selected in the controller above. These systems will invariably be too large; have far too high pressure deviations; be located outside the viewable map area so you can't see the effects; and will irrevocably overwrite any work you've done. If you accidentally push this button, you have screwed yourself over and need to reload the mission, taking care not to accidentally save anything. Stay away.
  • Turbulence, which works the same in both dynamic and static weather and sets the behaviour of the surface boundary level. Every unit equates to 0.1m/s of turbulence at ground level, which attenuates as altitude increases.
  • Fog, where you… set up the fog layer, if you want one. Like turbulence, this setting works the same for both dynamic and static weather.
    • Fog Enable, turns fog on and off.
    • Visibility does exactly what one would expect: it determines the distance (in feet) that you can see through the fog at sea level. Note that the fog thins out at higher altitudes, so visibility will generally be unless you are starting from a carrier or attacking naval targets or something that sits directly on the beach.
    • Thickness again does exactly what it says on the tin: it sets the thickness (max altitude) of the fog layer measured from sea level. Again, note that in maps with high altitude regions, the thickness needs to be dialled up for the fog to show up in those regions.
  • Dust Smoke creates a yellow-brown haze as opposed to the blue haze of fog, and is more meant to simulate dust being kicked up from desert areas and the like. It otherwise controls the same as fog, except that it always exist at a fixed thickness above the ground, as opposed to in relation to sea level.
  • Weather Preset Controls, which let you select, load, save, and discard ready-made weather presets.

As one might notice at this point, most of the controls in the weather panel are of no use, or even outright harmful for dynamic weather editing. The only two controls that really matter are the field that selects the current pressure front, and the pressure deviation field. In addition, time, temperature, fog and dust can be interesting, but are not tied to the dynamic weather as such.

Wind flags

Mission editor wind indicators

The more important part of the weather UI is actually the wind overlay that shows up on the map whenever the dynamic weather tab is open. This overlay shows a coarse (roughly one sample point per 125km) map over wind strengths and directions using a set of rounded flags.

These flags are essentially arrows, with the round dot being the tip that points in the direction of the wind, and with the tail-end flag showing the strength using dashes and triangles. A half-dash is a 5kts wind; a full dash is 10kts; a triangle is 50kts. Add up the number of dashes and triangles to read the full wind value.

Preparing a dummy mission

As previously mentioned, dynamic weather is best edited using a dummy mission with the sole purpose of creating and previewing the various pressure fronts and their effects on the local weather. There are a number of benefits to this methodology compared to trying to manipulate an existing mission directly:

  • With only weather data, and perhaps a couple of static objects, the mission will be small, quick to (re)load into the editor, and quick to load for the in-game preview.
  • The mission file that is used for most of the weather editing will also be small, short, and easy to navigate and manipulate in the text editor. It will also be quick and easy to extract and insert into the .miz file (although if the zip too you are using is good, this really should make such a small difference as to be imperceptible).
  • You can experiments with all kinds of static objects (mostly smoke effects, wind socks) without cluttering up the unit data base and unit name dictionary.
  • With only a handful of static objects to care about in the mission, you can use F12 to quickly cycle through different sites of interest on the map and check that the weather behaves the way you want at all those locations.
  • Similarly, you can play around with numerous trigger zones without the risk of interfering with ones that are tied to actual mission triggers.

When all is said and done, you will simply end up with a weather preset that can be loaded into any existing or in-the-making mission, where only the weather data transfers without any of junk editing “scaffolding” that was employed to create that setup.

The setup of the dummy mission is as basic as it gets:

  1. Select the terrain you want to use. You can load weather profiles across different terrains, but the difference in coordinate systems will invariably make the weather appear in the wrong place.
  2. Clear the coalition list and just add one red and one blue coalition member — Russia and the US being the most obvious and flexible choices.
  3. Create the mission and save it under some clever name, such as “dummy weather.miz”.
  4. Figure out and set up what date and time you want for your mission. This will be exported with the weather data, and can cause a lot of confusion if you import that setup into a mission where you have set up a completely different starting time — suddenly, the moody autumn dusk mission will be in full summer sunlight.
  5. Figure out the approximate areas of interest where the action will take place and where the weather conditions will matter.
  6. Either place Windsock static structures or use a combination of some other structure alongside static smoke effects (most helpfully with the “big smoke” preset and 0.5 density) at suitable sampling points.
  7. Finally, go into the weather pane, switch to dynamic weather, and create new weather using exactly one (1) system. The results of this creation are wholly pointless and irrelevant since they will immediately be adjusted to something that works.
  8. With all the prep work done, save the mission.

The choice between wind socks and other static structures comes down to whether you just need a quick glance at the rough wind direction and weather condition, or if you want a bit more to go on. Wind socks are single objects that you can quickly move around in the editor if you want to check a new sample site, but they only give rough information about surface winds. For a better idea of how strong the winds are, and if there are any effects from turbulence, you want to use smoke effects, but those are not selectable using the F12 key — instead, you need some other static object near by to cycle to, but this means every time you want to check a new site, you have to move (or place) two objects: the smoke effect and the structure.

In addition, if you want to check the weather at sea, you pretty much have to use smoke effects, but be aware that these can sometimes decide to behave… oddly in relation to the water surface. Attaching them to ships can usually alleviate this, but even this can be buggy and behave strangely at times.

With these simple setup steps and general markers in place, the dummy mission is ready for the actual weather editing, which is mostly done using trigger zones in the editor, and using text editing outside of it.

Using trigger zones to place pressure fronts

The most fundamental problem with dynamic weather editing in DCS is that it completely lacks any interactive component to the visual elements on-screen. The editor will happily show you pressure zones and some vague approximation of their effects, but offers no way to actually interact with them other than changing the pressure differential.

For this reason, we have to resort to the one thing that offers exactly that interactivity and which as luck would have it also operates on the same coordinate systems and (mostly) the same units as the pressure fronts: trigger zones.

Zones can be dragged around and resized with immediate on-screen feedback. You can use them to preview how the fronts will sit in relation to the world and to each other; whether there will be (or should be) any overlaps; and (over time and with experience) get a sense for which areas will be affected by dynamic weather and which will not. You can then use these positions and sizes to adjust the pressure fronts in the mission file and be very sure that the result will precisely match the preview. Or at least precisely enough, with a couple of limitations.

Limitations

Being trigger zones rather than the actual pressure fronts, a couple of inherent limitations to this preview and editing methodology needs to be understood:

  • You obviously do not see the actual wind indicators until after the zone parameters have been transferred to the weather data in the mission file.
  • Trigger zones are always circular, whereas the pressure fronts are actually ovals that can be rotated to point in different directions. Note, however, that the weather previews are also always circular, even for oval pressure systems, which means that the zone display and the pressure front display will agree, but the actual resulting winds will show a different picture.
  • There is no inherent connection between the zones and the weather — it is all done manually — so every change to a trigger zone will require a new round of mission file extraction, editing, re-insertion, and reloading.

Step 1: Editing the trigger zone(s)

Step 1: Editing the trigger zone.

The procedure for editing multiple pressure fronts is exactly the same as for a single front, only you do it many times over, so this first step-by-step will only discuss a single front (which is also what the dummy mission is set up with per the steps described above).

To start with, place a single trigger zone in the mission. The centre of the zone will generally be the calmest and clearest portion of the pressure front — the proverbial eye of the storm. Adjust the size of the zone to something appropriate. Note that the zone editor pane shows the radius in feet, whereas the trigger zone list pane shows the radius in meters. The latter is the more relevant number to know, and as previously mentioned, luckily you can have both panes active at once. As a general approximation, 330,000 ft ≈ 100 km ≈ 54 nm.

As noted in the section on pressure spreads, clouds will start forming roughly two thirds of the way from the centre to the indicated radius — as the pressure differential increases, they will spread from, and gain more coverage, radiating both inwards and outwards from this band. Also note that the actual area affected will have roughly twice the indicated radius.

Finally, give the trigger zone a good descriptive name. In the text editor, it will be easy to equate “zone #1” with “cyclone #1”, but neither will be indicated in mission editor. Thus, giving the zone a numbered name and that name will show up in the editor, making it clear which area is being manipulated.

Step 2: Extracting the mission file

Step 2 (and 4): Extracting the ‘mission’ file.

With everything set up and saved, you need to get your hands on the ‘mission’ file — a Lua file (without the .lua extension that would immediately identify it as one) contain within the .miz you just created.

There is no need to close the editor (much less DCS as a whole) down since you will soon be back in it. Doing so just wastes time, so just alt-tab back and forth between your different tools.

Navigate your way to where your missions are stored — usually in %USERPROFILE%\Saved Games\DCS\Missions — and open up the file with your handy zip manipulation tool. The image shows a partial screen from Total Commander, which seamlessly opens up and manipulates compressed archives as if they were any other directory. Right in the root of the .miz you will find the the file simply named “mission”. Extract the mission file to a handy location and open it up in your text editor. Again, there closing anything down at this point is just a pointless waste of time since you will be using it again soon.

Step 3: Editing the mission file

Some editors will try to guess the syntax highlighting based on what the code looks like; some will not and you need to tell them what kind of code you're looking at. In Notepad++, the highlight selection is manual but will stay persistent as long as you leave the editor and file open (and once again, there is never any reason to close anything). When you repeat the process to further edit the weather data and extract a new version of the mission file, Notepad++ will notice that it has changed and prompt for a reload, retaining the code highlighting rule you have already set for that file.

Step 3: Editing the ‘mission’ file.

In the mission file, you are looking for two specific Lua arrays: the one named “weather” and the one named “triggers”. In the first, you are looking for a sub-array named “cyclones”,and similarly in the second case, you are looking for the sub-array named “zones” — each containing numbered lists of (surprise) weather systems and trigger zones, respectively.

As a first step, the aim is to align the pressure systems (cyclones) with the trigger zones. Simply copy the “x”, “y”, and “radius” values from the a numbered zone into the “centerX”, “centerZ”, and “pressure_spread” values, respectively, of the same-number cyclone. For good measure, you might also want to truncate the values to whole numbers — these three values are all given in meters, but will commonly have anywhere between four and eight decimals. You don't actually need nanometer precision on your weather, so cutting out the decimals generally makes the selection and copy-pasting a lot easier.

Note the slight oddity that the “y” zone coordinate translates into the “centerZ” cyclone coordinate, indicating that there is a hidden centerY that we are not dealing with here. Trigger zones are infinitely high cylinders, so they only need a 2D coordinate system. Weather is apparently expressed using three coordinates, but one is not in use. Presumably, centerY would be used to dictate the height of the pressure system, but adding it makes no difference to the end result.

Also note that the zone name can be seen in the numbered array, which further helps us keep track of which zone corresponds to which pressure system. If the name does not line up with the array number, you can change the zone name right here so as to avoid any confusion in the future. In the illustration, zone #1 is named “WZ1” (weather zone 1), and its parameters are transferred to cyclone #1.

Here, you can also edit other cyclone parameters such as pressure differential, shape, and rotation, but those will be discussed further on down. For this preliminary exercise, simply copying the zone values is enough. Save the mission file, and (again) just leave it open.

Step 4: Re-inserting the mission file

Go back to the zip manipulation tool and do the reverse of the extraction process. Take your newly edited mission file and copy it back into the .miz file. Unlike the text editor, DCS' mission editor will have no idea that this happened, so back in DCS you have to simply reload the mission completely by selecting Load Mission and picking the exact same file again.

Since, from DCS' perspective, you just saved the file and made no further edits to it you should see no warnings about losing data (these will show up if you did anything to the mission in the editor after you last saved it). The mission will load and if all has worked as it should, you should see no difference except if you changed the names on the trigger zones.

Step 5: Previewing and editing winds

Step 5: Manually edited weather.

The difference will instead be seen as you open up the weather pane. Where before, you had a large, randomised, indistinct grey blob that most likely covered all of the map, you will now have one (or more, if doing a multi-system weather setup) greyed-out area(s) that perfectly matches the outline of the trigger zone(s) you've created, and wind flags circling these pressure system.

Since the trigger zone names now match the pressure system numbering, you can use the system selector (the left-hand box on the system quantity line in the dynamic weather pane) to identify and select which weather front you want to edit. This allows for the only interactive part of dynamic weather manipulation the mission editor has to offer: changing the pressure differential for the selected cyclone. You can experiment with different pressure values or see the section on pressure excess to try to aim for a specific result.

For now, the basic rules to remember are:

  • Negative pressure differentials create “cyclonic” systems — low-pressure fronts, with winds spiralling around the area counter-clockwise.
  • Low-pressure areas generate clouds and, if the clouds are dense enough, precipitation.
  • Positive pressure differentials create “anti-cyclonic” systems — high-pressure fronts, with winds spiralling around the area in a clockwise direction.
  • High-pressure areas do not generate clouds or precipitation, but can be placed inside low-pressure zones to thin out, or completely cancel out, the clouds and winds they generate.

When the wind flags look sensible enough, save the mission.

Step 6: In-game review

Step 6: End result in-game.

Use the regular “fly mission” button to preview the results in-game. Since the mission only contains static objects, you should immediately be kicked into the external view, looking at one of those objects. Cycle through them using F12 and observe the local weather, notably the behaviour of wind (indicated by smoke or by wind socks) and the presence of cloud coverage and precipitation.

At a later stage, you may also want to add aircraft in so you can check how the weather affects ATC behaviour — what runways are open, and what ILS systems (if any) are active given the conditions you have just created?

Note that it takes a couple of simulation ticks for the weather to settle down into its final form, and you will commonly see precipitation going in one direction at very sharp angles but see smoke in the background lazily float around in a different direction in the background. Usually, the precipitation is a bit over-excited at first, but will soon start to agree with the smoke in terms of wind direction and strength.

With these observations in hand, figure out if you have the results you want. Is the cloud coverage ok? Are the winds of the right strength? Are they blowing in the expected direction? Et cetera. This serves as the basis for starting the process over: tweaking the placement of the trigger zones, re-extracting the mission file and reloading it in the text editor, copying the updated zone coordinates to the weather systems and re-importing the mission file, and finally reloading the mission to tweak and review the pressure differentials for the pressure zones.

Manipulating pressure fronts

Creating multiple weather fronts.

Exporting the weather parameters