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
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 5 2016, 18:01

You can think how to do AI more courage. I think that maybe AI attacks faster if you will write and apply script on it?

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 5 2016, 18:34

Baronus, yes, that's something we'll want to add :) There is an AI tab where we will be able to say what AI scripting we want to include (can be based on a difficulty setting or manually added).

I can only do map scripts currently, since I am just now getting to reading in the adventure / landscaping objects, but I'll get there eventually :)

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Mar 5 2016, 20:28

It would be a dream come true, should you be able to reach the point where the content of these treads would become possible to add to any map, with just a few clicks (adding AI improving scripts).
http://www.celestialheavens.com/forum/7/15116
http://www.celestialheavens.com/forum/7/15132
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: 565
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 5 2016, 21:58

At least some of that is part of the plan :D

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 6 2016, 7:27

Alrighty! So, I was able to generate and save a new .h4c file from a .h4c file that I opened and parsed! At first I thought maybe I was going to have to do some research on .gz files, because the .h4c file I generated wouldn't open in the editor, but looked exactly the same side by side in a hex editor.. but then I tried to open the file in the H4 Map Generator, and it wouldn't open there either. On closer inspection, they weren't identical, I just didn't notice because the differences occurred where the byte values weren't alphanumeric characters.

Thanks to all the debug in my log file, I was able to quickly figure out and fix the cause :)! After opening / saving several other campaigns, I was able to find and fix a few more bugs with the .h4c creation process.

Now, on to copying events between maps :)

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 7 2016, 0:26

I have successfully copied events between maps! I'm not home right now, so I'll need wifi before I can post screen shots :D

I've set it up so that you can copy a selection of events in one of the tables, switch maps, right click in the event table that you copied from, and select paste.

I'll also add the ability to delete events.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 7 2016, 5:53

Time for some screen shots for the above update! They start with two maps already loaded, my Heroes Chronicles campaign, and a test map (Small empty). I switch to the second map of the campaign, and go to the "Scripts" tab (I should probably change that to "Events").

To copy scripts, highlight the scripts you wish to copy, then right click the table, and select "Copy". Right now, if there are no highlighted rows, all events are saved for copying. I'll probably add another menu item "Copy all rows".

Image

Now, switch to the map of your choice. The only other map I loaded was one of my test maps.

Image

Now, I copied triggerable events, so I can only paste triggerable events, so right click on the triggerable events table, and select paste.

Image

Now, all the events I copied have been copied to the map Small empty.

Image

Don't forget to save or your changes won't be applied. Right now I only have save as, and no button for easy saving, but we'll get there eventually :)

Image

Lastly, open the map in the editor and have a look for yourself ;)

Image

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 7 2016, 13:14

Works go on. We can use this generator to create Unity campaign :-)

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 7 2016, 16:35

Sure can :) I'm hoping to get to the terrain part for easy high-level map design, which we cannot do in the actual editor. My plan is to be able to paint terrain like you can in the editor, but from the all the way zoomed out level. That way, you can actually do the terrain for the entire map quite easily, rather than have to move the window around and paint the terrain little by little, only to find out you wanted certain areas bigger or smaller.

Removing events also works now :D

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 7 2016, 19:17

I have an idea. Heroes II to Heroes IV map converter. It is 6 the same factions and I think that it is simple convert. But it is only idea. You have a lot of work with HIV.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 7 2016, 19:45

I had actually thought about adding something like that, some sort of map converter between heroes games, but that is certainly a lot further in the future :)

As far as what's next, do you guys think I should work on being able to add events to adventure objects, or should I aim for painting terrain first? I have to document a few more things after events, and then I'll be at landscape / adventure objects in the .h4c file. It's likely that once I get to where I'm able to read in landscape / adventure objects that I'll be able to paste events pretty easily.

Terrain codes are after the adventure / landscape objects, and are relatively simple to understand. I just don't know how terrain boundary codes are represented yet.

Thoughts on where I should focus next?

I'd also like some ideas on how to display the various adventure objects which have events attached to them. Maybe a table with all adventure objects that could potentially have events available? A table similar to those above, but with the name of the adventure object, maybe the type, and other pertinent information? Then, maybe you can right click and edit or something to see the events?

