Outpost Universe Forums

Projects & Development => Projects => Topic started by: Vagabond on July 22, 2017, 07:25:07 PM

Title: OP2 Map Imager (Variable scaled renders of Outpost 2 Maps)
Post by: Vagabond on July 22, 2017, 07:25:07 PM
OP2 Map Imager is a Windows Console application that can render any Outpost 2 map in popular image formats and variable size. Programmed by me and Hooman in C++.

Directions

Download Current Release OP2MapImager Ver 2.0.0 (http://wiki.outpost2.net/lib/exe/fetch.php?media=outpost_2:helper_programs:op2mapimager_ver2.0.0) (Uploaded to wiki since file size exceeds 2MB forum limit)

Possible Future Improvements:

If you have any comments, bugs concerns, suggestions, whatever else, please post or message me or Hooman.

(http://forum.outpost2.net/index.php?action=dlattach;topic=5980.0;attach=842;image)



Readme

OP2MapImager - Outpost 2 Map and Saved Game Imager
Developed by Hooman and Brett208 (Vagabond)

+++ USAGE NOTES +++
  * Capable of saving multiple map files and entire directories.
  * The OP2MapImager executable and FreeImage.dll must be in the same directory as the tileset BMPs.
  * Scale Factor (-s) determines the final render size and represents the final pixel length of a single tile
    * Max Value: 32, renders at full size, or 32 pixels per tile.
    * Min Value: 1, renders at 1 pixel per tile

+++ EXAMPLE COMMANDS +++
  * OP2MapImager mapFilename.[map|OP2]
  * OP2MapImager -s 16 -o -q Ashes.map eden01.map sgame0.op2
  * OP2MapImager --Scale 8 --ImageFormat BMP [Directory of choice]

+++ OPTIONAL ARGUMENTS +++
  -H / --Help: Displays Help File
  -Q / --Quiet: [Default false] Add switch to run application without issuing console messages.
  -O / --Overwrite: [Default false] Add switch to allow application to overwrite existing files.
  -D / --DestinationDirectory: [Default MapRenders]. Add switch and name of new destination path.
  -I / --ImageFormat: [Default PNG]. Allows PNG|JPG|BMP. Sets the image format of the final render.
  -S / --Scale: [Default 4] Sets Scale Factor of image.
  -A / --AccessArchives [Default true]. Add switch to disable searching VOL archives for map and well files.

For more information about Outpost 2 visit the Outpost Universe (http://outpost2.net/).
Image Manipulation accomplished through FreeImage (http://freeimage.sourceforge.net/).


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +


+++ INSTALL DIRECTIONS +++

Ensure OP2MapImager.exe, FreeImage.dll, and well0000.bmp through well0012.bmp are all in the same directory. (I typically put them all in the root OP2 install directory for ease of use, but not required.)

Open a command prompt. Navigate to the directory with MapImager.exe and type 'OP2MapImager -h'.


+++ OUTPOST 2 TILESETS (WELL00XX.BMP) +++

The original tileset images shipped with Outpost 2 use a special format that prevents them from being opened by typical pixel image manipulation software (like Gimp or Paint). However, Outpost 2 is capable of reading normally formatted 8bpp indexed BMPs.

OP2MapImager contains a copy of the tileset images that have been reformatted from the OP2 specific format to general BMP format. These may be placed in the root directory of Outpost 2 if you wish. They must exist in the same directory as OP2MapImager.exe and FreeImage.dll.

If you attempt to render a map using the original Outpost 2 tileset images, OP2MapImager will throw an error.


+++ ARCHIVE (.VOL) FILE ACCESS +++

By default, OP2MapImager is able to search through .vol archives and pull maps or tilesets out of the .vol files.

Unless the AccessArchives flag is disabled, OP2MapImager will first search the supplied directory, and if it cannot find the file of interest, then it will search alphabetically through all .vol files in the directory for the given file. If the file exists both loosely in the directory and in a .vol file, the copy not in the .vol file will be used.
Title: Re: OP2 Map Imager (Variable scaled renders of Outpost 2 Maps)
Post by: Vagabond on July 24, 2017, 09:01:30 PM
I'm already releasing version 1.0.1 of the OP2MapImager.

While reveling in the enjoyment of using the finished product, I realized when rendering all maps in the directory, it would crash by trying to render SGAME10.OP2 (which really isn't a saved game at all). A few other bugs were also cleaned up. The new download is available on the first post of this thread.

Ver 1.0.1 (23Jul2017) Change Log
 * Prevented creation of multiple renders of the same map if the map exists in multiple places in the same directory (IE both loosely in directory and in an archive).
 * When imaging all maps & saved games in a directory, prevented selection of wellpallet.map and SGAME10.OP2 since they are not valid maps.
 * Fixed typos in ReadMe.
 * Added Changelog.
Title: Re: OP2 Map Imager (Variable scaled renders of Outpost 2 Maps)
Post by: leeor_net on July 24, 2017, 09:17:08 PM
Dontcha just love finding those kinds of bugs?  ::)

Anyway, I failed to mention it earlier. This is awesome. Your work is appreciated!
Title: Re: OP2 Map Imager (Variable scaled renders of Outpost 2 Maps)
Post by: Hooman on July 25, 2017, 04:32:18 AM
Indeed. You did a really nice job of pushing his through to completion.
Title: Re: OP2 Map Imager (Variable scaled renders of Outpost 2 Maps)
Post by: lordpalandus on July 25, 2017, 08:28:39 AM
Question:

Will it also output an image of the map, after all the volcanoes have blown up and released their lava to their predetermined spots?
Title: Re: OP2 Map Imager (Variable scaled renders of Outpost 2 Maps)
Post by: Hooman on July 25, 2017, 11:31:55 AM
It supports reading maps from saved game files, so yes, it should show that if you have a saved game file from the right point in time.
Title: Re: OP2 Map Imager (Variable scaled renders of Outpost 2 Maps)
Post by: Vagabond on July 25, 2017, 02:01:39 PM
Quote
Will it also output an image of the map, after all the volcanoes have blown up and released their lava to their predetermined spots?

Quote
It supports reading maps from saved game files, so yes, it should show that if you have a saved game file from the right point in time.

Exactly, the mapImager will render lava. Anything represented by a tile from the well tile sheets will be displayed on the save game renders.

So you will get rubble, walls, tubes, bulldozed ground, scorch marks, and lava.

You will not get any graphic not represented by a well tile sheet. So no buildings, mining beacons, vehicles, natural disasters, etc.

Check out the attached file for an example (need to be logged into the forum to see it). I just played about 10 minutes of the colony game Eden Starship and saved. It will show how lava, bulldozed tiles, tubes, rubble, etc will appear.



Side Note:
I noticed all the map images attached to a saved game are represented by 1 pixel per tile renders. If the tile is a building/unit of a player, the pixel representing the root location of the building/unit is filled in with that player's color. If it is a mining beacon, the space is filled in with a white pixel.
Title: Re: OP2 Map Imager (Variable scaled renders of Outpost 2 Maps)
Post by: Vagabond on October 12, 2017, 11:04:29 AM
I just posted version 2.0.0 of the OP2MapImager. This is version 2 since the way relative directories are handled has been switched to using the . or ./ syntax. (It was just / earlier), which is a breaking change.

See below for full list of changes.

As always, if anyone encounters any bugs or wants to just post about their experience with the application, I am happy to hear about it.

Ver 2.0.0 (12Oct2017)
  * Fixed crash if supplying an empty variable ("") for a command via the command prompt.
  * Changed method to provide current directory to use either '.' or './' instead of '/' or '\'.
  * Made the function XFile::replaceFilename platform agnostic.
  * Fixed typos in ReadMe.txt.
  * Removed namespace using statements from header files.
  * Removed Microsoft specific exception classes.
  * Removed Microsoft specific for each loops and replaced with C++ standard range loops.
  * Fixed crashing bug when attempting to render a map outside of the application's current working directory.


-Brett