A guide to reduce your Custom Overlay file sizes.

Moderator: MOD_Command

Post Reply
User avatar
brassem
Posts: 72
Joined: Wed Oct 02, 2013 3:38 am
Location: NE of YMML

A guide to reduce your Custom Overlay file sizes.

Post by brassem »

A guide to reduce your Custom Overlay file sizes for Command Modern Air/Naval Operations.


6th October 2013. Version 1.00
1st November 2013. Version 2.00 Revised after viewing Tomcat84's tutorial.
4th April 2018. Version 3.00 New graphics after Photobucket extortion.

Introduction.

The feature of adding custom overlays to missions in this game will prove to be a significant benefit to the both the player and mission creator. However the game scenarios can cover some very large areas, to cover these with overlays will result in very large file sizes in the Gigabyte range that will crash the game. I hope the technique in this guide will allow users to get their overlay file sizes down to manageable levels while working within the game limits. The user will still have to be prudent on how they want detail added by the custom overlay, at the cost of file size. In this example GMAP is used to create a user defined Custom Overlay.

The process described here in this guide is a simple graphics technique of reduce and expand, at the cost of image quality, applied to CMANO Custom Overlays. This is very much a work in progress as the game evolves. The ingame tutorial used as the basis for this guide is: Basic Training Air Operations, 1983.scen. In this guide we will add some more detailed images to the map terrain of this scenario. Tactical and Mission critical detail can also be added.

Requirements.

You will need to know how to change image file sizes in a graphics application. If you do not, then don’t continue.
If you are running a 32bit computer, expect longer times and even lockups as the system tries to juggle large data chunks. If you have low disk space, don’t continue.

A graphics program where you know how to scale a png image. In this example Photoshop CS4 64bit is used.
GMAP. http://greatmaps.codeplex.com/ Just for the fact that you can create reference images that can be used as a guide to building a custom facility.
Low level text editor. Do not use Word as it adds un-needed data to the file.
Calculator.
Patience and determination.

Procedure.

This tutorial is supplementary to the Custom Overlays 101 as provided by the Slitherine Group in their e-book manual. ( 8.3 Custom Overlays 101. Page 121 ). It is assumed that you have GMAP installed and working. The game state used in this tutorial is Command v1.01 Release Candidate 2 (Build 439).
The Custom Overlay feature works as described. If you add one image and then another, the last loaded will overlay the first. This is where alpha channels and transparency will play a role in the overall graphic effect, so low resolution overlays should be loaded first, while the more detailed high resolution image loaded after. The working steps will then be to work with the detailed images first, followed by general low resolution images later as space will allow. Work in, then out, to see what you are left with.

Tomcat84 has done a brilliant youtube tutorial on custom overlays where he briefly shows the technique as described here for image reduction in video. Near the end he shows a better technique that rids the file of transparency data, that can help even further with file reduction. This video is a must see for overlays! (I am curious to how both techniques zip down. As transparency dead space should compress well.)
Tutorial by Tomcat on Custom Overlays

Ok, Lets get some terrain details in on the Basic Training Air Operations, 1983.scen mission. The known enemy target will be used in this example.

Start the scenario so that the target is revealed and we can use the mouse-over to write down the Global Position coordinates of it.

Image

Pic01.

The general Global Position of the target is N39° 14’ 16”, W118° 14’ 33”. You need to convert this to a decimal coordinate to work with GMAP. You can use websites such as http://www.earthpoint.us/Convert.aspx to do the conversions, which yields 39.2377778° -118.2425000°. Once we have the decimal GP coordinates it will make further work easier.

Load up gmap and type those new GP coordinate values in. (Bing satellite view)
The red cross will be the location of the coordinates that you typed in. Zoom in to get a good overall picture on the screen of what you wanted to capture. Then drag out a box (plus Alt key) to the area you think would encompass the red targets. Start from the top left corner and drag down to the bottom right. The top left corner will be the actual reference coordinate used in the .pgw file. By how much you dragged across and down will be the scalars in the .pgw file.