I was also thinking about trying to put events on landscape objects, but I'd also have to dig into the file where the information is stored on them and add an "visit point," so that will probably have to wait until later :D

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 7 2016, 20:51

I think that first is terrain paiting and then objects at the end monsters.
Tables are the simplest solution I think. Its easy to edit rows and columns.

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Mar 7 2016, 22:47

I second the terrain being next focus area. As Baronus stated earlier, that feature is currently more useful than object events. But surely following adventure object events, comes events on heroes and monsters. I'll have to give the display a few thoughts. It'd be nice to hear others opinions..
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: 565
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 8 2016, 16:00

Alrighty, I'll just continue documenting until I get to terrain. There seems to be some stuff right after the last event that I'm currently not quite sure of. For most of my maps, it's just 00 00 00, except for one, which has 00 00 01, and then some other codes, then "artifact" and then a few more codes. I thought it might be because I had placed some artifacts on that particular map, but removing a couple of them didn't seem to have any effect on the file, at least at the point I was looking at.

Once I get through that, I should be able to get through the next part fairly easily :)

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 9 2016, 9:48

Step by step and will be succes :-)
In options I think sholud be:
1. Genrrate WoW map.
2. Generate Eq3.51 map.
3. Generate Eq3.55 map.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 9 2016, 15:15

:)

I figured out that directly after the events is the info for custom oracle settings. Every oracle is represented in the file, whether or not it has any custom settings.

If 01, the oracle has custom settings, followed by a short indicating how many oracles are needed to complete the puzzle. The next int (or it could be a short followed by 00 00) indicates the number of rewards this oracle reveals. The next short indicates the length of the name of the award type, followed by the name of the award type (artifact or material). Next, is a short for the artifact or material code (keep in mind, artifacts also contain parchments 7c and scrolls a6, followed by their code), followed by an int for the number of the item present. Each oracle info block is terminated with 00 00.

If 00, read in 4 bytes (ff ff 00 00), and start processing the next oracle on the 5th byte.

There are a few bytes after the custom oracle block that I don't have a handle on yet, then it's skills, spells, and heroes. I documented the custom skills format and skill codes last night, and will post them when I get to them in order. AI Properties have also been documented, but I currently don't recall where they are in the order of the above. I'll also get its format posted when I get to it in order :)

I think that's it before the landscaping / adventure objects :D

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Mar 9 2016, 16:38

In the copy/paste post earlier, you wrote you copied triggerable so you can only paste triggerable events, will it be possible to copy/transfer say a timed event from one map and paste it as a triggerable event in another? I guess the timed values would be an issue, but it would be useful. The same goes for e.g. placed events that you would like to use as a triggered event on an army/hero.

Baronus, there might even be a need for std. or tgs. version's as well.
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: 565
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 9 2016, 17:26

Hmm, I guess that would be relatively simple, since I've used inheritance for my Timed/Triggerable/Continuous/Placed event classes. Each of the event classes has a main base class of H4Event, which is what contains all of the scripting information and variables for the event name and name length, while the child classes contain more specific information.

So, it would be a simple thing to copy, say, the name and scripts of the event, and then possibly use default values for everything else. All of the events, except for continuous, also have an effects portion, so I'd need to take that into account when copying between continuous events and the others, but it should definitely be possible to implement.

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 10 2016, 19:52

Standard and GS are poor of resources. Someone want play without eg. 7 added creatures?
...
Maybe it will be possible adding some interesting scrips? Eg. for AI buy army and attack...
Im not a programist I can only give an idea.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 10 2016, 20:15

We'll definitely be able to add some scripts for the AI and AI heroes. We can't force them to buy creatures, but we can give them money, additional creatures to recruit (or directly give heroes creatures), and add a fake attack / defense boost to heroes, as well as give their heroes strong units during their turn to make them more aggressive :)

I'm also planning to add a feature to save / load events. That way you won't have to always search for the map with the different events you want to copy to a map, you can simply load the events you saved directly into your map :D

Currently I'm putting the finishing touches on reading in the custom oracle info. I've read it all in properly, now I'm getting it patched back together and put into a new file.


Return to “Heroes I-IV”

Who is online

Users browsing this forum: Google [Bot] and 6 guests