The Power of Overlays

One of the great things patch 1.07 added to the game was the possibility to load several layers of overlays automatically and an easier way to build a package to distribute them together with your scenarios. Overlays make the game more beautiful and add a great amount of immersion to the game.


To make great looking overlays you need four things:

  1. GMap.Net
  2. An image editing program
  3. A text editor
  4. The game

When you are about to make overlays for a scenario, you most likely already have Command installed. Baloogan has modified GMap.Net specially for use with Command. His version can be found here: Baloogan’s GMap. As an image editing program I use GIMP. GIMP is free and can be downloaded here. To edit the .pgw files you can use every text editor but personally I prefer Notepad++.

Making the Overlays

When you want to make Overlays with several layers it is important to know which areas are to be covered by the scenario and where the player will zoom in to see more details and how much details he might want to see.
At the moment I prefer making up to five layers of overlays where necessary, with an increasing level of detail.

Getting started

Start up Command and load the scenario you are interested in, or create a new blank scenario, to get an overview over the Area the overlays are supposed to cover. Now start GMap and scroll to the Area you need.

Overlay GMap overlays

Of course a map doesn’t look good as an overlay but it makes orientation easier. To create your first overlay switch to one of the satellite views (1). I prefer BingSatelliteMap. After that click at “Get Static” and adjust the zoom level. Starting at Level 9 is a good idea when you want to cover a bigger Area without too much detail. Be careful a bigger area increases the risk that the overlay doesn’t fit.

Overlay GMap 2 overlays

Once you are are satisfied click “Generate” This will create two files at your desktop (‘.png and ‘.pgw’). To test if everything went right go to Command and load the overlay.

Overlay CMANO 1 overlays

After this continue to make overlays at different zoom levels. I like to use the levels 9, 12,13,14 and 15. In my example I am interested in Hamburg in general and the Hamburg Airport in particular. You can of course use every combination of zoom levels but be careful: with higher zoom levels the files can become very big very fast. This is not so much a problem as long as you only want to use the overlays yourself but it is problematic when you plan to share your work with others. The size of the files in the example is at this point 66mb.

Overlay CMANO 2 overlays

This already works but looks a little bit too artificial. To change that you can use GIMP. Open the overlays one after another and

  • Use the “free select tool” (1) to cut everything away you don’t want.
  • Click at: “Alpha to selection” (2, right click),
  • Select, “Shrink”, (3, right click)
  • Select “Feather”. (3, right click)

Gimp 1 overlays

This reduced the file size to 56mb and is a good opportunity to rename the files to something more convenient. It makes loading the overlays easier. They have to be named in a certain order since the overlay loaded last will be placed over the overlays loaded before. I use the following pattern: “0_Hamburg1.png, 1_Hamburg2.png,…” The first number represents the zoom level if you have made several files with the same level. It is important that the corresponding .png and .pgw files have the same name.
Now we should take a look at what we have achieved:

CMANO2 overlays

This looks like something we can use for a scenario.

Adjusting the Size

56mb is not a suitable size for distributing the files to others. An easy way to reduce the size of the files without loosing too much details is the “scale image” feature of GIMP. Rescaling the pictures by 50 percent reduces the file size to 10.2mb.
After those changes it is important to edit the .pgw files accordingly. You can open the files with Notepad++ or every other text editor. The first and the fourth line have to be doubled.

The magic of Lua

As mentioned before, one of the features introduced with 1.07 was the possibility to use Lua to load overlays using an event. This and the ability to make a package makes using and distributing overlays much easier.

 Preparing the overlays

First make sure your game does have the “Command Modern Air  Naval Operations\AttachmentRepo” directory. Load an existing scenario or create a new blank one. Go to “Editor->Scenario Attachment” (1). A new window will open. Click at “Create new, Type of: Map Overlay (Single Image)” (2). Load one of the overlays and repeat the step for every file. The game will save the files in the AttachmentRepo folder.

Package1 overlays

You can skip the next step but it makes writing the script easier, especially when you have already other attachments in the AttachmentRepo directory.
Go to “editor->Package scenario for distribution”. A .zip file will be created in the directory you saved the scenario. Unpack the “attachments” folder. This way it is easier to find the GUID used in the Lua script.

Setting up the event

The best way to load the overlays is an event using the “scenario is loaded” trigger. It is important to set the event to “Event is repeatable”.
To Load the overlays the triggered event needs an action. The action is the Lua script. Insert “ScenEdit_UseAttachment(‘AttachmentNameOrID’)” for every overlay you want to load. To find the GUID go back to the “attachments” folder you unpacked earlier. The important part is to load the overlays in the right order. Search for the “0_Hamburg1.png” and copy the name of the folder, for example “ac15fb3a-d2c1-45c9-91f7-e4deb7a4991c”. Repeat that for every overlay. Your script should look similar to this:


Testing the package

Delete the .zip you created earlier and repeat the steps to build a package for distribution. Now delete to contend of the AttachmentRepo. Unpack the newly created .zip and load the scenario. The event should fire and the overlays appear automatically.

Using the package

Using the package is similar to the last step above. Just unzip the files into any directory and load the scenario. The attached overlays will be moved into the AttachmentRepo and be loaded every time the scenario is started.