Image

Pic02.

Click the [Get Static] button on the right panel. In the new pop up box, tick the make world file box and set zoom to 17. Click the [Generate] button and prepare to wait while GMAP does its stuff. The dialog box reported 1 of 1054. This is not going to take a lot of time.
After a few seconds there is a .png and .pngw file on the desktop. Renamed and moved to the tutorial directory. The .png file is the graphics file while the renamed .pgw file is the Global Position data text file.

Image

Pic03.

The .png image file of the selected area is 98MB. It needs to be 3MB or less without sacrificing too much image detail. The ingame image is;

Image

Pic04.

This zoom level is good. You can determine what targets need to be taken out on a unit basis to effectively shut down this facility on what you actually see. Unfortunately the file size is too large for this simulation programme to handle in quantity.

What we reduce in image we increase in scale factor.

In your graphics programme, you load up this .png file. Apply a 50% reduction in file size and save.

Image

Pic05

We are going from 163MB to 40MB (in Photoshop it adds the alpha layer so file sizes are increased as it processes). The red arrow shows the origin of the GP image as defined in the .pgw file. By reducing the image we have shrunk the image size by 50%, yet lost 75% of the actual data using the graphics programme algorithm. The quality of the compression is a factor of what programme you are using.

Image

Pic06.

The image is way off! How do we correct it? The answer is in the .pgw file. The contents are;

Image

Pic07.

In this particular case, the structure of the .pgw file is;

01 Latitude Scale Factor
02 Top Left Hand Latitude (Offset?)
03 Top Left Hand Longitude (Offset?)
04 Longitude Scale Factor
05 Top Left Hand Longitude actual Global Position location
06 Top Left Hand Latitude actual Global Position location

Because the image was reduce by 50% the scale factor must be doubled.
The lines 01 and 04 get doubled and edited into the .pgw file. That yields for the file contents of;

0.000021457672
0.0000000
0.0000000
-0.000016620316
-118.284130096436
39.264290857282

After reloading the CO ingame, it shows that the quality is still there but with a much smaller file size. Going from 93MB down to 31.1MB in a single hit.

Image

Pic08.

Applying the technique two more times yielded a 1.98MB file. Not as sharp but you would rarely be viewing the game down to this resolution during game play.

Image

Pic09.

If you really want to, use a sharpen filter to bring back some detail lost.

Image

Pic10.

After using smart sharpen in Photoshop

Image

Pic11.

There now is a 8km x 8km Red target area that has a pretty accurate CO.

Image

Pic12.

This was using the GMAP 17 zoom for accurate unit position. To now flesh out the surrounding areas, you can now use a general lower quality zoom factor to create and Underlay. In this example 13.

Image

Pic13

After 10 minutes and 1680 tiles later the .png created is 212MB in size. Using the technique twice yields a 16.5MB image. Plus it appears that there is no shift in location.

Image

Pic14.

RESULTS.

After adding the 13 zoom .png first as the underlay, and then adding the 17 zoom .png custom overlay. Some Ingame action screenshots to see if this all works and if it is necessary to convey the actual warfare being simulated.

Image

Pic15.

Image

Pic16.

Tomcat84 has shown an excellent technique for processing the transparency issue in his video. Although the resultant images might be better cropped further in to reduce dead space and thus image size. Plus he addresses the fact that underlay images of zoom less than 17 are shifted, the actual 17 zoom gmap capture are geographically correct. (Whew!) The zip size comparison may be for another thread.

I hope you get the idea behind the process, it can be applied to all graphics. Many thanks to Warfare Sims LTD, the Slitherine Group and Matrix games for another great simulation game.

Good Hunting.

Brassem.


i7-3930K@3.2Ghz&H100liquid|ASUSP9X79Deluxe>X680/OC|32GBGSkillPC2400|2TBRaid0|Antec1200&1200WTruePower|ASUSGV278H-3D|SBX-FiT-Pro|TurtlebeachDPX21|Win7-64U
Tomcat84
Posts: 1952
Joined: Wed Jul 10, 2013 5:13 pm

