Difference between revisions of "Exporting MFCD Displays"

From DCS World Wiki - Hoggitworld.com
(MonitorSetup editing)
Line 71: Line 71:
 
     aspect = screen.aspect / 3;  -- screen aspect: screen.width/screen.height by default
 
     aspect = screen.aspect / 3;  -- screen aspect: screen.width/screen.height by default
 
     }
 
     }
 +
    UIMainView = Viewports.Center
  
Similarly for the Left and Right MFCD (LEFT_MFCD and RIGHT_MFCD) viewports we find that these hold a start x and y point, as well as a width and height settings. These work similar to the examples listed above for the center viewport, except they do not have aspect or default viewpoint directions (as you can only view them headon, per their representation in the cockpit).
+
Similarly for the Left and Right MFCD (LEFT_MFCD and RIGHT_MFCD) viewports we find that these hold a start x and y point, as well as a width and height settings. These work similar to the examples listed above for the center viewport, except they do not have aspect or default viewpoint directions (as you can only view them headon, per their representation in the cockpit). Finally, the 'UIMainView = Viewports.Center' tells the .lua file where to place the Radio / JTAC UI in DCS; if not specified it will be placed all the way to the right (and thus may be obscured).
  
 +
By altering the values we can alter the sizes and position of the various elements present in our DCS client. For example, a more reasonable MonitorSetup.lua with both MFCD's would be:
 +
 +
    _  = function(p) return p; end;
 +
    name = _('MFCD');
 +
    Description = 'More suitable?'
 +
    Viewports =
 +
    {
 +
        Center =
 +
        {
 +
          x = 0;
 +
          y = 0;
 +
          width = screen.width;
 +
          height = screen.height;
 +
          viewDx = 0;
 +
          viewDy = 0;
 +
          aspect = screen.aspect;
 +
        }
 +
    }
 +
    --
 +
    LEFT_MFCD =
 +
    {
 +
    x = 0;
 +
    y = screen.height - 300;
 +
    width = 300;
 +
    height = 300;
 +
    }
 +
    --
 +
    RIGHT_MFCD =
 +
    {
 +
    x = screen.width - 300;
 +
    y = screen.height - 300;
 +
    width = 300;
 +
    height = 300;
 +
    }
 +
    --
 +
    UIMainView = Viewports.Center
 +
 +
[[File:MFCD embedded.png|thumb|right|A more suitable DCS setup, with overlapping MFCD's]]
 +
 +
Note that the MFCD's (with height & width of 300 pixels) are overlapping the main screen: they get rendered over top because we specified them last. This can be both helpful and annoying, so plan ahead how you want to setup your Monitor.lua.
  
 
==== Viewports ====
 
==== Viewports ====

Revision as of 02:13, 3 January 2019

Exporting your displays / screens from inside the cockpit is a great way to more easily available information to you: you can forego the need to zoom in and look at the various screens (Multi Function Displays, Radar Warning Receivers) and instead have them on separate monitors always available to you!


Monitor Setup via .lua file

By far the most robust and future proof method of setting up display export(s) is to edit and use the MonitorSetup.lua file located in your DCS World install path. A monitor setup file holds the position for the various screens you want to export and view from the DCS client: these files use the .lua language which can appear daunting at first, but is in fact rather simple and convenient once you get to know it.


.Editing program for .lua

Before we delve any further into opening and editing .lua files, let us first ensure that we have an appropriate (.lua) editor installed. Although the default Notepad shipped with most Windows installations may seem like a fitting program to use, Windows Notepad messes with the order and syntax ('spaces and lines/enters') within a file.

As such Notepad++ is instead recommended to use whenever you are editing a file written in programming language(s), as it does not have this flaw of editing the structure of the file. Notepad++ can be obtained here.


These MonitorSetup.lua files can be found (by default) in the DCS World Install location:

   \DCS World (OpenBeta)\Config\MonitorSetup\
Selecting a MonitorSetup.lua inside DCS

You will notice that there are a number of pre-made Monitor Setups available within this folder: we will go over opening and editing these files in a moment.

We can have any number of MonitorSetup.lua files stored in this folder, but we can only run one active MonitorSetup at a time. We can change this in 2 ways:

1) The first method is probably the most convenient and easiest to do, as it involves simply selecting the MonitorSetup within the DCS Settings menu. Open DCS, navigate to the options menu (the little cogwheel at the top) and from the list of available setups select the one you wish to use. Upon selecting the (hopefully) appropriate monitor setup file and clicking 'OK' the selected setup will become active, so be careful not to select the wrong setup file.

2) The second method is a little less convenient, but this method can also be used to restore back to any monitor setup without having to go through the DCS client. This becomes particularly helpful if you have selected the wrong monitor setup by accident and subsequently elements (such as the 'OK' button or the dropdown list) are being hidden off screen. We can change any DCS settings by going to:

   \C:\Users\{Username}\Saved Games\DCS(.openbeta)\Config\options.lua

