MAPGEN (A WITP:AE Map Dumper/Repacker)

Please post here for questions and discussion about scenario design, art and sound modding and the game editor for WITP Admiral's Edition.

Moderators: wdolson, MOD_War-in-the-Pacific-Admirals-Edition

chemkid
Posts: 1238
Joined: Sat Dec 15, 2012 2:02 pm

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by chemkid »

.
User avatar
RyanCrierie
Posts: 1321
Joined: Fri Oct 14, 2005 7:15 am
Contact:

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by RyanCrierie »

ORIGINAL: cardas

I'm not looking forward to editing such a large bitmap either. I got a much newer laptop that is my "main" computer, however I generally do all my graphic stuff on a 10+ year old desktop with 2 GB RAM (and a CRT screen... yeah). From personal experience I can say that it's possible to edit such a large bitmap regardless if you are patient though [>:]

Problem Solved. Problem staying solved.

Image
WITP Mapfile 10: Hex Type

Just coded an automatic split:

Do you want to split the map according to 'canonical' WITP:AE Map Splits? Y/N?

It'll split it according to the numbering for the official WITP:AE mapfiles; and at the same split points.
Attachments
MAPSPLIT.gif
MAPSPLIT.gif (127.72 KiB) Viewed 270 times
User avatar
RyanCrierie
Posts: 1321
Joined: Fri Oct 14, 2005 7:15 am
Contact:

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by RyanCrierie »

BTW, out of curiosity, what's everyone's screen resolution? Is it at least above 1500 x 1500 pixels these days? [&:]
GaryChildress
Posts: 6763
Joined: Sun Jul 17, 2005 3:41 pm
Location: The Divided Nations of Earth

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by GaryChildress »

ORIGINAL: RyanCrierie

BTW, out of curiosity, what's everyone's screen resolution? Is it at least above 1500 x 1500 pixels these days? [&:]

I believe mine is 1920 x 1080. But I'm not very computer hardware savvy.
GaryChildress
Posts: 6763
Joined: Sun Jul 17, 2005 3:41 pm
Location: The Divided Nations of Earth

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by GaryChildress »

Hi Ryan,

How does MAPGEN work? My guess is that I run a python script for each map aspect (terrain type, roads, weather zones, etc.) which will dump the PWHEX data to a PNG file with the types of hexes color coded. From there I change around the colors of the hexes as desired, using the respective pre-set colors for each hex type to create whatever map layout I want for the PWHEX file. Then I repack the PNG image back into the PWHEX file where the program will read the various colors as corresponding hex types for the PWHEX file and alter the PWHEX file accordingly? Is that generally how it works? I'm a little lost right now.

Thanks for any help! And thank you for creating this! [&o]
Dili
Posts: 4713
Joined: Fri Sep 10, 2004 4:33 pm

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by Dili »

I have 1920x1080 which is the FullHD norm, and that is tendency anywhere even more in expensive ones. There are still many 15" laptops with 1366x768, but even with a cheap external monitor can go bigger i think.
User avatar
RyanCrierie
Posts: 1321
Joined: Fri Oct 14, 2005 7:15 am
Contact:

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by RyanCrierie »

Here's a v1 BETA.

It can only dump, but it dumps everything, and has a "split map file" option to split them along stock WITP:AE map file lines, for those of you with weaker computers.

http://alternatewars.com/Games/WITP_AE/ ... 1_Beta.zip

Some notes:

The following folders must exist in the directory that MAPGEN_DUMP.EXE is run from for the program to function correctly:

\GFX with 45 files. These are the graphics documents used to paste/blit the map file image internally to allow this Python 3.4 version to somewhat recover the speed lost over the Python 2.x version following the version change. (the upgrade was necessary in order to make it into a stand alone executable that can be run on computers without python installed).

\DUMP. This is the folder that the program dumps stuff into.

You must have pwhexe.dat within the same folder as MAPGEN_DUMP.EXE or else it'll error out.

Memory Requirements About 400~ MB.

----------

CHANGES TO BE DONE BY NEXT VERSION:

Amphibious Zone
Stack Limit
Weather Zone

all use sort of really light/bright green colors; I'm changing them in future releases to be dark green like Malaria Zone since I don't want to burn out my eyeballs, so be warned when editing those files.

BETTER DOCUMENTATION:

Right now "Manual_MAPGEN.htm" in /Docs is kind of a barebones guide to offsets and variables in PWHEXE.dat. I need to populate it with colors and such; to better help you guys edit the map(s).
User avatar
RyanCrierie
Posts: 1321
Joined: Fri Oct 14, 2005 7:15 am
Contact:

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by RyanCrierie »

Things of note that have occurred to me:

It's now possible, with the development of this codebase to alter the in-game split maps seamlessly. For example, if you wanted to know on-map where every narrow or wide strait was, it could be programmed to do this for you automatically.

Or overlaying red over every malarial zone hex, instead of having to rely on the jump map, etc.
User avatar
RyanCrierie
Posts: 1321
Joined: Fri Oct 14, 2005 7:15 am
Contact:

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by RyanCrierie »

ORIGINAL: Gary Childress

Hi Ryan,

How does MAPGEN work? My guess is that I run a python script for each map aspect (terrain type, roads, weather zones, etc.) which will dump the PWHEX data to a PNG file with the types of hexes color coded. From there I change around the colors of the hexes as desired, using the respective pre-set colors for each hex type to create whatever map layout I want for the PWHEX file. Then I repack the PNG image back into the PWHEX file where the program will read the various colors as corresponding hex types for the PWHEX file and alter the PWHEX file accordingly? Is that generally how it works? I'm a little lost right now.

