From: NE of YMML
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.
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.
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.
Patience and determination.
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.
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.
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.
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;
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.
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.
The image is way off! How do we correct it? The answer is in the .pgw file. The contents are;
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;
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.
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.
If you really want to, use a sharpen filter to bring back some detail lost.
After using smart sharpen in Photoshop
There now is a 8km x 8km Red target area that has a pretty accurate CO.
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.
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.
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.
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.
< Message edited by brassem -- 4/4/2018 12:48:23 AM >