Heroes 4 Advanced Options Map Editor
Re: Reading Heroes4 (.h4c) map files
I guess you're getting close to a point where this tread will need a new headline. You have already revealed the intention..
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground
Everytime you throw dirt, you loose a little ground
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: Reading Heroes4 (.h4c) map files
Only partially revealed
But yes, it is getting close to that point. Once I get a little more comfortable with the different landscape and adventure object fields in the map file and can get them documented, then it will be time to change the thread title
But yes, it is getting close to that point. Once I get a little more comfortable with the different landscape and adventure object fields in the map file and can get them documented, then it will be time to change the thread title
Re: Reading Heroes4 (.h4c) map files
I found 3.55 Equilibris and there are a lot of objects. See editor.
http://www.mmgames.ru/index.php?option= ... 59&lang=en
http://www.mmgames.ru/index.php?option= ... 59&lang=en
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: Reading Heroes4 (.h4c) map files
Ah, yeah, that was the one I was looking at screenshots for and was excited about all the new objects. I think that's not a stable version though, correct? It's a beta that never got finished. I sent several emails to the Equilibris team and Dalai to offer my help with the project, but I haven't heard back yet. I would definitely love to see and use more landscape / adventure objects.
Re: Reading Heroes4 (.h4c) map files
Hmm the link does suggest that it's final version, but I've been told that 3.55 is just beta. Perhaps it's only supported by russian version and wasn't finished in English..?
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground
Everytime you throw dirt, you loose a little ground
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: Reading Heroes4 (.h4c) map files
It's possible, but if it's not on the main Equilibris site, it's probably a beta version. Wish Dalai would surface
I'm hoping to get back to reading and parsing .h4c files again tonight. I want to try creating objects to bring out the pertinent info for landscape objects and put it I to a manageable form. Probably won't get there tonight, I just want to get started on it again
I'm hoping to get back to reading and parsing .h4c files again tonight. I want to try creating objects to bring out the pertinent info for landscape objects and put it I to a manageable form. Probably won't get there tonight, I just want to get started on it again
Re: Reading Heroes4 (.h4c) map files
In Ch I found english? version Eq. 3.55 :
http://equilibris.celestialheavens.com/ ... fa.sfx.exe
But I cant build mod.exe file :o((( Somebody can? I heard that is beta. But there is a lot of new objects. Stabilization this version is most important. I want test it. How much is bugs there are... Maybe it is playable...
http://equilibris.celestialheavens.com/ ... fa.sfx.exe
But I cant build mod.exe file :o((( Somebody can? I heard that is beta. But there is a lot of new objects. Stabilization this version is most important. I want test it. How much is bugs there are... Maybe it is playable...
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: Reading Heroes4 (.h4c) map files
Unfortunately I don't know how they build / package their stuff
Did a little work on my delimiters file and made an interface for reading the file and others of the same format.
Did a little work on my delimiters file and made an interface for reading the file and others of the same format.
Re: Reading Heroes4 (.h4c) map files
I found very good description defs in Heroes IV:
http://www.heroesofmightandmagic.es/for ... 2&start=15
File format h4l (layers) * block of images from the game heroes4 * * abenhor (abenhor@tabernaberserker.es) description * * there may be many small images cornered inside a large block. * the game uses the full block to reference the position of an image on a template. * * to calculate the width and height of each image within a block, note that: *-margenizquierdo is actually the first pixel painting, starting from zero. * therefore, if margenizquierdo = 23, it means that the 23 first pixel on the left (from zero to the twenty-second) are left transparent. *-margenderecho is actually the last pixel painting, starting from zero. * therefore, if margenderecho = 54, means that they are painted only the pixels from 23 to 54 (32 in total), leaving the rest transparent. *-the same applies to the top and bottom margins. * * in every image there is an area of image and, optionally, a description of the transparency. 02 bytes - nnnn - numeroimagenes (number of images in the file) {image1: 02 bytes - nnnn - longitudpaleta (number of colors in the palette) 02 bytes - nnnn - coloralfa (color for shadows mix) longitudpaleta * 3 bytes {palette: array [1.. longitudpaleta] of array [1.. 3] of bytes;}} (palette rgb)} 02 bytes - nnnn - longitudnombre (the image name length) nn byte - string - name (name of the image) 01 byte - nn - shadows (to soften (antialiasing) the image on the background overlay) / 0 - without transparent areas (usually, dialog boxes) / 1 - with transparent areas, but without alpha channel / 4 - with transparent areas, and alpha channel (these are those that i have gone mad) 04 bytes - ùùùùùùùù - margenizquierdo (horizontal displacement of the image inside the block) 04 bytes - ùùùùùùùù - margensuperior (vertical displacement of the image inside the block) 04 - ùùùùùùùù - margenderecho bytes (width in pixels = margenderecho - margenizquierdo + 1) 04 - ùùùùùùùù - bottommargin byte (height in pixels = bottommargin - margensuperior + 1) {descripcionlineas: array [1.. high] of record} {{02 - nnnn - inix byte (first pixel of the line, filled with pixels transparent at the beginning of the line) 02 - nnnn - finx bytes (pixel of the line, filled with transparent pixels on the right) 04 bytes - ùùùùùùùù - direccionlinea (data direction of the line, in the matrix datoslineas)}} {datoslineas: array [1.. high] of record {pixels: array [descripcionlineas.finx - descripcionlineas.inix] of bytes;}} (colour indices of each pixel, from left to right and from top to bottom.) (apply the index to matrix palette to have color components.) {}} [optional {box shadows and transparencies}] / * end of the image1} {image2...} { ..... } {pickkkk...} * box of shadows and transparencies * consists of zero, one or two parties, * depending on \"sombras\" (0, 1 or 4) " The exact formula of the length of the top = (longituddatos + 1) divided 2; the exact formula for the length of the second part = (longituddatos + 131) split 128; and that affects the acceleration. each byte of the second part corresponds to 128 bytes of longituddatos. each byte is divided into 4 parts, each part (2 bits), is responsible for 32 pixels. these two pixel values are: 00 - all pixels are transparent and can be omitted. 01 - all pixels are fully opaque (alpha = 255) and it is not necessary that they get mixed up with the base. 10 - all pixels are more opaque (alpha = 255) as the transparent color and no need to mix with the base. 11 - there are pixel with an alpha value variable, different from zero (or 255); the alpha channel should be mixed with the base. with the first three modes is very fast, but the room involves a slow process, so it is only used for the edges of the images. the byte following the size of palette, coloralfa, is the transparent color. all pixels with a color below this number not shown in modes 10 and 11. in cases in which the mask has no acceleration (if the image type is not 4) is for all pixels in 10 mode. It has this. spend 3 or 4 files cmp and a screenshot of the game or something similar where these images are vein. and if there is something that you have clear, starting from a partial description always speeds up the theme. ...
With translator. Maybe it will be usefull?
http://www.heroesofmightandmagic.es/for ... 2&start=15
File format h4l (layers) * block of images from the game heroes4 * * abenhor (abenhor@tabernaberserker.es) description * * there may be many small images cornered inside a large block. * the game uses the full block to reference the position of an image on a template. * * to calculate the width and height of each image within a block, note that: *-margenizquierdo is actually the first pixel painting, starting from zero. * therefore, if margenizquierdo = 23, it means that the 23 first pixel on the left (from zero to the twenty-second) are left transparent. *-margenderecho is actually the last pixel painting, starting from zero. * therefore, if margenderecho = 54, means that they are painted only the pixels from 23 to 54 (32 in total), leaving the rest transparent. *-the same applies to the top and bottom margins. * * in every image there is an area of image and, optionally, a description of the transparency. 02 bytes - nnnn - numeroimagenes (number of images in the file) {image1: 02 bytes - nnnn - longitudpaleta (number of colors in the palette) 02 bytes - nnnn - coloralfa (color for shadows mix) longitudpaleta * 3 bytes {palette: array [1.. longitudpaleta] of array [1.. 3] of bytes;}} (palette rgb)} 02 bytes - nnnn - longitudnombre (the image name length) nn byte - string - name (name of the image) 01 byte - nn - shadows (to soften (antialiasing) the image on the background overlay) / 0 - without transparent areas (usually, dialog boxes) / 1 - with transparent areas, but without alpha channel / 4 - with transparent areas, and alpha channel (these are those that i have gone mad) 04 bytes - ùùùùùùùù - margenizquierdo (horizontal displacement of the image inside the block) 04 bytes - ùùùùùùùù - margensuperior (vertical displacement of the image inside the block) 04 - ùùùùùùùù - margenderecho bytes (width in pixels = margenderecho - margenizquierdo + 1) 04 - ùùùùùùùù - bottommargin byte (height in pixels = bottommargin - margensuperior + 1) {descripcionlineas: array [1.. high] of record} {{02 - nnnn - inix byte (first pixel of the line, filled with pixels transparent at the beginning of the line) 02 - nnnn - finx bytes (pixel of the line, filled with transparent pixels on the right) 04 bytes - ùùùùùùùù - direccionlinea (data direction of the line, in the matrix datoslineas)}} {datoslineas: array [1.. high] of record {pixels: array [descripcionlineas.finx - descripcionlineas.inix] of bytes;}} (colour indices of each pixel, from left to right and from top to bottom.) (apply the index to matrix palette to have color components.) {}} [optional {box shadows and transparencies}] / * end of the image1} {image2...} { ..... } {pickkkk...} * box of shadows and transparencies * consists of zero, one or two parties, * depending on \"sombras\" (0, 1 or 4) " The exact formula of the length of the top = (longituddatos + 1) divided 2; the exact formula for the length of the second part = (longituddatos + 131) split 128; and that affects the acceleration. each byte of the second part corresponds to 128 bytes of longituddatos. each byte is divided into 4 parts, each part (2 bits), is responsible for 32 pixels. these two pixel values are: 00 - all pixels are transparent and can be omitted. 01 - all pixels are fully opaque (alpha = 255) and it is not necessary that they get mixed up with the base. 10 - all pixels are more opaque (alpha = 255) as the transparent color and no need to mix with the base. 11 - there are pixel with an alpha value variable, different from zero (or 255); the alpha channel should be mixed with the base. with the first three modes is very fast, but the room involves a slow process, so it is only used for the edges of the images. the byte following the size of palette, coloralfa, is the transparent color. all pixels with a color below this number not shown in modes 10 and 11. in cases in which the mask has no acceleration (if the image type is not 4) is for all pixels in 10 mode. It has this. spend 3 or 4 files cmp and a screenshot of the game or something similar where these images are vein. and if there is something that you have clear, starting from a partial description always speeds up the theme. ...
With translator. Maybe it will be usefull?
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: Reading Heroes4 (.h4c) map files
Currently I'm finishing up with splitting a .h4c file into the file header and each map in the file. I'm at the point where I can get the starting index of each map in the .h4c file, so now I just need to work on what I'm going to do with each of them. Need to ungzip them and then store them in memory to be operated on, etc.
Took me a little while to get to that point because I had to reverse course on how I was initially doing things Initially, I was converting the byte array of the .h4c file to a hex value string, and then scanning the hex string for the particular value (in hex) that signals the start of each map in the file. Well, I tried to load up my campaign, and I thought the program froze, but it turns out the hex conversion is computationally expensive.
So I had to stop converting the byte array to a hex string, and realized that I could just convert the special hex values to a byte array, and match that in the .h4c byte array. This also took me some time, because I forgot that I had already brought in a method to do that, but I wasn't using it, so it wasn't working.
Finally got that working, so once I finish parsing and ungzipping each of the maps, I think I'm going to start working on pulling out all of the scripts in each map, and making the names viewable (likely in a table) in the display, rather than work on the landscape objects because I think the script stuff will be easier.
ps. Is it possible to change the name of a thread? Or should I start a new one? I think it's probably that time.
Took me a little while to get to that point because I had to reverse course on how I was initially doing things Initially, I was converting the byte array of the .h4c file to a hex value string, and then scanning the hex string for the particular value (in hex) that signals the start of each map in the file. Well, I tried to load up my campaign, and I thought the program froze, but it turns out the hex conversion is computationally expensive.
So I had to stop converting the byte array to a hex string, and realized that I could just convert the special hex values to a byte array, and match that in the .h4c byte array. This also took me some time, because I forgot that I had already brought in a method to do that, but I wasn't using it, so it wasn't working.
Finally got that working, so once I finish parsing and ungzipping each of the maps, I think I'm going to start working on pulling out all of the scripts in each map, and making the names viewable (likely in a table) in the display, rather than work on the landscape objects because I think the script stuff will be easier.
ps. Is it possible to change the name of a thread? Or should I start a new one? I think it's probably that time.
re: new tread name
Oh, Sounds good looking forward to seeing some actual pics showing your results..
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground
Everytime you throw dirt, you loose a little ground
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: Heroes 4 Map Generator / Utility
Just needed to edit my original post
I've updated the original post to reflect my intent, and will update it with info that I feel should be included there.
I've updated the original post to reflect my intent, and will update it with info that I feel should be included there.
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: Heroes 4 Map Generator / Utility
This is what I have so far as a description of the GUI. I've updated the OP with this information as well. Comments, suggestions, and / or feedback welcome.
Tabs for the GUI: Properties, Draw, Scripts, AI (maybe, or just under properties)
Properties tab:
- Size of map. Should be able to change at any point in time (with options to scale areas and objects or not).
- Number of players (option to assign a color to each player).
- Map richness (resources laying around and mines)
- Artifacts
- Power ups
- Stat structures (including level trees)
- Neutrals and Neutral strength. Additional options for max level and / or check boxes for each creature level, and check boxes for alignment.
- Neutral towns
- Water amount and type (islands, coastline, lakes and rivers)
- Sliders for terrain type percentages
Draw tab:
- Viewed Overlays (Probably check boxes)
- Option for moving all overlays simultaneously (including terrain type and elevation).
- Option for copying / pasting overlays and objects. I can, perhaps, let the user click and drag to select overlays (careful not to conflict with zooming), and then give the option to copy / paste.
- Selected overlay for painting / drawing (combo box)
- Drawing options (brush type and size, shapes, free draw)
- Table with the name of type of the overlay (landscape, object brush, etc.)
- Additional options for each overlay will be available either by right clicking the object on the map, or the entry in the table.
- Start locations (must be less than or equal to the set number of players). Should have an option "Enclose," which means the RMG should make terrain around the starting areas impassible, with the way in / out blocked by a stack of neutrals.
Scripts tab:
Need more thoughts on the layout of this one, since there can be scripts placed on specific heroes or adventure objects. Maybe divide up between map scripts, and object scripts?
- Combo box of script type (timed, continuous, triggered, placed, etc).
- Table with scripts of the selected type.
AI tab:
- AI difficulty
- Check box to add AI hero enhancing scripts.
Tabs for the GUI: Properties, Draw, Scripts, AI (maybe, or just under properties)
Properties tab:
- Size of map. Should be able to change at any point in time (with options to scale areas and objects or not).
- Number of players (option to assign a color to each player).
- Map richness (resources laying around and mines)
- Artifacts
- Power ups
- Stat structures (including level trees)
- Neutrals and Neutral strength. Additional options for max level and / or check boxes for each creature level, and check boxes for alignment.
- Neutral towns
- Water amount and type (islands, coastline, lakes and rivers)
- Sliders for terrain type percentages
Draw tab:
- Viewed Overlays (Probably check boxes)
- Option for moving all overlays simultaneously (including terrain type and elevation).
- Option for copying / pasting overlays and objects. I can, perhaps, let the user click and drag to select overlays (careful not to conflict with zooming), and then give the option to copy / paste.
- Selected overlay for painting / drawing (combo box)
- Drawing options (brush type and size, shapes, free draw)
- Table with the name of type of the overlay (landscape, object brush, etc.)
- Additional options for each overlay will be available either by right clicking the object on the map, or the entry in the table.
- Start locations (must be less than or equal to the set number of players). Should have an option "Enclose," which means the RMG should make terrain around the starting areas impassible, with the way in / out blocked by a stack of neutrals.
Scripts tab:
Need more thoughts on the layout of this one, since there can be scripts placed on specific heroes or adventure objects. Maybe divide up between map scripts, and object scripts?
- Combo box of script type (timed, continuous, triggered, placed, etc).
- Table with scripts of the selected type.
AI tab:
- AI difficulty
- Check box to add AI hero enhancing scripts.
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: Heroes 4 Map Generator / Utility
Here's a preview of what I have for the properties tab:
And here's a very preliminary preview of what I have for the draw tab (will likely look very different once I come back to it):
And here's a very preliminary preview of what I have for the draw tab (will likely look very different once I come back to it):
Re: Heroes 4 Map Generator / Utility
Looks good! Congratulations!:-)
Re: Heroes 4 Map Generator / Utility
Superb!
"We made it!"
The Archives | Collection of H3&WoG files | Older albeit still useful | CH Downloads
PC Specs: A10-7850K, FM2A88X+K, 16GB-1600, SSD-MLC-G3, 1TB-HDD-G3, MAYA44, SP10 500W Be Quiet
The Archives | Collection of H3&WoG files | Older albeit still useful | CH Downloads
PC Specs: A10-7850K, FM2A88X+K, 16GB-1600, SSD-MLC-G3, 1TB-HDD-G3, MAYA44, SP10 500W Be Quiet
Re: Heroes 4 Map Generator / Utility
Can't wait to actually be able to test it or see next screen shots, of how things look when the screen ain't all green
but till then I can only do this
but till then I can only do this
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground
Everytime you throw dirt, you loose a little ground
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: Heroes 4 Map Generator / Utility
Just typed out a small update on my phone, but it disappeared when I hit submit.. I'll rewrite it when I get back from lunch.
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: Heroes 4 Map Generator / Utility
I didn't have as much time this weekend as I would have liked, but I did get a little bit done. I got to the point where I can parse a .h4c file into the campaign header and each map, un gzip each map, re gzip each map, and then package them all back together into a new .h4c file. The new file worked nicely in the map editor, though I didn't actually try to load it in the game itself. Just trying to get the potential points of failure out of the way before I start actually modifying the map file.
Other than that, I've been analyzing different .h4c files in a hex editor to find any and all patterns that will help me when I start attempting to place objects / terrain. I'm almost to the point where I can start reading out the map scripts.
I've determined that the file coding is in ASCII, which should help a lot, since I can actually just directly check the byte value against the ASCII integer. Should make it really simple to determine when I've come to a byte that represents an alphanumeric character or whatever else I'm looking for.
Anywho, I'll try to make some progress on reading in map scripts and I'll post another screen shot once I have something to display on that front.
Other than that, I've been analyzing different .h4c files in a hex editor to find any and all patterns that will help me when I start attempting to place objects / terrain. I'm almost to the point where I can start reading out the map scripts.
I've determined that the file coding is in ASCII, which should help a lot, since I can actually just directly check the byte value against the ASCII integer. Should make it really simple to determine when I've come to a byte that represents an alphanumeric character or whatever else I'm looking for.
Anywho, I'll try to make some progress on reading in map scripts and I'll post another screen shot once I have something to display on that front.
- iLiVeInAbOx05
- Equilibris Team
- Posts: 788
- Joined: 21 Jul 2014
Re: Heroes 4 Map Generator / Utility
Just an update on reading the files:
I should have realized it after reading Baronus's next to last post, but it appears that most, if not all, of the readable characters are preceded by a number indicating the amount of characters to follow.
For example, if the name of the map was "New Beginnings", in the map file would be 0e 00 New Beginnings 01 (01 seems to generally mean the end of whatever field it follows, but can sometimes be different).
There are still some bytes near the beginning of each map file that I'm trying to understand, but I feel like I'm making good progress
I should have realized it after reading Baronus's next to last post, but it appears that most, if not all, of the readable characters are preceded by a number indicating the amount of characters to follow.
For example, if the name of the map was "New Beginnings", in the map file would be 0e 00 New Beginnings 01 (01 seems to generally mean the end of whatever field it follows, but can sometimes be different).
There are still some bytes near the beginning of each map file that I'm trying to understand, but I feel like I'm making good progress
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests