Heroes 4 Advanced Options Map Editor

The old Heroes games developed by New World Computing. Please specify which game you are referring to in your post.
User avatar
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: Heroes 4 Map Generator / Utility

Unread postby Baronus » 17 Feb 2016, 22:51

Small surprise:
http://imperium.heroes.net.pl/temat/4173
Resources unfinished, hidden and losted.
Downolad link.
http://chomikuj.pl/AxeFighter/Dokumenty ... biekty.h4c
See in editor. It is possible ad it in RMG?

Fort in intro of Heroes IV is in game! I tested and it works!
Image

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 18 Feb 2016, 01:13

I've used several of the hidden objects in my campaign :D

I definitely want to include the hidden objects that make sense in the random generation.

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Re: Heroes 4 Map Generator / Utility

Unread postby Karmakeld » 18 Feb 2016, 19:40

all of these 'hidden' objects are available/shown in the Equilibris mod and fully functional.
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 21 Feb 2016, 01:15

Update: I got to the point where I can pull out the name and description of a campaign and all it's maps, and add them to the viewing panel similar to the actual editor. Screen caps below:

Image

Image

Image

Image

Image

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 22 Feb 2016, 04:47

I believe I've figured out how the grid is represented in the file. It appears to start in the top right corner (row 1), and then reads from top left to bottom right across that row. Then to row 2, from top left to bottom right, etc.

Concrete example on a small map, the order would be: row 1, column 38; row 1, column 39; row 2, column 37; row 2, column 38; etc.

The terrain codes are as follows:
00 00 - water, shallow
00 01 - water, deep
01 01 - grass lush
01 00 - grass dry
02 00 - rough rocky
02 01 - rough sun-baked
03 00 - swamp, deep
03 01 - swamp, shallow
04 00 - volcanic, hot
04 01 - volcanic cool
05 00 - snow
05 01 - ice
06 00 - sand, beach
06 01 - sand, desert
07 00 - dirt
07 01 - dirt, mossy
08 00 - subterranean, dirt
08 01 - subterranean, rock
09 00 - water river
0a 00 - lava river
0b 00 - ice river
0c 00 - magic plains
0d 00 - field of life
0e 00 - enchanted stone
0f 00 - cursed ground
10 00 - scorched earth
11 00 - magic garden
12 00 - field of glory

If there are no boundaries between terrain types, there seem to be 11 bytes of data for the grid square. If there is a boundary between two terrain types, there seem to be 16 bytes of data for the grid square. I haven't figured out what the different boundary codes are, which will certainly take some time to get figured out, but at least I have a grasp now on how the terrain grid is represented in the file.

I just need to figure out how I can tell where the grid actually starts. So far I haven't found anything definitive.

User avatar
Steven Aus
War Dancer
War Dancer
Posts: 350
Joined: 08 Feb 2006
Location: Perth, Australia
Contact:

Re: Heroes 4 Map Generator / Utility

Unread postby Steven Aus » 22 Feb 2016, 07:04

You've found this much already, I'm sure you'll find this piece of information too in not too much time. :)
My Life Purpose Is To Teach The World To Fish For Life. I AM Steven Russell Lynch Abundance That I AM. Empowerment And Fostering Self-Responsibility Is My Game.

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Re: Heroes 4 Map Generator / Utility

Unread postby Karmakeld » 24 Feb 2016, 10:49

it's nice to see you're progressing :-)
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 24 Feb 2016, 17:02

:D

And a little more:
Elevation data immediately follows the terrain data, and the grid is in the same order, from the top right corner to the bottom left.

For maps with an underground, the order is as follows: terrain for above ground, terrain for below ground, elevation for above ground, elevation for below ground. There is nothing separating the terrain / elevation data, so you have to calculate ahead of time how many grid squares of data you will have (rows * columns).

I still have to figure out what the different values mean / how many bytes each grid receives (if it varies), but at least I know the location of the data now :D

I also did some work on my campaign. Got a couple dialogues written!

User avatar
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: Heroes 4 Map Generator / Utility

Unread postby Baronus » 24 Feb 2016, 21:56

Good news.
There is another nice programm. Picture to Heroes III map converter :-)
You can convert your picture to map:
http://kirinyale.net/treasury.php
Mapmagic. This is too map generator.
Image

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 25 Feb 2016, 18:09

Ah, almost forgot about generating a map from a picture :D Should be able to add that capability at some point.

For placed events (some of which applies to the other event types), the script stuff comes first (sequence, conditional, display, etc.), followed by the text for the effects tab. After that, there are 7 integers for adding / subtracting resources under the effects tab. Then, there is a byte (which I think may be representing binary bits) for which color player the script applies to, followed by a byte (with three possible values) for whether the script applies to human, AI, or both. Lastly, the text for the name of the script.

