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 10 2016, 22:10

AI strengh calculation using unit experience data. If it is small attacked. But it must be very small army.
Maybe script divide experience for 2?
Example:
You have army with 10.000 exp.
For AI it is 5.000 exp.
So AI attacked.
It is possible?

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 10 2016, 22:25

I'm not sure what you mean.

Do you mean make it so the AI sees your army as half the size it actually is?

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Mar 11 2016, 6:45

Might I suggest that we post/look at ideas for AI enhancements in the proper treads? I believe I posted links to two treads earlier. I like the idea of setting up a script library for ways to help improve the AI, that both map makers and players can easily add to any map, without having to go through several maps to find the scripts, or having to set them up themselves. But I think the proper place to discuss such scripts is in a tread made for the purpose :)
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 11 2016, 10:50

Yes I think about halfing army look for AI. Only look. It shuold help to make AI more offensive.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 11 2016, 16:11

Finished with reading / writing the custom oracle information.

Immediately following the custom oracle info, is some additional player info: a byte for the player number (in color order), followed by a byte indicating if there is a level cap (00 no, 01 yes). If there is one, then the next byte is the level cap. Then there is a byte that seems to always be 00 (at least I haven't found an example yet where it's not), followed by a byte indicating the AI importance (00 normal, 01 high, 02 vital).

After the player info is a byte that means "has something," but I haven't figured out what yet. If it's 01, then it is followed by 00 00, but I haven't seen any of the bytes after 01 be anything other than 00 00. Still gotta figure out what that is.

After that, is a byte indicating whether or not there are custom hero settings. If 01, then it seems to always be followed by 38, and then a bunch of bytes with 00 or 01, indicating if the hero for that particular byte is enabled or disabled for the map.


With respect to be able to save / load events, I'm thinking about something like "Event Groups," where you can save / load multiple events. I may have sub tabs under the Events tab: 1) Map, 2) Adventure, and 3) Groups.

Trying to keep the number of tabs low so that navigation / usability remains simple, but sometimes you need more :D


Baronus, I think that would require modding, but we can still trick AI heroes into thinking like that by giving them a large amount of high-level creatures during their turn, and taking them away on encounter / the player's turn.

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Mar 11 2016, 20:32

Keep in mind what others have written regarding AI aggressiveness, it's not always a matter of the AI not being being aggressive enough, but also a matter of ensuring they don't enter battles with high risk of many casualties, meaning they'll be reduced once they face the player.

Regarding events, is map - map properties event and adventure, events on objects and armies?
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 11 2016, 20:45

If you switch to the Events tab, there will be 3 more tabs (with the default tab shown being "Map" events). The map events are what are shown in the screen shots on page 4 (in the actual editor, campaign -> map properties -> events). If you select the "Adventure" sub tab, that will show you a table of adventure objects which (can) contain events, such as heroes, armies, and quest huts.

Is that what you were asking?

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Mar 12 2016, 10:10

Yes. Exactly what I was asking.
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 12 2016, 23:22

Today's update:
It would appear that I've made it all the way to the adventure / landscaping objects :)

So, I'll start here from the additional player information after the oracles:

The custom oracle info is followed by additional player info. The first byte indicates the player color, and is followed by a byte indicating whether the player has a maximum level or not (00 no, 01 yes). If 01, then the next short is the maximum level. Next a byte indicating the importance to the AI (00 normal, 01 high, 02 vital). There is an entry for each player in the map (we know how many players there are from the header info).

