Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

RE: Obscure codes in the electronic map

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> War in the Pacific: Admiral's Edition >> Scenario Design and Modding >> RE: Obscure codes in the electronic map Page: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
RE: Obscure codes in the electronic map - 12/26/2017 12:13:40 AM   
RyanCrierie


Posts: 1461
Joined: 10/14/2005
Status: offline
quote:

ORIGINAL: el cid again

I look at AE as a system. Originally an electronics technician and
machine language programmer, and a pioneer of early digital computers
(even pre-electronic digital computers, which used relays), I think in
terms of how the program works more than in terms of art. Most of my
time involved with maps is down at the level of the codes which define
the "real map" from the computer's point of view. Art is simply what
players see and has essentially nothing to do with how the program works.


I'll make this clear(er).

MAPGEN is a program designed to read that underlying binary data contained in pwhexe.dat and then render it graphically.

This is some code from MAPGEN's map dumping program:

ReadByte = [HexFileData.read(1)] # Read One Byte from file as a character.

if ReadByte == [b'\x00']: #x00 Deep Ocean
MapImage.paste(Hex_Blue_1, (int(PIXLOC_X_MODIFIER),int(PIXLOC_Y_MODIFIER)), Hex_AlphaChannel)
if ReadByte == [b'\x01']: #x01 Clear
MapImage.paste(Hex_Green_4, (int(PIXLOC_X_MODIFIER),int(PIXLOC_Y_MODIFIER)), Hex_AlphaChannel)
if ReadByte == [b'\x02']: #x02 Jungle
MapImage.paste(Hex_Green_2, (int(PIXLOC_X_MODIFIER),int(PIXLOC_Y_MODIFIER)), Hex_AlphaChannel)
if ReadByte == [b'\x03']: #x03 Mountain
MapImage.paste(Hex_Brown_1, (int(PIXLOC_X_MODIFIER),int(PIXLOC_Y_MODIFIER)), Hex_AlphaChannel)


Basically, this snippet reads one byte from pwhexe.dat; and it then does different things:

If the byte has a hexadecimal value of x00 (aka deep ocean); it pastes the "BLUE 1" hex.

If it's got a hexadecimal value of x02 (Jungle), it pastes "GREEN 2" hex.

The repacker does this in reverse. It looks at the graphical image and converts the GREEN 2 color into hexadecimal value of x02 and puts that into the binary file.

_____________________________


(in reply to el cid again)
Post #: 31
Mapgen - 1/1/2018 4:32:17 PM   
el cid again

 

Posts: 16922
Joined: 10/10/2005
Status: offline
How does this work with respect to roads and railroads?

How does this work with respect to coastal terrain. In
such terrain, pwhexe.dat codes whatever the LAND is - say
woods. But there is also WATER in the hex. And the water
might be light blue (shallow) or dark blue (deep).

Since RHS needs different maps for every season, this might
be a solution. Someone in Europe said he would make such a
program, and said it would be fun and easy - but he gave up.
But in principle, it should be possible.

Where does one find this program?

(in reply to RyanCrierie)
Post #: 32
RE: Mapgen - 1/1/2018 8:51:39 PM   
Dili

 

Posts: 4708
Joined: 9/10/2004
Status: offline
Mapgen extracts one map for railroads hexes, other map for roads hexes, other map for weather, etc...

quote:

How does this work with respect to coastal terrain. In
such terrain, pwhexe.dat codes whatever the LAND is - say
woods. But there is also WATER in the hex. And the water
might be light blue (shallow) or dark blue (deep).


You paint the LAND,SEA type in called by Mapgen:TERRAIN_BIG map

You paint the coastal instead in HEX_TYPE_BIG map.


It defines the coastal hexes by painting blue clear ones.

Go to Mapgen topic and download the manual.

(in reply to el cid again)
Post #: 33
RE: Mapgen - 1/1/2018 8:59:46 PM   
Dili

 

Posts: 4708
Joined: 9/10/2004
Status: offline
This is the rail map. It is obviously separated from road map. To CODE paint the roads you need another map.


(in reply to Dili)
Post #: 34
RE: Mapgen - 1/1/2018 10:00:05 PM   
RyanCrierie


Posts: 1461
Joined: 10/14/2005
Status: offline
Here's how you edit in MAPGEN (i'm about to release block II).

This is a railnetwork for australia.

You can see how I've crudely drawn across it with photoshop (or paint shop pro)




Attachment (1)

_____________________________


(in reply to Dili)
Post #: 35
RE: Mapgen - 1/1/2018 10:00:59 PM   
RyanCrierie


Posts: 1461
Joined: 10/14/2005
Status: offline
Same location, but in game via hotkeys following analysis/repacking of the graphical file:




Attachment (1)

< Message edited by RyanCrierie -- 1/1/2018 10:01:16 PM >


