Heroes 4 Map Generator / Utility

The old Heroes games developed by New World Computing. Please specify which game you are referring to in your post.

Moderator: Moderators

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 28 2016, 5:38

After about two days of fighting with and debugging threading optimizations to make loading times and terrain painting times a bit better, I was finally able to find and fix the problem keeping me from moving forward :D

Now, each map is parsed on its own thread. Painting terrain for multiple maps works the same way, each image is drawn on its own thread.

Oh, and before that, I went back to actually parse the campaign header, which I wasn't really doing before. I was just searching for the campaign name and description, but I have since gone through all of the options (hopefully) and documented them. One of the things I found out, which also helped me with some optimizations, was the fact that the end of the campaign header (if a campaign and not single scenario) had a short for the number of maps in the campaign, followed by an integer for each campaign which represented the gzipped size of the map in bytes. If I hadn't found that, I wouldn't be able to actually modify the map, since invalid size values will cause the editor (and probably the game) to crash.

Now that that's out of the way, I've also started working on painting terrain, and I have some screen shots. See the void terrain below ;) (ignore that ugly mouse arrow on the button next to the terrain button, just started working on the toolbar)

Image

And what it looks like in the editor:

Image

I haven't set things up quite yet to be able to select the terrain type to paint, just hard-coded the type and passed that to the painting method, but that won't take too long. I'm thinking that if the terrain icon is pressed, I'll switch over to the drawing tab, similar to how the campaign editor brings up the terrain options. I'll probably give a few more options, such as brush shape, where the editor only has the square brushes of four sizes.

I seem to be able to paint any type of terrain on any elevation, which is pretty cool :D

Oh right, and as you can see, I got the grid up and running.

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Mar 28 2016, 7:47

I seem to be able to paint any type of terrain on any elevation, which is pretty cool


That's pretty awsome. And so is the fact that you can just paint the void terrrain on the map, despite objects being placed :-D
Now if you could add the cliff effect as well = :applause:
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: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 28 2016, 14:55

Haha yep, also without the cave / stone walls :)

Before I move on to the elevation, I'd like to figure out the terrain boundary codes. I think I should be able to isolate the different boundaries so that I can view them one at a time in the hex editor.

I wish I could apply the boundaries to the void terrain, but I'm afraid we're stuck with its blockiness :( We'll just have to use some other dark terrain around it to hide it :D

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Mar 28 2016, 18:21

Indeed the blocks aren't the prettiest (funny how I didn't take notice of the fact that it' black without cave), but I can already find a use for this feature in one of my planned maps :-D You just helped me to an easier solution than I had originally been trying out.
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: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 28 2016, 18:50

I figured you might find void terrain useful ;) It will also be useful for my map taking place on the Plane of Death and for the Unity Isle of Death map ;)

Right now it's not quite useful yet, since you can only see the map at the top level. Once I get zooming working, it will be significantly more useful.

One thing to note, you should have all of your objects in place already and elevation done before painting void terrain. Otherwise, as you know, you have to do things the hard way with objects, and elevation doesn't work. As I write this, I realize I also need a way to remove void terrain. Making a note for myself now :)

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Mar 29 2016, 21:55

How about showing underground? Just realized I didn't recall this being mentioned in any previous post. I asume you can read and switch between Levels?
Regarding elevation I'm curious if that'll be the same rule as the void terrain? You mentioned being able to paint all terrain types on elevated ground, unlike in the editor. Certain larger objects have a tendency to lower elevation, so it would be great if your program could somehow look past that. Of course placing a mountain will need leveled tiles on the occupying space, but I find it frustrating that even minor objects also drags the entire elevated area down :(
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: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 30 2016, 0:17

I've read in the underground terrain and the terrain image for it should be drawn, I just didn't have a mechanism yet for switching between levels (button). I've been copying the icons from the editor, including the underground button icon, I just need to get it plugged in and tested :D

I was also wondering what would happen to objects if we changed the elevations under them, but I haven't gotten to that point yet :)

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 30 2016, 2:20

Finished implementing the ability to switch between above and below levels.

I also added the ability to toggle the grid on and off.

I'll post a couple screen caps in a little bit :)

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 30 2016, 3:27

Above ground, grid on:

Image

Below ground, grid on (by pressing the underground button as in the actual editor):

Image

Below ground, grid off (by pressing the grid button as in the actual editor):

Image

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 30 2016, 8:41

Undergrounds has another look so special brush is needed... But I like underoceans of water ofcourse.
Oceans of lava too :-)

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 30 2016, 17:51

Hi Baronus :)

What do you mean by a "special brush" for underground? Do you mean different colors for the terrain types?

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 30 2016, 18:59

There is soecial underground terrain:
http://www.gameexpres.cz/products/ostat ... gic4/2.jpg
Mooshroms, rocks. Special brush is needed... But lava water should bee too.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 30 2016, 19:16

Ohh, so you mean like the H4 editor brushes, but make a brush specifically for underground terrain and objects? When I get a bit further with the H4MG (Heroes 4 Map Generator), I can start looking at H4 editor brushes to figure out the format so that we can use and create brushes in the H4 editor and H4MG.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 31 2016, 4:09

Update: I have implemented painting different terrain types, as well as changing the brush size. I still have a little work to do with getting the brush size exact, since I'm currently using the diagonal of the grid square, rather than the side, when calculating the pixel length. I also need to rotate the drawn square (if a square is the shape being used) so that it matches the grid direction.

Painting with a large brush on an XL map:

Image

Painting with a ludicrous brush on an XL map:

Image

The resulting minimap in the H4 editor:

Image

I think next I'm going to update the painting methods to handle shapes (just square and circle for now). Then I think I'll get on figuring out the boundary codes so that painting terrain can look "right."

After that, I think I'll work on showing adventure objects that contain events.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 2 2016, 6:24

Finished updating the paint methods so that they will accept shapes. I can now paint circles and squares. I've also implemented the ability to remove void terrain, fixed several small bugs, and made some other updates to emulate the way things work in the actual editor.

I briefly started looking at terrain boundary codes, but their meanings are still beyond me. I'll just have to keep looking at them until I can figure them out >.<!

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Apr 2 2016, 12:00

Good results!
What about copy selected area? And paste in another map? Friendly selector will be usefull...

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 2 2016, 16:32

A selection tool with various options is definitely on my list of things to implement :D

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 4 2016, 3:45

Update: I'm now able to show all of the adventure objects which have events. So far I have also emulated the "Army Properties" options you get when selecting an army in the editor. I still need to figure out what kind of information should actually be displayed in the tables, so feedback is appreciated. Clearly "Army" isn't exactly useful when you have many on the map, and it took me some time to find the one I was looking for. Maybe under the "Name" column (the column name can change) I should list the name of the first creature stack or hero (whichever comes first)? Under "Type" I can probably shorten it to just the important part of the object's name.

Image

The screen shot below shows that you will be able to right click and edit any particular object (currently only works for Army objects).

Image

Still missing a few fields on the emulated Army Properties panel, but I'll get them filled in eventually :) The number after "Male" corresponds to the Hero's class, which I haven't documented quite yet.

Image

And you can check out the events for army objects (can't copy or anything yet).

Image

I decided I didn't want to keep breaking my head against terrain boundary codes (at least for now) so I moved on to getting this done :) I'll work on the "Hero Properties" panel next, and then look at enabling changes to the armies and heroes :)

At some point I'll work on displaying the actual scripts (emulating the editor unless someone else has a better idea of how to show them).

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 4 2016, 4:08

Speaking of the terrain boundary codes, if anyone is interested in helping me figure those out, please let me know. If you create an empty map, I can point you to where the terrain codes start and show you in the documentation what each of the bytes means.

I've started seeing some small patterns in the boundary codes, but nothing conclusive yet.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 5 2016, 5:02

Created a bare bones hero editing panel with just the events tab set up. So, from the Army properties panel, you can edit a hero in the army as you would in the actual editor like so:

Image

Then the Hero Properties frame shows up (after I took the screen shots, I realized I forgot to add the "Ok" and "Cancel" buttons) and I navigate to the events tab (the other tabs are currently empty).

Image

Now I can switch between event types as I can in the editor, and switch to triggerable events.

Image

I realize you can do this stuff in the editor, but next I'm going to add the ability to copy and paste events between objects (starting with armies and heroes). Once that is done, that means I will have a way coded to add scripts to armies and heroes (besides reading them in from the map file), which will allow us to easily add the AI enhancing scripts. I guess that means I'll need to work on the ability to save and load events as well :)


Return to “Heroes I-IV”

Who is online

Users browsing this forum: No registered users and 8 guests