Random map generator

Contrary to Sav’s list, freelancer Guild does not seem to appear on random maps. In fact it turned out to be very spammy with these settings, so I set limit per zone to 1.

It may be useful

forum.heroesworld.ru/showpost.ph … ostcount=8
forum.heroesworld.ru/showpost.ph … ostcount=9

and over heroesworld.ru/forum/showthread.php?t=6313

Isn’t it so then there are too many WOG creatures on these last screens?
They seem to be placed too often compared with classic creatures

I meant we don’t have parser for original templates :laughing:

sorry for my english, you mean the template editor? like this forum.heroesworld.ru/attachment. … 1276110872

Okay, that worked!

Well, it’s not good if the game allows to run high resolution without graphics and outputs no meaningful error message.

BTW: I can’t generate random map with current build (crash), but I see you posted some on DF2 forum?

Of course. Fix already in git.

Because it worked for me?

Now after testing a bit more I do agree with you - RMG fails under some conditions (broken RMG option?). Looks to be crash on server in CMapGenerator::getMapDescription() method.

Besides - right now we have too many situation that result in “Could not create random map that fits current choices” message. For example we can’t generate XL 8 players map.

This means that we should either:
a) set up import of rmg.txt
b) create big enough set of our own templates. Perhaps even use tournament-oriented rmg.txt as base instead of using H3 templates.

UPD: and now when I actually started running VCMI under debugger I can’t catch that crash :frowning:

Ok, I got it.

For now we should first have working and playable maps for SOME templates as well as complete template format, only once this is done we could think about more templates.

And what’s still missing in RMG? I though that the only remaining part was nice object placement which does not affects playability. Generation of random quests does not seems to be present either but I won’t call it essential for playable maps. What else?

And if there are important pieces missing - maybe we should (temporary) increase max size for current templates? This will decrease amount of “can’t generate map” errors even though generated maps may have too much of empty space.

Uhm, game crashes as soon as any object is removed. Was even worse, but I added some workarounds against it.

There are templates that in total support all map sizes but S with no underground. Unfortunatelly they also need specific number of players to work, unlike original templates. For example, you can’t start Jebus with less than 4 players.

On number of players - perhaps we should handle it like this:

  1. assume any “free” human/AI slots to be AI-only (e.g. solo RMG game with 4 human or computer players -> 1 human zone + 3 AI zones)

  2. Same for template - we can accept template if there is enough human slots AND enough total players (AI’s will take human zones if no AI slots are free)

This will a bit increase number of available templates - for example we already have one with AI-only slots. Won’t surprise if this is how it works already though :slight_smile:

  1. Possibly (or user-selectable) - allow empty starting zones. This may create some balance issues - neighbors will have “vacuum” near their lands allowing them to expand easily.

And what do you think of current RMG dialog? It’s obviously far from perfect and AFAIK all other H3 projects made some change in it already (Era, WoG, HotA). Perhaps we should try to reorganize it as well?

And I guess I should move some posts from here to RMG thread…

Okay now everybody, there is fundamental flaw in RMG design:

Map is generated twice on Client and Server. Same random seed is used. However, all objects are created (and allocated) twice so that both maps are inherently out of sync, an in fact are two deep copies of same map.

You may remember, however, that eraly version of RMG created by BeeGee worked nicely. How this is possible and how to solve this problem?

Some (hopefully) simple idea for now: generate map once at server, then serialize it and send to Clients. This would also cut generation time by half.

May order of elements be different in some containers in client/server?

I`ve seen several unordered maps/sets somewhere in the codebase.Are any of them involved in RMG?

We do use unordered maps/sets but don’t forget that they are mostly ordered (by some hash). So as long as elements are added in the same order and on the same system (same hash generator) everything should be OK.

Unless pointers are used as keys in containers (both C++03 containers and new unordered ones) we should be OK.

And to answer you question - no, there are no references to unordered in RMG. And I have no idea what’s causing it either. Will look into it once I’ll fix my branch. Maybe even today.

Oh, that is even worse. Any looping of ordered set of pointers or any map with pointer key = desync.


map->addBlockVisTiles was called twice, which led to only-partially-present adventure map objects and tons of bugs. My fault of course.

If the copies are the same, then they are in sync.
Basically, they should be the same except for pointer addresses that are obviously different (separate processes have their own address space). This should not cause any issues, since objects are referred by the id number (that is also the index in objects vector) and the ids will be the same in both copies.

The idea is good.
However, it might be as little tough to get the serializer to produce desired result — to pass the whole map (with objects) it needs to create a deep copy. However, in such mode, it will also allocating copies of objects from handlers (like CHero, CArtifact and so on).

Can someone dump map objects settings to JSON file?
I played with “mine”, tried to add new template with diff. graphics:

	"core:mine" : {
		"types" : {
			"orePit" : {
				"name" : "Ore Mine",
	//	"handler": "mine",
	//	"rmg" : { "value" : 1500 , "rarity":100},
				"templates" : {
					"newTemplate" : { "animation" : "newobjects/mines/oreMine.def", 
					"visitableFrom" :  "---", "+++", "+++" ], 
					"mask" :  "VVVV", "VVVV","BBBB", "VABB"], 
			//		"allowedTerrains":"snow"] 

But seems, that by defining my new template, I replace whole set of templates for mine. So I need to again write all templates loaded from original files, to make other mine appearances functioning at one time with new.

Warmonger, could you please have a look at github.com/vcmi/vcmi/pull/55 ??
I’ve found a copy-paste error in RMG and not sure whether fixed it correctly or not.

I tried random maps. Key experience. What are lacking so it road. At least one type. Even at such a primitive teamplate as jebus very hard to figure out where to go.

near the wood and ore mines need to lay down Sluch way for a handful of 1-3.
very few homes creatures and hives.

  • Create a map - jebus XL-U, L+U on 4 players. why not create L-U ? why not create a 2 player? need only 4. Bug or not yet implemented?