RE: A guide to reduce your Custom Overlay file sizes.

Post by Tomcat84 »

Would love to read this. if you PM me i will post the link for you?
My Scenarios and Tutorials for Command

(Scenarios focus on air-warfare :) )
Tomcat84
Posts: 1952
Joined: Wed Jul 10, 2013 5:13 pm

RE: A guide to reduce your Custom Overlay file sizes.

Post by Tomcat84 »

That is unfortunate as I would very much like to know how to reduce the overlay filesize
My Scenarios and Tutorials for Command

(Scenarios focus on air-warfare :) )
User avatar
SilentHunter
Posts: 213
Joined: Sun Sep 29, 2013 1:30 pm
Location: United States

RE: A guide to reduce your Custom Overlay file sizes.

Post by SilentHunter »

me too
Tomcat84
Posts: 1952
Joined: Wed Jul 10, 2013 5:13 pm

RE: A guide to reduce your Custom Overlay file sizes.

Post by Tomcat84 »

Nice!!!! Looking forward to trying this. Also curious about part two as I've been wondering myself if there is a way to blend it in.
Also I wondered if it was possible to use jpg instead of png to reduce size but didn't seem to work
My Scenarios and Tutorials for Command

(Scenarios focus on air-warfare :) )
User avatar
brassem
Posts: 72
Joined: Wed Oct 02, 2013 3:38 am
Location: NE of YMML

RE: A guide to reduce your Custom Overlay file sizes.

Post by brassem »

Going to investigate further. The .png file format has some problems with transparency. I've found .jpg can causes some horrible graphics distortions if the compression is too much. I've never used .jpg ingame so I will report what I find.
i7-3930K@3.2Ghz&H100liquid|ASUSP9X79Deluxe>X680/OC|32GBGSkillPC2400|2TBRaid0|Antec1200&1200WTruePower|ASUSGV278H-3D|SBX-FiT-Pro|TurtlebeachDPX21|Win7-64U
Tomcat84
Posts: 1952
Joined: Wed Jul 10, 2013 5:13 pm

RE: A guide to reduce your Custom Overlay file sizes.

Post by Tomcat84 »

Maybe tga would work for transparency?
My Scenarios and Tutorials for Command

(Scenarios focus on air-warfare :) )
chemkid
Posts: 1238
Joined: Sat Dec 15, 2012 2:02 pm

RE: A guide to reduce your Custom Overlay file sizes.

Post by chemkid »

.
User avatar
JiminyJickers
Posts: 290
Joined: Tue Oct 04, 2011 8:21 am
Location: New Zealand

RE: A guide to reduce your Custom Overlay file sizes.

Post by JiminyJickers »

Thanks, very useful guide.
User avatar
SilentHunter
Posts: 213
Joined: Sun Sep 29, 2013 1:30 pm
Location: United States

RE: A guide to reduce your Custom Overlay file sizes.

Post by SilentHunter »

Brilliant > Brassem < Brilliant

Thank you I was not able to use those huge files previously in Command, but can now using your guide. I'm wanting to convert areas the size of state of Florida in the United States, which Gmap will do at zoom level 13 but no higher due to limitations with GMAP unless you cut down on the size. Command would never load those files, I assume due to the sheer size 700+ MEG. Your process literally cut my 700 Meg file down to 32 MEG and command now loads it without issue. I was basically able to get half of Nevada converted at zoom 13 and loaded in game now which I could not do prior, being able to layer on top more detailed areas at zoom 15 and 17 is exactly what I was hoping for. Good job!

Now, my stretch dream is how do we get whole countries into command at zoom 17 in one shot !
Tomcat84
Posts: 1952
Joined: Wed Jul 10, 2013 5:13 pm

RE: A guide to reduce your Custom Overlay file sizes.

Post by Tomcat84 »

This should really be stickied because it is awesome
My Scenarios and Tutorials for Command

