Difference between revisions of "Exporting MFCD Displays"

From DCS World Wiki - Hoggitworld.com
(MonitorSetup editing)
m (Resources)
(6 intermediate revisions by one other user not shown)
Line 13: Line 13:
  
  
==== .Editing program for .lua ====
+
==== 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.
+
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. This means that the file may become corrupted or unreadable in the eyes of the program using the .lua file if edited with the default Windows notepad (or equivalent program primarily designed for text editing).
  
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. [https://notepad-plus-plus.org/download/v7.6.2.html Notepad++ can be obtained here.]
+
As such we instead recommended 'Notepad++' (or any other program primarily designed for code editing, called IDE - Integrated Developer Environment) 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. [https://notepad-plus-plus.org/download/v7.6.2.html Notepad++ can be obtained here.]
  
 
----
 
----
Line 36: Line 36:
 
     ["multiMonitorSetup"] = "1camera",
 
     ["multiMonitorSetup"] = "1camera",
 
to restore it to the default DCS View.
 
to restore it to the default DCS View.
 
  
 
==== MonitorSetup Overview ====
 
==== MonitorSetup Overview ====
Line 115: Line 114:
 
     --
 
     --
 
     UIMainView = Viewports.Center
 
     UIMainView = Viewports.Center
 +
 +
  
 
==== Multiple screens ====
 
==== Multiple screens ====
 +
 +
For running multiple screens we will first need to adjust the resolution accordingly, so that DCS can make use of all the screens you wish to make use of. By default, DCS only uses the primary (#1) monitor tied into that computer / Windows: so we need to tell it to make use of your other screens as well.
 +
 +
This requires you to do a bit of calculation, as we need to calculate the overarcing resolution by adding up the screen resolutions (as DCS effectively merges them into 1 large screen for all intents and purposes). Some examples to illustrate this point:
 +
 +
<gallery widths=300px heights=300px>
 +
File:Side by side monitors.png|none|alt=Alt text|Side by side monitors
 +
File:Side by side monitors.png|none|alt=Alt text|Mismatching screens #1
 +
File:Side by side monitors.png|none|alt=Alt text|Mismatching screens #2
 +
</gallery>
 +
 +
To calculate our overall width and height, simply add up the relevant values.
 +
 +
1. For our side by side monitors, we add up the two widths (both are 768) to get our total width of 1536 pixels (2 * 768). The total height is equal to a single height, so 1024 pixels.
 +
 +
2.
 +
 +
3.
 +
 +
  
  
Line 131: Line 152:
  
 
[https://forums.eagle.ru/showthread.php?t=87104 Adding custom resolution templates to DCS]
 
[https://forums.eagle.ru/showthread.php?t=87104 Adding custom resolution templates to DCS]
 +
 +
[https://www.reddit.com/r/hoggit/comments/az3i7q/kneeboard_position_on_multiple_monitors_which/ Has exporting to a second or third monitor messed up your kneeboard?]
  
 
----
 
----

Revision as of 16:31, 6 August 2020

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. This means that the file may become corrupted or unreadable in the eyes of the program using the .lua file if edited with the default Windows notepad (or equivalent program primarily designed for text editing).

As such we instead recommended 'Notepad++' (or any other program primarily designed for code editing, called IDE - Integrated Developer Environment) 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).

A more suitable DCS setup, with overlapping MFCD's

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 the one listed below. 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.

In a similar fashion we can have multiple instruments / screens from different aircraft overlap one another: as you cannot be in more than 1 aircraft simultaneously only the relevant instruments / screens from that aircraft will be drawn / rendered.

    _  = 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


Multiple screens

For running multiple screens we will first need to adjust the resolution accordingly, so that DCS can make use of all the screens you wish to make use of. By default, DCS only uses the primary (#1) monitor tied into that computer / Windows: so we need to tell it to make use of your other screens as well.

This requires you to do a bit of calculation, as we need to calculate the overarcing resolution by adding up the screen resolutions (as DCS effectively merges them into 1 large screen for all intents and purposes). Some examples to illustrate this point:

To calculate our overall width and height, simply add up the relevant values.

1. For our side by side monitors, we add up the two widths (both are 768) to get our total width of 1536 pixels (2 * 768). The total height is equal to a single height, so 1024 pixels.

2.

3.



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. Recall that only instruments / screens from the current aircraft will be drawn rendered, so you can stack multiple instruments / screens from different aircraft in one location.


Resources

How to add Viewports to any instrument

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

Adding custom resolution templates to DCS

Has exporting to a second or third monitor messed up your kneeboard?



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.