Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 4 - Lands of Axeoth > Thread: Random Map Generation
Thread: Random Map Generation This thread is 2 pages long: 1 2 · NEXT»
Krisys
Krisys

Tavern Dweller
posted June 07, 2021 02:33 AM

Random Map Generation

It is always terribly hard to find any reliable information about Heroes 4 online, so I thought I'd have better chances just asking it on the forum.

Is H4Util still the best solution for random map generation on Heroes 4? And if it is, are there any tricks to generate less errors / warnings, and create more interesting / aesthetically pleasing maps? I'd love to play some randomly generated maps, but the lack of sense in biome transitions on the H4Util generator kinda puts me off.

Bonus question: if anyone has access to the H4Util source code, I'd be really curious to look into it / tweak it a bit.

Thanks in advance!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted June 07, 2021 04:56 AM

Krisys said:
It is always terribly hard to find any reliable information about Heroes 4 online, so I thought I'd have better chances just asking it on the forum.

Is H4Util still the best solution for random map generation on Heroes 4? And if it is, are there any tricks to generate less errors / warnings, and create more interesting / aesthetically pleasing maps? I'd love to play some randomly generated maps, but the lack of sense in biome transitions on the H4Util generator kinda puts me off.

Bonus question: if anyone has access to the H4Util source code, I'd be really curious to look into it / tweak it a bit.

Thanks in advance!


H4Util is still the only thing that does any sort of random map generation at the moment.

There aren't any tricks that I personally know of, and I'm not sure there actually are any tricks to make the generated maps better. I don't think they have any sort of reasonable random map algorithm.

If someone had a good algorithm for generating a random map, I could translate that into code for the H4 Advanced Options Map Editor to give it a random map generation feature. It was on my list to get done one day, but there's some higher level math I'd need to revisit and some that I'd need to learn to get the algorithm right, so I haven't done it (too many projects to finish as well).

As far as source code, I was never able to find it while I was working on the Advanced Options Map Editor and Resource Editor, but I do know almost all of the inner workings of .h4c files, and I do have an open source gitlab repository with all of my code to parse h4 maps and resource files. The link for it is posted in the H4 Resource Editor thread (stickied on this forum).

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NimoStar
NimoStar


Responsible
Legendary Hero
Modding the Unmoddable
posted June 07, 2021 06:09 AM

I personally generate random maps with complex, multi-layerred brushes within the default map editor.

It does not troubleshoot the pathfinding so some things may get blocked, better to check manually that.

However H4Util maps are, sincerely, an unplayable mess with even terrain graphic buygs (not to mention crashes), so I still prefer my method... which, despite structural limitations, is still aesthetically pleasing, customizable and playable.


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Krisys
Krisys

Tavern Dweller
posted June 07, 2021 02:13 PM

Alright, thank you both for your fast answers!

Quote:
If someone had a good algorithm for generating a random map, I could translate that into code for the H4 Advanced Options Map Editor to give it a random map generation feature.

How precise an algorithm do you want? Do you think you could redo something along the lines of H3 / H5 map generation?

Quote:
As far as source code, I was never able to find it while I was working on the Advanced Options Map Editor and Resource Editor, but I do know almost all of the inner workings of .h4c files, and I do have an open source gitlab repository with all of my code to parse h4 maps and resource files. The link for it is posted in the H4 Resource Editor thread (stickied on this forum).

I'm really curious to look into it, thanks!

Quote:
I personally generate random maps with complex, multi-layerred brushes within the default map editor.

Do you have any tutorial for that kind of generation? I guess it won't allow to generate any sensible areas with logical treasures / mines / guards / dwellings repartition though :/

Quote:
However H4Util maps are, sincerely, an unplayable mess with even terrain graphic buygs

I mean, I've played through several ones, and they can work pretty well if you avoid the maps with warnings / errors, but uh, the algorithm could be better in many ways.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted June 07, 2021 05:45 PM
Edited by iliveinabox05 at 17:47, 07 Jun 2021.

Krisys said:
How precise an algorithm do you want? Do you think you could redo something along the lines of H3 / H5 map generation?


High level is always a good place to start, haha

I haven't ever looked into how H3 / H5 did things, so I don't know.

As I was thinking about it, a "wheel" map where starting towns make up basically a wheel around the center of the map would be relatively easy and not require any crazy math stuff. Just take the center of the map, find a radius that fits inside the map, then divide the circumference by the number of towns and use that arc length to find start locations, etc.

But any thoughts are certainly welcome and may help me figure things out.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Baronus
Baronus


Legendary Hero
posted June 07, 2021 08:44 PM
Edited by Baronus at 20:47, 07 Jun 2021.

Baronus

Use H4 util. Theres a lot of options so you can add your preferences and scripts. Maybe look is not perfect but are better than orignal when often is two cities only. Ive played and gameplay was satisfied. Not a lot obstacles is good option.
But just try and generate some maps and look in editor you want or not. Its very fast.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Krisys
Krisys