We can edit any setting in this file to alter the settings in DCS, but for altering the MonitorSetup file used we will want to change the "multiMonitorSetup" entry (either search this with CTRL+F or look it up under the "graphics" tab). You can change this to be any entry corresponding to a file within the \DCS\Config\MonitorSetup\ , but if in doubt the default is

   ["multiMonitorSetup"] = "1camera",

to restore it to the default DCS View.


MonitorSetup Overview

After installing the appropriate Notepad++ or other editor to edit our .lua files, we can now make a MonitorSetup file that corresponds to our own setup. To start, lets copy over an existing MonitorSetup file and rename it so that we have something to start with: let us use the LMFCD+Camera+RMFCD.lua file as an example.

A word of warning: if you fail to rename it to something unique (and instead leave it as LMFCD+Camera+RMFCD.lua(1) ) DCS will do weird stuff if you try to select this setup / profile. So please rename it, possibly to 'MyFirstSetup' or some such.

LMFCD+Camera+RMFCD.lua visualisation

If we open this setup we can see that the screen is split up into 3 different screens, so-called 'viewports'. The most important viewport is our Center, which takes care of our main screen: we also have our left and right MFCD's exported onto the screen. In this setup the monitor is divided into 3 separate (horizontal) areas, which from left to right house the left MFCD, main screen and right MFCD respectively.

The various numbers listed are the coordinate locations in pixels, with X coordinates being drawn from left to right and Y coordinates from top to bottom. Thus (X,Y) = (0,0) is located at the top left of your screen, not the bottom left as you might expect.


Although we could choose to use the pixel values directly, we can also use some in-built commands (also present in the LMFCD+Camera+RMFCD.lua example) to get these values automatically for us. The command 'screen.width' gets the width of our screen, and 'screen.height' gets the total height of our screen: if you play on a resolution of 1920x1080, screen.width would return 1920 and screen.height would return 1080.

Our screen.aspect (also a command we can use, just not that useful) would then be 1.777777778, as it is 1920/1080 (= screen.width / screen.height). We can also use the appropriate mathematical expressions to allocate our 'viewports': in the .lua language you can use the plus +, minus -, divide /, and multiplication * operators.


MonitorSetup editing

The use of the .width, .height and .aspect commands allows for a nice dynamic scaling, as you do not have to calculate all the various pixel distances (widths and heights). It even allows for some (limited) interchangeability between different resolutions and screens.

If we (again) look at the LMFCD+Camera+RMFCD.lua MonitorSetup we find the following code, which sets up the 3 viewports according to the images shown.

   Center =
   {
   x = screen.width / 3;         -- Left side will start at this X point for the in-game resolution
   y = 0;                        -- Top side will start at this Y point for the in-game resolution
   width = screen.width / 3;     -- Width of the center viewport inside the game resolution
   height = screen.height;       -- Height of the center viewport inside the game resolution
   viewDx = 0;                   -- Horizontal default viewpoint direction
   viewDy = 0;                   -- Vertical default viewpoint direction
   aspect = screen.aspect / 3;   -- screen aspect: screen.width/screen.height by default
   }
   UIMainView = Viewports.Center

Similarly for the Left and Right MFCD (LEFT_MFCD and RIGHT_MFCD) viewports we find that these hold a start x and y point, as well as a width and height settings. These work similar to the examples listed above for the center viewport, except they do not have aspect or default viewpoint directions (as you can only view them headon, per their representation in the cockpit). Finally, the 'UIMainView = Viewports.Center' tells the .lua file where to place the Radio / JTAC UI in DCS; if not specified it will be placed all the way to the right (and thus may be obscured).

By altering the values we can alter the sizes and position of the various elements present in our DCS client. For example, a more reasonable MonitorSetup.lua with both MFCD's would be:

    _  = function(p) return p; end;
   name = _('MFCD');
   Description = 'More suitable?'
   Viewports =
   {
        Center =
        {
         x = 0;
         y = 0;
         width = screen.width;
         height = screen.height;
         viewDx = 0;
         viewDy = 0;
         aspect = screen.aspect;
        }
   }
   --
   LEFT_MFCD =
   {
    x = 0;
    y = screen.height - 300;
    width = 300;
    height = 300;
   }
   --
   RIGHT_MFCD =
   {
    x = screen.width - 300;
    y = screen.height - 300;
    width = 300;
    height = 300;
   }
   --
   UIMainView = Viewports.Center
A more suitable DCS setup, with overlapping MFCD's

Note that the MFCD's (with height & width of 300 pixels) are overlapping the main screen: they get rendered over top because we specified them last. This can be both helpful and annoying, so plan ahead how you want to setup your Monitor.lua.

Viewports

Here are all the varying items you can viewport by default: please reference the resources links on how to export more items to viewports.


Resources

How to add Viewports to any instrument

Dummies Guide for the MonitorSetup.lua by FrankP (Nice images!)

Adding custom resolution templates to DCS



Ultra MFCD

Umfcd in Action

Ultra MFCD is an easily configurable tool for zero configuration MFCD exports to any monitor that your OS sees

It works with multi-monitor setups, works with touchscreens, visit the page in the link above to see all of it's available features.