Gary, that's pretty much exactly how it works; only with this release, I've made a single 8 MB binary using PyInstaller which creates a bundled self contained portable version of python so that you don't need to have or install python on your computer to run the scripts.

Currently, it's a binary dump everything or not operation; but with more time, I can add a option menu:

Dump
A.) Hex-Side Rivers
...
G:) Dump Everything.
GaryChildress
Posts: 6763
Joined: Sun Jul 17, 2005 3:41 pm
Location: The Divided Nations of Earth

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by GaryChildress »

ORIGINAL: RyanCrierie
ORIGINAL: Gary Childress

Hi Ryan,

How does MAPGEN work? My guess is that I run a python script for each map aspect (terrain type, roads, weather zones, etc.) which will dump the PWHEX data to a PNG file with the types of hexes color coded. From there I change around the colors of the hexes as desired, using the respective pre-set colors for each hex type to create whatever map layout I want for the PWHEX file. Then I repack the PNG image back into the PWHEX file where the program will read the various colors as corresponding hex types for the PWHEX file and alter the PWHEX file accordingly? Is that generally how it works? I'm a little lost right now.

Gary, that's pretty much exactly how it works; only with this release, I've made a single 8 MB binary using PyInstaller which creates a bundled self contained portable version of python so that you don't need to have or install python on your computer to run the scripts.

Currently, it's a binary dump everything or not operation; but with more time, I can add a option menu:

Dump
A.) Hex-Side Rivers
...
G:) Dump Everything.

Fantastic! This will revolutionize map modding for AE! I take it that this BETA doesn't yet have the repack ability?
GaryChildress
Posts: 6763
Joined: Sun Jul 17, 2005 3:41 pm
Location: The Divided Nations of Earth

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by GaryChildress »

Just used the new BETA v1. It seems to be working great. I did a dump using the split feature and the only quirk I see so far is that the first 6 panels of the "Hex type" dump are separated from the rest of the files for that particular aspect by the absence of an underscore "_" in the file names.
User avatar
RyanCrierie
Posts: 1321
Joined: Fri Oct 14, 2005 7:15 am
Contact:

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by RyanCrierie »

ORIGINAL: Gary Childress

Just used the new BETA v1. It seems to be working great. I did a dump using the split feature and the only quirk I see so far is that the first 6 panels of the "Hex type" dump are separated from the rest of the files for that particular aspect by the absence of an underscore "_" in the file names.

Thanks for the bug report. fixed. [:'(]
User avatar
RyanCrierie
Posts: 1321
Joined: Fri Oct 14, 2005 7:15 am
Contact:

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by RyanCrierie »

Updates:

A.) Fixed a bug in MAPGEN Split Map Dump mode -- the 5th map image was not being dumped. Found this out when I was coding the repacker; it was erroring out since part 5 of the 41 part split map wasn't there.

B.) Successfully coded the Repack mode to work in both single and split map image mode; and improved the hex analysis routine.

Before, it was a single hex pixel call at the center of the hex. Now; it picks nine different pixels in the hex at the following locations:

Image

and places them into a pythonic list and then returns the most common pixel value from that list.

This should help make drawing maps more logical; as opposed to the earlier simple central pixel call in my previous code.
Attachments
NewPixelAnalysis.gif
NewPixelAnalysis.gif (1004 Bytes) Viewed 271 times
GaryChildress
Posts: 6763
Joined: Sun Jul 17, 2005 3:41 pm
Location: The Divided Nations of Earth

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by GaryChildress »

Awesome! Can't wait for the finished product! [&o]
Dili
Posts: 4713
Joined: Fri Sep 10, 2004 4:33 pm

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by Dili »

Yes, this mean i can make a Med map mush faster.
User avatar
RyanCrierie
Posts: 1321
Joined: Fri Oct 14, 2005 7:15 am
Contact:

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by RyanCrierie »

Work has resumed. It took me about 15 minutes to figure out where I had put everything. [:'(]

Current status of Repacker: about 44% complete; I still need to code the hexside stuff, but we'll cross that river when we come to it.
Dili
Posts: 4713
Joined: Fri Sep 10, 2004 4:33 pm

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by Dili »

Thanks for update Ryan.
User avatar
RyanCrierie
Posts: 1321
Joined: Fri Oct 14, 2005 7:15 am
Contact:

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by RyanCrierie »

Hit snag with the weather zone repacker. Everything except the South Pole and Falklands works now. Highly irritating. have spent all night on this. [:@]
User avatar
RyanCrierie
Posts: 1321
Joined: Fri Oct 14, 2005 7:15 am
Contact:

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by RyanCrierie »

Fixed that bug/problem.

It turns out that I was reading and writing the PWHEXE.dat file in "Text/String" mode; which in Python 3, automatically unicodes it.

It works normally as long as your values are very low. But when you get into high values; such as 255 (0xFF) or 151 (0x97); the system breaks down.

I changed both the dumper and repacker for the weather zones to work in binary mode. It required some rewriting, but now it works.

EDIT: This in turn fixed a rather subtle bug I had not noticed until now in my Terrain Type dumper -- it wasn't dumping light urban areas.
Dili
Posts: 4713
Joined: Fri Sep 10, 2004 4:33 pm

RE: MAPGEN (A WITP:AE Map Dumper/Repacker)

Post by Dili »

Good news, those are the less worse bugs, the ones that fix more than one issue.
Post Reply

Return to “Scenario Design and Modding”