Tavern Dweller
posted June 07, 2021 10:16 PM

Quote:
I haven't ever looked into how H3 / H5 did things, so I don't know.


There aren't a lot of infos online, but [url=http://www.heroesofmightandmagic.com/heroes5/heroes5_fan_rmg.shtml]here's some general lines of the original fanmade map generation algorithm for Heroes 5[/url] if you're interested. There might be some information to be obtained from the Heroes 5.5 team about the advanced RMG though. I might try to think something through myself as well.

Quote:
Use H4 util. Theres a lot of options so you can add your preferences and scripts. Maybe look is not perfect but are better than orignal when often is two cities only. Ive played and gameplay was satisfied. Not a lot obstacles is good option.
But just try and generate some maps and look in editor you want or not. Its very fast.


Yeah, I did use it several times, I was just wondering if there were any better options out there. Thanks for confirming that there aren't ^^ I did notice that using too many obstacles often lead to too cluttered maps. Also limiting the number of "biomes" to 2-3 generally generates more aesthetically pleasing maps. I welcome any other advice about using it.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Baronus
Baronus


Legendary Hero
posted June 07, 2021 10:55 PM

I didnt play a lot rmg maps and I have small experience with it. And options is a lot. It needs some ability. But when I discovered that we have rmg in H4 I was very happy! For me its first fail this game. First hereoes without rmg. Sad ,innovation'. I know thats far from finished tool. But its enough to good gameplay. H3 rmg is not finished too. Serpent fly object spaming. Weird placed portals. Sometimes areas without acces. But maps are very interesting.
I agree we should write our experiences with this tool. Big mistake is no option for regulatiin water area. No way to have isles. Only manually correction. But its not major problem. Thanks for biom info. I must taste it.

I heard about using "all objects brushes" option. But it didnt give better results than H4Utill. And chaos is bigger than this rmg.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted June 07, 2021 11:09 PM

Krisys said:
There aren't a lot of infos online, but here's some general lines of the original fanmade map generation algorithm for Heroes 5 if you're interested. There might be some information to be obtained from the Heroes 5.5 team about the advanced RMG though. I might try to think something through myself as well.


That's some pretty decent info for the approach of things, and does look pretty similar to what we were looking at doing with Equilibris.

Only issue is that it only takes into account 1vs1 maps, though that is probably a good place to start and should be extendable to more players.

Unfortunately the guy who had started doing a lot of work for the H4 RMG lost almost all of his code at one point, and then disappeared. Would have been great to have that starting point, since he had done a lot of the player zoning and pathing.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Krisys
Krisys

Tavern Dweller
posted June 08, 2021 12:13 AM

Quote:
Only issue is that it only takes into account 1vs1 maps, though that is probably a good place to start and should be extendable to more players.


Technically extending it to N players would just require to generate 1/N of the map, and copy it by applying a rotation of 2 Pi / N to it. Easier said than done, sure, but once there is a way to generate the part of the map for a single player, the rest should be simple enough.

Quote:
Unfortunately the guy who had started doing a lot of work for the H4 RMG lost almost all of his code at one point, and then disappeared. Would have been great to have that starting point, since he had done a lot of the player zoning and pathing.


Aw that's really a shame... It would be way easier to start working on something existing.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted June 08, 2021 12:59 AM

Krisys said:
Technically extending it to N players would just require to generate 1/N of the map, and copy it by applying a rotation of 2 Pi / N to it. Easier said than done, sure, but once there is a way to generate the part of the map for a single player, the rest should be simple enough.


Right, except that the whole mirroring of the path thing sort of only works for 2 players. I guess it could be mirrored from player zone to player zone, with just moving the line to mirror about between the next two zones.

That isn't difficult math at least

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Baronus
Baronus


Legendary Hero
posted July 07, 2021 06:35 PM

Fastes way to have powerfull and good working RMG for HIV is... H2 or H3 to H4 map converter :0))). Because prograsmming alghoritms to have good looking and logical planned map is big work. But converter is easy work! Only convert pikemans h2/3 --> heroes 4 pikemans. So replace eg 4d to 3c. And in this way all objects. Terrain to terain monster to monster town to town etc. In thus way we would use H3 or H2 very good RMG and simply convert to H4! First class maps. So priority is map converter not generator.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted July 07, 2021 07:10 PM

That's actually a pretty good idea, but the advanced options map editor would either need to be able to parse H2/H3 files to then convert them, or another program that already knows how to parse H2/H3 files would need to be able to generate a new file with a list of objects, terrain, and etc. that the advanced editor would then read.

It's kind of a bit of work either way unfortunately.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NimoStar
NimoStar


Responsible
Legendary Hero
Modding the Unmoddable
posted July 07, 2021 07:30 PM

A map converter would actually be pretty magistral. H4 already has more map objects than H2 or H3, so to choose which to convert would not be so hard.

In any case as iliveinabox says, you would have to do a bit of work.

Also convert distances. H4 distances are greater. And H3 allows diagonal movement in otherwise blocked tiles, while H4 doesn't.

