Random map generator

Hi guys,

Thank you for keeping alive this game !!!

I am playing this game since 2000, even now I play via Hamachi with my friends weekly.
We are playing WOG, but only few rules (heroes are moving double, 2 extra skills, none of WOG buildings and artifacts).
We are playing random maps only (XL, 2 players, 200%,2 min).

Only now I found your project, I installed, but the random maps is not working.

I will appreciate some help with random maps.

Thank you,

PS - mirror zones is the best idea for random maps, our main issue is the luck !!! We want to see who is the best, without luck !!! - so I vote for mirror zones :slight_smile:

Random map generator in VCMI at the moment is, well… not generating random maps. Keep in mind that VCMI is still work in progress, you can encounter some odd things like bugs, crashes, freezes or some missing functionalities (just like this one). Temporary solution is to generate such map in H3, and then use it in VCMI.

Does anybody know how to get a wogified random map from the WoG random map generator (original game) into VCMI? Since the random map generator is unfinished (and unusable? I’d like to see what it’s currently capable of first hand) I’d like to play a random map generated by the original game’s code in VCMI. This is doable, but not with the wog structures and additions that come from wogification.

Is there a way to wogify a .h3m file? Is there a way to convert a H3 saved game into a map or a VCMI save? Is there some other way to play a random WoG map in VCMI? Thanks.

You can run WoG maps in VCMI normally. Just new objects won’t work.

I know that wog maps will run. But I don’t know how to get a random wog map with the structures that wogification creates. In WoG, wog structures are added via a process called wogification when the game starts. There’s never a h3m map with these structures added.

So my question is, is it really the case that there’s no way to play a map in VCMI post wogification?

I have the “HoMM Complete” Version from Purple Hills and I installed VCMI on it. It’s working fine. Just the random map generator says “Could not create a map that fits current choices.” when I select a map size bigger than medium.

Is this a normal limitation or is it a bug?
If it’s a bug, does somebody know how to fix it?

Thx in advance!

This is not a bug, current RMG cannot generate maps larger than medium. RMG is work in progress.

