Sourcehold icon indicating copy to clipboard operation
Sourcehold copied to clipboard

Sav / Map file format

Open janso3 opened this issue 5 years ago • 12 comments

See the Wiki for details

janso3 avatar May 07 '19 19:05 janso3

Starting goods: Pitch Wheat Flour

And I don't know about how sort them.

TheHadiAhmadi avatar May 21 '19 23:05 TheHadiAhmadi

There is a image file in the. map files? Or this programm can read the map files. http://stronghold.heavengames.com/downloads/showfile.php?fileid=67

PodeCaradox avatar Jul 01 '19 15:07 PodeCaradox

@PodeCaradox I've tried contacting the author of the file, but the email address doesn't work anymore.

@metalvoidzz Slight correction: the .cfg filesize seems to be only 819 bytes, I just found the code that generates it (at least in v1.25). https://github.com/metalvoidzz/Sourcehold/wiki/Stronghold-asset-formats

void4 avatar Jul 01 '19 21:07 void4

As a heads up, I am trying to reverse engineer Stronghold map PNGer.exe I would like to publish my progress to Git. I use x64dbg

Can this become a github organisation? Because a separate branch in this repository for details about maps seems silly to me.

gynt avatar Jul 04 '19 22:07 gynt

Hi, moving the repo to an organisation wouldn't be a problem.

Do you want to create a repository for the reverse-engineered files or just for sharing the details about how the Map PNGer works?

janso3 avatar Jul 04 '19 22:07 janso3

It would consist of the reverse-engineered files (comments & labels at the machine language level) and a (more intuitive) Python re-implementation.

And of course a small guide on how I think it works and how others can help. Machine language is pretty tedious.

gynt avatar Jul 04 '19 22:07 gynt

@gynt I've tried to contact Dirus, the creator of the Map PNGer tool, but the email address that is in the 'about' section doesn't work anymore :/

void4 avatar Jul 04 '19 22:07 void4

@gynt I sent you an invite to the organization, you should be able to create the repo then

janso3 avatar Jul 04 '19 22:07 janso3

I have no time now to write the small guide of how I think it works, but the repository is there now. I will work on it later again. Thanks for the organisation!

gynt avatar Jul 04 '19 23:07 gynt

Hi, I found a nice thread that describes more details about the map file format. I am not sure if you guys have already seen it. http://stronghold.heavengames.com/cgi-bin/forum/display.cgi?action=ct&f=4,3925,60,10000

So far, I could not verify that the information is correct, as some of the bytes described are different from those in the wiki (https://github.com/sourcehold/Sourcehold/wiki/Map-file).

nitramr avatar Oct 07 '19 20:10 nitramr

Here is a little update regarding the map/sav file format.

The code at https://github.com/sourcehold/sourcehold-maps allows to unpack .map and .sav files to directories for further inspection. It successfully unpacks all maps from SH and SHC (except mission0.map from SH, for some weird reason it's structure is a tiny bit different). You can also substitute the map preview image (for an example, see the code found under examples/).

Aside from a map preview image, a description, and some unknown data (that gets bigger in .sav's), a .map/.sav file consists of sections that contain map data. Some of these sections map directly to tiles on the game map. Exciting! Every section has a number from 1001 to 1127, and I sincerely hope they are somewhat the same in SH, and SHC...

gynt avatar Jan 01 '20 20:01 gynt

Great work so far! I'll check out your unpacker to see if I can find out more about the section data. I also added some info to this projects wiki, maybe you'll find some of it useful.

janso3 avatar Jan 01 '20 20:01 janso3