Anyways, I think the difficulties would be worth it to have thousands of good classic maps in any case. But not a so trivial project.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Baronus
Baronus


Legendary Hero
posted July 07, 2021 07:47 PM

One object can be randomly converted to some others.
Eg Megadragon has 25% chance to convert to faerie, cristal, blue, sulfur dragon = 100%. In this way all more than single alternative object.
On the other side two to one eg pikemans,halberdiers to h4 pikemans.
Terrain is rather simply the same.
If map has little bit weight can be randomly reduced empty terrain or added empty terrain by dubbling 2-3 lines. It should not make map ugly looking.
...

Converter like this is more usefull than only rmg to h4. Because you can only generate random h4 maps and thats all. In this case is the same plus: converting a lot of h3 maps to h4. Converting h4 maps to h3 maps. We have a thousands new maps! We can play old stories in H4 way eg. Tarnum maps. And of course its work but not so big like rmg! But effect is bigger! In fact if we have converter problem rmg for h4 is solved.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NimoStar
NimoStar


Responsible
Legendary Hero
Modding the Unmoddable
posted July 07, 2021 08:02 PM
Edited by NimoStar at 20:06, 07 Jul 2021.

Random some things from more or less h3 and h4 alternatives is a good idea.

However, randoming faerie dragons into megadragons is not. We already have functional faerie dragons. Only thing necessary to adjust is the number for balance.

If anything the hard part is monsters with no direct equivalent. Example, what do we turn Wyverns into? What about Mighty Gorgons? Or things like Magic Elementals? A whole thread would have to be made just for finding equivalents in conversion.

Making distances x2 (which is area*4) will be the best approach. Even then there are things to script, like teach that diagonal stretching from H3 maps prioritizes the space to pass, while horizontal/vertical stretching prioritizes mountain ranges/forests to block. Blocking map pathways is key in any Heroes game, so special acare has to be taken here.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Baronus
Baronus


Legendary Hero
posted July 08, 2021 01:24 PM
Edited by Baronus at 13:29, 08 Jul 2021.

Baronus

Not always primitive 1:1 conversion is sensible. Most important is faction.
So nature must be converted to rampart and conflux
So conflux is h4: phonix pixie 4 elements and  mantis to magic element!
Rampart is :wolf to centaur! leprechun to dwarf elf to elf tiger to pegasus waspwort to ent unicorn to unicorn and faerie to gold dragon!
Because in H4 farerie is not powerfull special unit but usually 4 lvl unit! So converting it may generate errors in some maps.
And this way we have faction to faction converting.
Death rather simply can be converted to inferno and necro.
Life to castle . Ballista to griffin! and squire to pikeman! And piekeman as neutral maybe.
Might to stronghold but harpy to roc nomad  to wolfrider centaur to orc berserker to goblin.
Firebird may be as faerie or other strong dragon.
Academy  to tower halifing to gremlin! Dwarf to gargoyle. Dragongolem eg sulfur golem!
Chaos as dungeon and citadel. Efereti as manticore.
Bandit as gnoll orc as reptilion pirate to fly troll as basilisk nightmare as gorgone goblin knight to vywern.
...
As you see its not 1:1 but faction to faction. Because a lot of map was planned to play special faction and if we convert units from 3 other factions eg to starting army it may generate problems!

Ground lvls is biggest problem. Maybe random ground deformation?! Easiest way simlle eliminate it. In next update add deformation.
For H3 we have now 36,72,108,144,180,216,252,288 sizes!!! So we can use nearest size.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Maciek
Maciek


Known Hero
posted July 08, 2021 07:27 PM

RMG algorithms from the internet

Entering these words into google: heroes 3 rmg algorithm
returns 2 results (among other results) which may be of some use to you.
1. Some kind of presentation about rmg by Gus Smedsted:
https://en.ppt-online.org/29091
2. Some kind of scientific paper about making h3 random maps:
https://www.researchgate.net/publication/328307880_Strategic_Features_and_Terrain_Generation_for_Balanced_Heroes_of_Might_and_Magic_III_Maps
Sure, these are about h3, but I think the ideas described there are general enough to apply to h4. Also, that paper is fairly fresh, so some of the authors could still be interested in the topic.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NimoStar
NimoStar


Responsible
Legendary Hero
Modding the Unmoddable
posted July 09, 2021 01:33 AM

Quote:
Our ambition is to develop a map generator for Heroes of
Might and Magic III (HoMM3) [25] which could be widely
used by the game’s community.


If it opnly said HoMM4 community, since we have no RMG at all while HOMM3 already has several ones including one with the official game...

POOOOLES!
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Baronus
Baronus


Legendary Hero
posted July 09, 2021 09:05 AM

All new generators are welvome very much! Thanks.
But now we need rather h3 map structure description. Ilive has it for h4. But it must be very similar because both are gzip files! And you can simply unpack by all uncompress tool!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 2 pages long: 1 2 · NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0573 seconds