After the additional player info is the custom artifact information. It starts with a byte indicating if there is any custom artifact info (00 no, 01 yes). If 01, it is followed by the int 00 00 f8 00. After that are 31 bytes of information about which artifacts are available for the map. (I'll get the codes for each artifact at some point)

Next, is a byte indicating if there are custom heroes settings (00 no, 01 yes). If 01, then 313 bytes follow with 00 or 01 for each hero. 00 if the hero is disabled, 01 if they are enabled. (I'll get the codes for the heroes at some point)

After is the skills block, starting with a short indicating if there are custom skills or not (00 no, 01 yes). If yes, it is followed by 5 bytes of data where each byte contains a binary addition indicating which skills are available.

Hex values of the skills
1st byte
Tactics - 01
Combat - 02
Scouting - 04
Nobility - 08
Life Magic - 10
Order Magic - 20
Death Magic - 40
Chaos Magic - 80

2nd byte
Nature Magic - 01
Offense - 02
Defense - 04
Leadership - 08
Combat - 10
Archery - 20
Magic Resistance - 40
Pathfinding - 80

3rd byte
Seamanship - 01
Stealth - 02
Estates - 04
Mining - 08
Diplomacy - 10
Healing - 20
Spirituality - 40
Resurrection - 80

4th byte
Enchantment - 01
Wizardry - 02
Charm - 04
Occultism - 08
Demonology - 10
Necromancy - 20
Conjuration - 40
Pyromancy - 80

5th byte
Sorcery - 01
Herbalism - 02
Meditation - 04
Summoning - 08

After that come the spells. 00 means there are no custom choices made, 01 means the custom selection check box is checked. If 01, it is followed by the short bc 00, then 34 bytes of data where each byte contains a binary addition indicating which spells are available. (I'll get the codes for each spell at some point)

Next come the artifact carryover properties. These start with the int 00 00 f8 00, followed by 31 bytes of data, where each byte contains a binary addition indicating which artifacts are carried in from previous scenarios. After that is the int 00 00 f8 00, followed by 31 bytes of data, where each byte contains a binary addition indicating which artifacts are to be carried out of this scenario. (I'll get the codes for each artifact at some point)

The AI properties come next, and are preceded with 00, followed by a short indicating the number of artifacts to follow. After is a short for the artifact code, followed by a byte for the priority (01 high, 02 vital). After the artifacts comes parchments, which are preceded by a 00 00, followed by a short indicating the number of parchments to follow. Then a short for the parchment code, followed by a byte indicating the priority. Next are the scrolls, which are preceded by a 00 00, then a short indicating the number of scrolls to follow. Next, a short for the scroll code and a byte for the priority.

And finally, as I said, are the adventure / landscape objects, in the order they were placed on the map (above and below ground are mixed together).

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Mar 13 2016, 7:50

Can't you use the code info about skills, spells, creatures etc. available in the modding treads?
I would assume that would be faster than having to track all of it yourself, at least if you can see matches along the way.
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 13 2016, 16:02

For the codes in something like the combat script, then I can probably use the ones, if there is a complete listing, in the modding threads, but the codes I mention above are the codes that map check boxes to artifacts and spells. Each byte has up to 8 items associated with it (as shown above with the skill codes).

It won't take too long to figure out, it will just be a little tedious :)

Unselect all check boxes -> select one at a time and look at the file -> write down the hex value and byte location (1st byte, 2nd byte, etc.).

There's also a pattern with the codes that I could use. They're usually in the order that they appear in the editor :)

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 14 2016, 19:45

Map hex values will be usefull to decodeing exe file for modding game. So note all you find.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 15 2016, 1:34

Getting the codes will be easy, just time consuming. I have to put a stack of creature types in a combat script and then just write the code.

Currently I'm looking at reading in a castle / town. Lots of fields on those, but some of them are similar to things I already know how to read in so I can probably re-use. So far I see 3 types of map objects: towns, armies, and decorative. Quest huts will probably be a 4th type, and gates may be a 5th. So many objects.. I'll probably be on them for a little while.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 16 2016, 22:24

I can parse and write towns and random towns. Next I'll work on reading / writing armies, then quest huts, then decorations, and then mines and treasures. Dang, there are a LOT of object types >.<

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 17 2016, 5:16

Rather than post all the "how to read"s I've been posting, I'll simply post about what I can read / write to file, and end the post with the following link.

It is a google drive document that I update with how to read a .h4c file step by step.

I'm about to test reading in armies with creatures and heroes, so we'll see how that goes :D I've successfully read in an army without a hero, so the only new thing to test is reading an army with a hero in it.

The triggered combat scripts, garrisons, and army objects all represent the army slots in the same format, so I'm excited to (at some point) try adding a hero to a triggered combat script to see if that works (or crashes the game) :D

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 17 2016, 8:00

Successfully tested reading / writing maps with armies that have heroes and creatures. Think I'm done for the night :)

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 17 2016, 11:25

Good news! Hard work!
Thanks for guide. Its material to modders. If you finished I suggest making download link i CH. Another people can read it, not to decoing once againg. Its important to archivize all infos.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 17 2016, 19:55

Went through and collected all the creature hex codes:

01 - Air Elemental
02 - Angel
03 - Ballista
04 - Bandit
05 - Behemoth
1a - Berserker
06 - Black Dragon
07 - Bone Dragon
47 - Catapult
08 - Centaur
09 - Cerberus
0a - Champion
0b - Crossbowman
0c - Crusader
0d - Cyclops
46 - Dark Champion
0f - Devil
10 - Dragon Golem
11 - Dwarf
12 - Earth Elemental
13 - Efreet
14 - Elf
05 - Evil Eye
44 - Evil Sorceress
15 - Faerie Dragon
16 - Fire Elemental
48 - Frenzied Gnasher
45 - Gargantuan
17 - Gargoyle
18 - Genie
19 - Ghost
43 - Goblin Knight
1b - Gold Golem
1c - Griffin
1d - Halfling
1e - Harpy
1f - Hydra
20 - Ice Demon
21 - Imp
22 - Leprechaun
23 - Mage
24 - Mantis
25 - Medusa
49 - Megadragon
26 - Mermaid
27 - Minotaur
28 - Monk
29 - Mummy
2a - Naga
2b - Nightmare
2c - Nomad
2d - Ogre Magi
2e - Orc
2f - Peasant
30 - Phoenix
31 - Pikeman
32 - Pirate
33 - Satyr
34 - Sea Monster
35 - Skeleton
37 - Sprite
36 - Squire
38 - Thunderbird
39 - Titan
3a - Troglodyte
3b - Troll
3c - Unicorn
3d - Vampire
e - Venom Spawn
42 - Waspwort
3e - Water Elemental
3f - White Tiger
40 - Wolf
41 - Zombie

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Mar 17 2016, 20:05

Alphabetical list plus addons. See there:
http://heroescommunity.com/viewthread.php3?TID=37350

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Mar 17 2016, 20:12

The list there is in hex (number) order where the one here is in alphabetical, but it's nice to see that the numbers seem to match up :)

Looking at parsing quest huts now!


Return to “Heroes I-IV”

Who is online

Users browsing this forum: No registered users and 10 guests