I played only random maps in WOG/Hmm3. And I waited for HOTA to implement random map generator. And two my friends also preferred random map in single play. (One of reasons is that human created maps often lack quality and have few map elements per square cm.

Random generator is the most wanted feature I wait except spells modding system.

PS I dreamed today about realizing XXL maps (or even bigger) in VCMI. And about several levels of map. Like not only earth and dungeon, but to 3-10 levels at least, also in multiplayer.
Like it was in Age Of Wonders. So game can became not rush and trying to kill enemy heroes spreaded on map. But real long-term exploration. With a lot of monsters, artefacts and difficult battles for adventure enjoing.
This will require change of current Earth/Dungeon button behavior. I think it’s better be cyclically changing buttons 1/2/… depending on number of layers chosen.
It was one of requested HOTA features in early years, but they still didn’t implement additional levels yet.
Just imagine making map with 8 layers about 7 levels of Dante’s Inferno:-). Or sky level (with terrain like clouds and some celestial beeyings. Or some deeper dungeons with stalagmites. Or submarine level with some only sea beeings and underwater objects and town like Abyss.

one thing you could use to generate the maps is order 1 makov chain

if you dont know what map generated order 1 makov chain is:
you would basically create a good map(s)
then you would split it into a square grid.
then you would get the statistics of map (what is the % of quares that have water…)
then you also get neighbour statistics (what are the things usually adjacent to a water tile???)

to generate the map you generate a random tile at random based on how likely it is to a tile be of a specific type.
Then you generate adjacent tiles at random based on how likely it is to a tile be adjacent to a tile of that type.

Important thing 1:
A square tile is adjacent to 4 tiles (up down, left and right [or 8 if you count diagonals]), a important thing is to create a generation pattern that most of the time you will be generating square tiles with alot of already generated adjacent square tiles.
As some example if you generate square tiles of the first row from left to right, then of the second row from left to right, then the third… you will generate a X pattern.
A way that could fix that, is generate a random square and then generate a random square between the ones with the most amount of already generated adjacent squares, then again generate a random square between the ones with most amount of already generated squares.

Important thing 2:
As you see this could generate maps with less than the amount of towns wanted or with different towns than the wanted ones. There are 2 ways to solve the problem

More literal one and one that takes more time:
Generate map until one dont come with this problem.

Faster one:
Before generating the map put the cities at random places. And then you continue to generate the map from this.
:->

How’s the work is going for RMG?

I thought about possibility to make “sea” default terrain for some towns. Is it possible? It’s complex thing, so faction heroes must act as boats on water altrough (WATER_WALK is not sufficient - it requires to end on land).

And second - long ago was talk to allow placing creatures on water when random map generation/week of monster. It requires some non-needed for most other creatures flag like “seaCreature”:true (or better variant “terrain”: “sea” (or any other terrain). By default terrain for creature must be taken from faction, if it is not set in creature itself.
Sea creatures can be placed to guard sea visitable objects or on whirlpools for example (hero exits whirlpool and gets attacked).

Okay, I finally merged jfhs’s patch. Managed to compile it and match to changes over last months.

However, RMG crashes at attempt to launch map, showing something in the depths of engine.
So I tried to launch old RMG with latest develop branch. However, it doesn’t work correctly either.
Map loads, at least, but it shows that the tile closest to hero is guarded (sword arrow). I need to attack that tile to ever move, but then game crashes :frowning:

RMG works more or less now, time to make it actually worthwhile.

I’m going to start first with zone placement. Will give up Voronoi partitioning and go for non-euclidean distance function. Here are example results from Matlab (with script, if you can use it):

i118.photobucket.com/albums/o102/DjFaust/VCMI/RMGzonesExample_zps691fb83b.png

It seems to generate somewhat smooth and balanced zones. In original RMG sometimes they used to be bent beyond playability.
RMGmatlab.rar (668 Bytes)

Yay, progress!

Just wondering - have you tried to create a rectangular map? Engine should support such but so far there was no way to create such map.

36x36 example isn’t far from it while 144x144 zones are just too smooth. Perhaps scale parameters so any map size will create zones like on 72x72 example?

I just tried, template size limits are the issue now. Well, maybe another time :wink:

For that reason I suggest to specify template size in absolute value and not fixed letter.

I noticed that your “distance” (strictly speaking , it’s not, but it looks good and organic!) is not symmetric under x <-> y exchange (hence it creates oblong regions). Is it intentional?

This is just how this algorithm works, there is nothing more in it :P. I’ll try scaling parameters as Ivan suggests to create more rounded zones with every map size.

BTW, the idea of non-euclidean distance was suggested by Tapani who made custom RMG for Heroes 5.

I don’t mean the pseudo-distance being non-Euclidian (in fact, it’s not a “non-Euclidian distance” at all, a non-Euclidian metric is bilinear and symmetric, that is, it can contain dx^2, dxdy, dydx and dy^2 only, your version is neither bilinear nor symmetric —but again, this pseudo-distance generates organic-looking zones).
What I mean is more related to aesthetics than mathematics: do you prefer to have wide-and-short areas rather than rectangular ones? Your “metric” is non-symmetric.

Edit: I checked Heroes 5 RMG page, apparently he only used a different p-norm only (with p=1/log2(1.5), Euclidian norm is p=2).

I believe regular zones are better, as long and narrow ones tend to be cluttered, blocked and in general irritating.

And yes, this metric must be non-symetric to generate complex shapes.

?
These two statements contradict each other given that “long and narrow” happens for “non-symmetric” distance. Am I making some mistake?

If you want to have complex shapes, you might want to do this instead: using position-dependent coefficients in front of each f(dx,dy) (currently they are constant factors like 1, 0.03. etc.). In doing so, you can also include a decaying damping factor for each term such that fancy irregularities do not dominate (but still contribute) as you move towards the characteristic length (that is, the Euclidian distance between the town and it’s border), and the fancy irregularity function should have a low gradient in this regime (such that you won’t get rapidly oscillating/zig-zaggy borders) (an inverse power-law should do).
Also, each term can contain random-constant factors, however it’s probably keep these random number close to each other to avoid balance issues.

But metric should not depend on position, just on distance betwen points A and B.

The only issue I see now is that on very small or very large maps x or y dimensions dominate the metric. The solution is to scale coefficients proportionally to map size (or use relative values instead of absolute coordinates).

I would like to have randomized center positions of zones, but constant (thus reliable) metric.