Random map generator

We absolutely don’t need templates with this size in H3.

It was discussed many times - implementation of multiple levels is quite complex. How would Subterranean Gates work, for instance? What about Cartographers? Level switch button?

It also requires changes in map format and pathfinder.

New map format itself has support of multiple level by design.

That’s simple. Press once and get to dungeon 1. Press next and go to next level. Press last and return to dugeon 1.
Same with surface levels (if there will be some)

How they work in HMM3. we get x,y coord for entrance and search most close subterra gate in all dungeons (or in z+1 dungeon).

Let we have 3 gates on same x,y on 3 levels. How they should work?

On surface level 1 you enter gate, and it leads you to level n-1 (to subterra level 1).
On subterra level 1 you again press space and gate leads you to level n-2 (to subterra level 2).
On subterra level 2 you press space and get back in subterra level 1, then to surface.

What if subterra level 2 has only 1 gate, and subterra level 1 has 2 gates (map editor was not able to do good map)? You can make reverse check. Is this level 2 gate is closer to first gate on level 1 than to second gate, it will only work with first gate.

Another way is to have subterra gates like monoliths - add several types of them and use only subgates of same type.

This is the only way that will work with different amount of gates in levels. Also it will require many types of gates. IOW we need to implement advanced teleport mechanics for sub-gates first (make them equal monoliths but retain compatibility with original or make them configurable - explicit teleport channel). Only when it will work for 2 levels, we can go forth. (Same for cartographers)

Pathfinder will just work. Though as mentioned already subterranean gate would need rework.

New templates, 150 of them! With new Hota, WoG and Axolotl creatures:

Nice! How to get’em?

Today I ran profiler and optimized some suprising parts of code. Generation time for Jebus XL+U was cut down by about 60%.
Further 40% could be improved by rewritting WeightedRule class from CMapEditManager. It uses a lot of expensive string copying and comparison, which should be replaced with enum or something.

Can water generation be expected in near future?

Well, I don’t have much time recently - better just polish existing game instead of adding new features.

I know very little about RMG code, but since you started to optimize it I gave it a try with Valgrind. Most interesting part of object creation already have your comment, but other weird thing I found is that TerrainViewPattern::WeightedRule::isStandardRule use quite a bit (5%+) of CPU time since on large map it’s called like 40-50 million times.

Can something like STRONG_INLINE help a bit there?

This function should be replaced with just one cashed field.

Implemented.
Reduced string usage and added caching for flipped patterns -> about 50% performance improvement.

One thing I wounder about with current git version of RMG.

Why every player-owned town have some impassable object right under the entry (where hero stay)?

I din’t know really. So far my interest was only to ensure zone passability.
Maybe it’s just optimal to route path diagonally.

But road does not fit there. Roads can`t be diagonal.

Hello,

I am a bit confused with random map generator, does it work? I don’t have a rmg.json in my config, do I have to create one? How? Is there templates available and if so how to apply them?

Sorry for silly questions but I better be safe than sorry,

Thanks for response, cheers

All available templates are in vcmi\defaultTemplates submod included in 0.99 release.
There in no single rmg.json anymore. Also there is a conversion tool (see wiki.vcmi.eu/index.php?title=Mod_list#Utilities) to convert rmg.txt temples to vcmi format.