Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Library of Enlightenment > Thread: Heroes 3 map file (.h3m) format
Thread: Heroes 3 map file (.h3m) format This thread is 2 pages long: 1 2 · NEXT»
qkr
qkr

Tavern Dweller
posted February 28, 2008 11:05 AM
Edited by qkr at 11:16, 28 Feb 2008.

Heroes 3 map file (.h3m) format

Hi.

I would like to try to create my own random map generator for Heroes 3. Is there any place where I could find specification or reference for the format of the map file? I tried google and looking at the forums but didn't find anything.

Edit: After searching the forums a bit I did find one other thread about the same issue [url=http://heroescommunity.com/viewthread.php3?TID=15084]here[/url].

Unfortunately there is no clear answer there either.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
pol
pol


Known Hero
.^.
posted February 28, 2008 06:35 PM

As to the map format that is known but not to the public. For RMG is not so much neede, you maybe interested in . this

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
dimis
dimis


Responsible
Supreme Hero
Digitally signed by FoG
posted February 28, 2008 06:45 PM
Edited by dimis at 18:46, 28 Feb 2008.

For Random Map Generators, check the links that I propose on my reply there. You will find all the info that you were hoping for, plus much more.

Send me a copy of your rmg when you think it is pretty much ok.
____________
The empty set

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
qkr
qkr

Tavern Dweller
posted February 28, 2008 09:38 PM

Thanks for the replies guys, but I think you didn't understand what I was looking for. I'm not looking to make random templates (rmg.txt) for the existing map generator, I'm looking to make a totally new map generator. Sadly since the .h3m file structure is not public knowledge, it looks like that's an impossible task.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
dimis
dimis


Responsible
Supreme Hero
Digitally signed by FoG
posted February 29, 2008 12:25 AM

Yeap. I am not aware of the structure of the file neither have I noticed anything relevant. Perhaps you can reverse engineer it, but that would require lots of work I guess. The point is, can you figure out the structure of an empty h3m file? i.e. create an empty map (just sea) and see if you can retract some features. Perhaps a way of speeding up the process is by creating two different instances of the same map being "empty", one small map and one medium and then figure out how "sea" is represented. The rest of the contents of the file will reflect different options that you can not avoid during the creation (e.g. one vs two levels, name of the map, etc). If you make any progress let me know. I can not help you atm.
____________
The empty set

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
friendofgunnar
friendofgunnar


Honorable
Legendary Hero
able to speed up time
posted February 29, 2008 03:17 AM
Edited by friendofgunnar at 04:50, 29 Feb 2008.

The map file is encrypted some way which I can't understand. You can see this for yourself.  Save a map once (even just a simple ocean), then save the exact same map again under a different name.  Every single character in the file will be different.  Save it again under a different name, same thing.  Save it one more time, surprise! the fourth file is identical to the first file that you made.  That's where I gave up.

Some tools that you can use to puzzle this out are "Total Commander", which has a feature where you can compare two files.  Also a hex editor comes in handy.  

lemme know if you discover anything.

DOH
Quote:
The trick is that an H3M file is compressed using the gzip compression algorithm (also called zlib).  To make the gibberish that is a H3 map readable binary data (where you can see the names of events with a hex editor, etc); put a .gz at the end of the file, then decompress it with winzip or gzip.


I guess I should have read the link first.



 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
dimis
dimis


Responsible
Supreme Hero
Digitally signed by FoG
posted February 29, 2008 07:22 AM

Quote:
DOH
Quote:
The trick is that an H3M file is compressed using the gzip compression algorithm (also called zlib).  To make the gibberish that is a H3 map readable binary data (where you can see the names of events with a hex editor, etc); put a .gz at the end of the file, then decompress it with winzip or gzip.


I guess I should have read the link first.
Me too. Real nice! So, are you done?
____________
The empty set

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
friendofgunnar
friendofgunnar


Honorable
Legendary Hero
able to speed up time
posted February 29, 2008 09:51 AM

yes!

that was kind of a breakthrough.  Total Commander also comes with a handy decompressor in addition to the "compare by content" feature.  I've already learned this:

From 8F to A0: These are the allowable heroes for the map.  In the heroes tab of the map specifications form, you can see all the heroes listed in the same order they're represented in the file.  If you uncheck one it changes one bit in the file from 1 to 0. (some of the heroes come unchecked by default, if you check them it still changes the bit in the file from 1 to 0 though, meaning H3 recognizes the unchecked status as being the default)

not sure if I'm motivated to figure out the entire file structure though

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
qkr
qkr

Tavern Dweller
posted February 29, 2008 10:30 AM

Here is some more info quoted from the previous thread:

Quote:

on a 1-level map that only has terrain added, the first 385 bytes seem to be a header and the last 257 seem to be a footer or something.

the data between this header and footer can be seperated into chunks of 7 bytes each to give a person a representation of the map with last 2 bytes of the 7 bytes seeming to be terrain type and subtype.



While it would be certainly possible to reverse engineer this, I'm not sure if it's worth the trouble. It just looks like a lot of work to me for a relatively small pay-off. It's a real shame that the file structure was never made public.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
qkr
qkr

Tavern Dweller
posted February 29, 2008 07:27 PM

I decided to email Gus Smedstad (a guy who worked on heroes 3) and ask him directly about the map file structure. Here's the response:

Quote:

Its seems as if I get a request like this every few months.

No, I don't have any documentation on the file structure, nor is it
available anywhere to my knowledge.  As I recall, we had one set of library
routines for map reading / writing that was shared by the editor and by the
game, and no formal documentation on the file format.  The main rule was
that the code had to maintain version information internally, and be able to
read all previous formats based on version tags within the format.  There
were literally hundreds of version revisions of the file format before
release, as writing a new feature included writing file support for that
feature.

- Gus

----- Original Message -----
From:
To:
Sent: Friday, February 29, 2008 5:12 AM
Subject: Heroes 3 Map File (.h3m) Structure


>
> Hi there.
>
> First of all, thank you for making the great games in the Heroes of Might
> and Magic series. As you probably know, heroes 3 is still very actively
> played game nowadays. I am wondering about the details of the heroes 3 map
> file structure. Information about it would allow fans to make new programs
> that work with the map files, for example a new random map generator. So I
> am asking if you know, is this information available anywhere on the
> internet? If not, is there any chance this could be released to the heroes
> 3 fan community? It's already known that the map is compressed with gzip
> but that's pretty much it.
>
> Thanks.
> -Pekka
>


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
pol
pol


Known Hero
.^.
posted February 29, 2008 09:13 PM

VCMI, WoG... if you know russian visit forum.df2.ru and ask them(Greyface). They are the guardians of true homm3 legacy.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Binabik
Binabik


Responsible
Legendary Hero
posted February 29, 2008 09:30 PM

Translated:

http://translate.google.com/translate?hl=en&sl=ru&u=http://forum.df2.ru/index.php%3Fshowforum%3D4&sa=X&oi=translate&resnum=1&ct=result&prev=/search%3Fq%3Dhttp://forum.df2.ru/index.php%253Fs%253D7aebdf283a25405aa0530e4198cdab0c%2526showforum%253D4%26hl%3Den%26sa%3DG

The translation is good enough to read most of it.

____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
crackedmind
crackedmind

Tavern Dweller
posted June 16, 2008 04:22 PM

i reversed a h3m file format in last year.

http://downloads.sourceforge.net/heroes-rebirth/h3c_and_h3m_formats.rar?modtime=1194745715&big_mirror=0

There are h3c & h3m format templates for 010 editor, and text description (russian language). It may be useful
____________
So u can code punk?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
dimis
dimis


Responsible
Supreme Hero
Digitally signed by FoG
posted June 23, 2008 03:57 PM

A description in English though would be much appreciated.
____________
The empty set

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
crackedmind
crackedmind

Tavern Dweller
posted June 24, 2008 03:36 PM

i will try to prepare english version

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Swaggy
Swaggy


Hired Hero
posted September 30, 2015 04:40 PM

Hello,

is there any chance the files crackedmind gave would be translated ? (surprinsigly, the link still works). The file h3m_description.txt especially is very interesting, but it is in russian.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Warmonger
Warmonger


Promising
Legendary Hero
fallen artist
posted September 30, 2015 04:50 PM

Interesting resource.

However, VCMI has already reverted h3m format many years ago. Unfortunatelly all that's available for view is the source code of parser

____________
The future of Heroes 3 is here!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
potmdehex
potmdehex


Known Hero
professional ERM™ scripter
posted September 30, 2015 05:31 PM
Edited by potmdehex at 17:44, 30 Sep 2015.

h3m_description.txt is available in English if you search.

While it is a well written good starting point, it is far from perfect. It only covers SoD .h3ms (RoE and AB are vastly different) and completely leaves out object details section (arguably the most complex part of the format) as well as the global events section. Additionally it contains many errors even forgetting RoE and AB. I was keeping a list of errata but stopped after finding too many.

Warmonger said:
Interesting resource.

However, VCMI has already reverted h3m format many years ago. Unfortunatelly all that's available for view is the source code of parser


To each his own, but I prefer as much binary compatible structures as possible rather than high level classes that need serialization and don't like Boost

I reversed RoE, AB and SoD .h3m formats last year: result

Same repo has various .h3m utilities and libraries in C, C++ and Python including some RMG code and also an original database mapping every single sprite name from RoE, AB and SoD to their object data.
HC link.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Swaggy
Swaggy


Hired Hero
posted September 30, 2015 06:04 PM

I didn't imagine that it was that complex and that someone already spent so much work on it. I guess this complexity is the reason why an external RMG was never done.

Thank you for the answers. Also both of you have done amazing projects.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Swaggy
Swaggy


Hired Hero
posted October 04, 2015 09:23 PM

Building a new RMG ?

Ok, even though it looks very hard, I'm still trying to do it. The above links have been very useful (the english h3m_description.txt, and vcmi's MapFormatH3M.cpp). Now I wonder if you have any other things that could help me :

More specifically :
-source code of H3 editor (but I don't think anyone has it)
-surface pictures sprites/numbers (where can I find them, and how they are placed). I built test maps and found there are 78 sprites for normal terrain, but if someone already made this for other terrains, that would save me a lot of time !

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 2 pages long: 1 2 · NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0619 seconds