And of course, wherever there is text, including the actual scripts, it is preceded by the number of characters in the text followed by a 00.

If I didn't note it in here before, the map events in the file are in type order: Timed events are first, triggered events are second, continuous events are third, and placed events are fourth.

A lot of the stuff from placed events applies to the other event types as well, but I'll still get them documented when I get home. Eventually, I'll get the first post updated to contain all that info.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 27 Feb 2016, 07:03

I've finished documenting scripting events (Timed, Triggered, Continuous, and Placed), and I know how to read them all in from first Timed Event, to last Placed Event.

After the carryover description, there is a byte for the "Intended for multiplayer" check box (00 for unchecked, 01 for checked). Right after that, is a short (2 bytes) indicating the number of Timed Events to follow, followed by the Timed Events, if there are any. Then, there's a short for the number of Triggered Events to follow, followed by the Triggered Events, if there are any. Same for continuous events, and same for placed events.

There are just a few more things I need to get figured out from the header before the events, and then I'll be able to read in all the events :D

After the events is a block for what should be the rest of the map properties (such as skills and spells maybe?). After that, are the terrain and elevation blocks.

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Re: Heroes 4 Map Generator / Utility

Unread postby Karmakeld » 27 Feb 2016, 08:03

This is very good reading. Regarding scripts, I guess the next step is figuring out how to copy/paste scripts.
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 27 Feb 2016, 15:41

Copying and pasting will be a simple task :) each map will have it's scripts parsed out already, so I'll just need to add each script to its list by type to whichever map the user chooses, then I just use the list size of each list (timed, triggered, etc.) when writing to file :D

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 28 Feb 2016, 22:26

Update: So I've gotten to the point where I can parse out the entire header of each map in a campaign or single scenario map, and I'm currently working on reading in the events.

I thought it was going to be pretty simple to just separate the script body, effects, name, and other properties, but there don't appear to be any definitive delimiters around these properties. So, I'm having to come up with an algorithm to parse out the script body while taking into account the fact that it also needs to be put back together :D

I could just pull out the entire event without doing any parsing (each event has the same starting hexcode), but then I won't be able to get to things like the event name, so I guess I'm going to have to figure out that algorithm :D

Hopefully the next update will include some screen shots of the script tab showing all map events - Timed, Triggered, Continuous, and Placed - in tables by event type and then name.

User avatar
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: Heroes 4 Map Generator / Utility

Unread postby Baronus » 29 Feb 2016, 07:52

You can also add HIV style interface and background.
Image

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 29 Feb 2016, 16:49

A Heroes4 look and feel would definitely be a nice touch! I'll have to look up creating my own look and feel :D

I think I solved the script parsing issue I was having last night. Just have one more issue to figure out / fix and then I'll be reading in Timed Events. The others should fall in place pretty soon after :D

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 05 Mar 2016, 06:14

Next update!! I've read in all map scripts and inserted them into the tables on the script panel as shown below. I tested with a few different maps and campaigns which helped me fix parsing of almost all of the scripts (for map events), but there are probably some I missed that need special parsing.

Image

Selecting a new tab, campaign or map, will load the events for that map.

Image

Next, I should probably test generating a new map with everything I've done to parse the map out into nice data structures, since there are probably some bugs in there. After that, I'll work on my first modifications: copying scripts between maps.

User avatar
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: Heroes 4 Map Generator / Utility

Unread postby Baronus » 05 Mar 2016, 09:12

Good news. Next elements added. All HIV lovers are joy.

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Re: Heroes 4 Map Generator / Utility

Unread postby Karmakeld » 05 Mar 2016, 16:32

How advanced is the scripts reading? Can you read/display what the script does in the RMG or does it simply display the name of the event?
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 05 Mar 2016, 16:59

The script reading is actually pretty advanced. I had to go advanced, which is what took me so long here, in order to be able to get to the name of the script because there are no delimiters. You have to actually count the scripts in the event. You start out assuming there will be one main script. If it's a sequence, then you get the short (2 bytes) right after it which tells you how many commands follow, so add that to the number to process and continue to read in scripts.

I created lots of script reading classes which keep the pertinent information of each of the scripts. One of the exceptions is the conditional script. I have all the logic checks as part of the conditional, but the two forks are not.

To answer your question, I can definitely set something up to view the scripting in an event once I come to it :D

Edited for spelling mistakes from typing on my phone :)
Last edited by Anonymous on 05 Mar 2016, 18:32, edited 1 time in total.


Return to “Heroes I-IV”

Who is online

Users browsing this forum: No registered users and 1 guest