(Scenarios focus on air-warfare :) )
User avatar
brassem
Posts: 72
Joined: Wed Oct 02, 2013 3:38 am
Location: NE of YMML

RE: A guide to reduce your Custom Overlay file sizes.

Post by brassem »

Thanks guys,

If it is to be stickied, could the mods remove my wasted "10 posts before I can link an image" posts.
i7-3930K@3.2Ghz&H100liquid|ASUSP9X79Deluxe>X680/OC|32GBGSkillPC2400|2TBRaid0|Antec1200&1200WTruePower|ASUSGV278H-3D|SBX-FiT-Pro|TurtlebeachDPX21|Win7-64U
Dimitris
Posts: 14772
Joined: Sun Jul 31, 2005 10:29 am
Contact:

RE: A guide to reduce your Custom Overlay file sizes.

Post by Dimitris »

Done [:)]

And thanks!
Tomcat84
Posts: 1952
Joined: Wed Jul 10, 2013 5:13 pm

RE: A guide to reduce your Custom Overlay file sizes.

Post by Tomcat84 »

You didn't actually sticky it though I think? lol [:)]

[edit] it is now :)
My Scenarios and Tutorials for Command

(Scenarios focus on air-warfare :) )
Rudd
Posts: 468
Joined: Wed Jul 10, 2013 10:34 am

RE: A guide to reduce your Custom Overlay file sizes.

Post by Rudd »

Wow! I too had a hard time loading some overlay files and I've been reluctant to try this because of my cpu skill level but this is a really easy way to shrink'em.

for the .png
I'm using paint.net. To resize Image>Resize...> click "By percentage", enter 50%. save

for the .pgw
open with the notepad and double lines 1 and 4. save

It's that easy.

I wish I would of tried this sooner.

Thanks guys


User avatar
darkhelix
Posts: 63
Joined: Sat Mar 26, 2016 2:00 pm

RE: A guide to reduce your Custom Overlay file sizes.

Post by darkhelix »

I have made several overlays for various missions.
Sometimes the map is offset by a small amount but enough that it appears 1cm offset with the border outlines in game.
I know that I can manually (tediously) correct this in the .pgw file but wonder why, if I give coordinates taken from the game, that the overlay is not a perfect match.
Does this have something to do with curvature of the earth or is it something else?
Thanks,
Toby
AgustusGlue
Posts: 1
Joined: Thu Mar 23, 2017 3:09 pm

RE: A guide to reduce your Custom Overlay file sizes.

Post by AgustusGlue »

What a great option. I compress the image in Microsoft Publisher. That converts it from 960 dpi to 96 dpi. Then I just remove a zero from line one and four. It changed a 94 mb image to 1500 kb. It's still in color and still looks pretty decent. Good enough for targeting, anyway.
User avatar
Grouiiik
Posts: 2
Joined: Mon Mar 12, 2018 4:18 pm
Location: France

RE: A guide to reduce your Custom Overlay file sizes.

Post by Grouiiik »

Hi all,

I have modified GMap Net to adapt it to Command.

I can't post sites url yet, so :
it's on github
/Grouiiik/greatmaps/releases

New functions are :
Same Latitude and longitude format as in the game
BingSatelliteMap selected by default
You can choose a destination folder
Both generated files have the right extension
The image is automatically resize, with max size, and the Global Position data text file change accordingly !

I hope it will help you making faster overlays.

If you have advices, i will take them all !

And sorry for my english...
User avatar
ClaudeJ
Posts: 754
Joined: Wed Mar 08, 2006 5:38 pm
Location: Bastogne

RE: A guide to reduce your Custom Overlay file sizes.

Post by ClaudeJ »

Hey there,

I'm still getting up to speed with CMO (with I'm having so much fun right now, it feels like catching up with an old friend).

Are custom overlay files still a thing in CMO ?
Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz, NVIDIA GeForce GTX 1650 4 Go, Windows 10 64bits, 32 GB RAM, Regional settings = French, Belgium
(Previously known as JanMasters0n)
Post Reply

Return to “Useful Material”