_____________________________


(in reply to RyanCrierie)
Post #: 36
RE: Mapgen - 1/1/2018 10:04:46 PM   
RyanCrierie


Posts: 1461
Joined: 10/14/2005
Status: offline
Same area displayed in Photoshop, with two layers:

1.) Actual in-game artwork that you see

2.) The rail data layer extracted into graphical format via MAPGEN.

I highly recommend the use of a 64-bit graphics editing program (newer version of Photoshop or Paint Shop Pro whatever they call PSP now) because it takes 218 MB of memory for each “layer” of detail in the map if you edit the full 9000x7000+ pixel map, and that adds up fast.




Attachment (1)

_____________________________


(in reply to RyanCrierie)
Post #: 37
RE: Mapgen - 1/1/2018 10:26:00 PM   
RyanCrierie


Posts: 1461
Joined: 10/14/2005
Status: offline
MAPGEN Block II 19.6 MB ZIP

Designed to be unzipped to your WITP:AE main directory and run from there.

Source code is included in /SOURCE, documentation is in /DOCS

Files generated will be placed into /DUMP.

The program will read the files from /DUMP when rebuilding PWHEXE.dat

I've included a zipped up copy of the original PWHEXE.dat from the latest WITPAE because you won't back it up.

MAPGEN DUMP: Dumps the PWHEXE.dat file into different graphical layers.

MAPGEN REPACK: Repacks the graphical files back into the PWHEXE.DAT file.

MAPGEN MAPART: Combines the 41(!) BMP files in the \ART directory for the in-game map into one really big PNG file which is also pixel accurate with the dump graphics files that DUMP generates. Also splits the big png files back into 41 BMP files when you're done editing the big file in photoshop.

LANGUAGE USED: Python 3.x; using the following libraries:

Colorama 0.3.7
Pillow 4.0.0

and packaged into executables by PyInstaller 3.2.1 (that's why each file is so big, it includes an entire python distribution instead of just what the program needs to run, unlike most programming langauges that build executables)

< Message edited by RyanCrierie -- 1/1/2018 10:28:24 PM >


_____________________________


(in reply to RyanCrierie)
Post #: 38
RE: Mapgen - 1/6/2018 7:12:11 PM   
RichardAckermann

 

Posts: 271
Joined: 12/4/2015
Status: offline
I need help with the PWhexe data format, and would require an expert to give me some info on it.
Like:

struct HexDataType
{
INT8 Terraintype
INT16 NE hex roadtype
INT16 etc..
};

And how many sets of this data exist for each line of hexes in the game map.

I need the info to be able to import WITP AE scenarios into my WITP AE 1 1/2 game engine.


< Message edited by RichardAckermann -- 1/6/2018 7:13:33 PM >

(in reply to RyanCrierie)
Post #: 39
RE: Mapgen - 1/6/2018 8:34:08 PM   
dwbradley

 

Posts: 197
Joined: 3/21/2004
Status: offline

quote:

ORIGINAL: RichardAckermann

I need help with the PWhexe data format, and would require an expert to give me some info on it.
Like:

struct HexDataType
{
INT8 Terraintype
INT16 NE hex roadtype
INT16 etc..
};

And how many sets of this data exist for each line of hexes in the game map.

I need the info to be able to import WITP AE scenarios into my WITP AE 1 1/2 game engine.



The info in this package may be of use to you.
https://drive.google.com/file/d/1ip5AGAFvg_1s-5l4s8JgOx5SwvDK_5eu/view?usp=sharing

Cheers
Dave Bradley

(in reply to RichardAckermann)
Post #: 40
RE: Mapgen - 1/7/2018 8:58:57 AM   
RichardAckermann

 

Posts: 271
Joined: 12/4/2015
Status: offline
Yes, the documentation looks helpfull. Thanks for it.

(in reply to dwbradley)
Post #: 41
RE: Mapgen - 1/8/2018 8:00:00 AM   
RichardAckermann

 

Posts: 271
Joined: 12/4/2015
Status: offline
Thanks again, Dave Bradley. Those information about the PWHEXE file were perfect.

A question emerged after pasting the info into my game. There does not seem to be any "Developed" or "Cultivated" terrain type, they are all plain clear terrain. Are they just eye candy, or defined by other properties of the hex?

(in reply to RichardAckermann)
Post #: 42
RE: Mapgen - 1/8/2018 11:03:42 AM   
Dili

 

Posts: 4708
Joined: 9/10/2004
Status: offline
There isn't.

(in reply to RichardAckermann)
Post #: 43
Page:   <<   < prev  1 [2]
All Forums >> [New Releases from Matrix Games] >> War in the Pacific: Admiral's Edition >> Scenario Design and Modding >> RE: Obscure codes in the electronic map Page: <<   < prev  1 [2]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

5.102