Need some help with modding

I now have another problem, so i can’t do more tests. The server crashes. I have disabled all mods and tried one of the original maps, but still crash.

Console output:

Error: signal 11 :
/usr/games/vcmiserver(+0xdc452) [0x562216982452]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7fe05bcdc520]
/usr/lib/x86_64-linux-gnu/vcmi/libvcmi.so(_ZNK21CObjectClassesHandler15knownSubObjectsEi+0x57) [0x7fe05c5778c7]
/usr/lib/x86_64-linux-gnu/vcmi/libvcmi.so(_ZN13CMapLoaderH3M11readObjectsEv+0x4ef) [0x7fe05c5eeeff]
/usr/lib/x86_64-linux-gnu/vcmi/libvcmi.so(_ZN13CMapLoaderH3M4initEv+0x701) [0x7fe05c5e81f1]
/usr/lib/x86_64-linux-gnu/vcmi/libvcmi.so(_ZN13CMapLoaderH3M7loadMapEv+0x42) [0x7fe05c5e8612]
/usr/lib/x86_64-linux-gnu/vcmi/libvcmi.so(_ZNK11CMapService7loadMapERK10ResourceID+0x4d) [0x7fe05c5ddafd]
/usr/lib/x86_64-linux-gnu/vcmi/libvcmi.so(_ZN10CGameState11initNewGameEPK11IMapServiceb+0x935) [0x7fe05c7a6795]
/usr/lib/x86_64-linux-gnu/vcmi/libvcmi.so(_ZN10CGameState4initEPK11IMapServiceP9StartInfob+0x364) [0x7fe05c7a9b24]
/usr/games/vcmiserver(+0x753c4) [0x56221691b3c4]
/usr/games/vcmiserver(+0xf816a) [0x56221699e16a]
/usr/games/vcmiserver(+0xdef14) [0x562216984f14]
/usr/games/vcmiserver(+0xe1cbc) [0x562216987cbc]
/usr/games/vcmiserver(+0xf184a) [0x56221699784a]
/lib/x86_64-linux-gnu/libboost_thread.so.1.74.0(+0x150cb) [0x7fe05c20a0cb]
/lib/x86_64-linux-gnu/libc.so.6(+0x94b43) [0x7fe05bd2eb43]
/lib/x86_64-linux-gnu/libc.so.6(+0x126a00) [0x7fe05bdc0a00]
Lost connection to server, ending listening thread!
read_some: End of file
Error: server failed to close correctly or crashed!
Check /home/siegfried/.cache/vcmi/server_log.txt for more info

The end of the log file:

[2023-Feb-06 11:38:17.831537] INFO mod - 	All game content loaded in 390 ms
[2023-Feb-06 11:38:17.831748] TRACE network - CVCMIServer created! UUID: b2ba253a-a169-48b3-8fa5-f8fb9f3154ed
[2023-Feb-06 11:38:17.831809] INFO network - Port 3030 will be used
[2023-Feb-06 11:38:17.831852] INFO network - Listening for connections at port 3030
[2023-Feb-06 11:38:17.882147] INFO network - We got a new connection! :)
[2023-Feb-06 11:38:17.883229] INFO network - Established connection with VCMI 1.2.0.GITDIR-NOTFOUND (client). UUID: 2cfefc17-08ed-40b0-8fc9-980524164880
[2023-Feb-06 11:38:17.883550] TRACE network - Received CPack of type 20LobbyClientConnected
[2023-Feb-06 11:38:17.883567] INFO network - Connection with client 1 established. UUID: b2ba253a-a169-48b3-8fa5-f8fb9f3154ed
[2023-Feb-06 11:38:17.883592] INFO network - Client 1 player: Player
[2023-Feb-06 11:38:17.883611] INFO network - system says: Player (pid  cid 1) joins the game
[2023-Feb-06 11:38:17.933503] TRACE network - Sending a pack of type 20LobbyClientConnected
[2023-Feb-06 11:38:17.933641] TRACE network - Sending a pack of type 16LobbyUpdateState
[2023-Feb-06 11:38:17.976688] TRACE network - Received CPack of type 18LobbySetDifficulty
[2023-Feb-06 11:38:17.983823] TRACE network - Sending a pack of type 18LobbySetDifficulty
[2023-Feb-06 11:38:17.983861] TRACE network - Sending a pack of type 16LobbyUpdateState
[2023-Feb-06 11:38:17.996308] TRACE network - Received CPack of type 11LobbySetMap
[2023-Feb-06 11:38:18.034075] TRACE network - Sending a pack of type 11LobbySetMap
[2023-Feb-06 11:38:18.034213] TRACE network - Sending a pack of type 16LobbyUpdateState
[2023-Feb-06 11:38:19.752472] TRACE network - Received CPack of type 11LobbySetMap
[2023-Feb-06 11:38:19.789229] TRACE network - Sending a pack of type 11LobbySetMap
[2023-Feb-06 11:38:19.789660] TRACE network - Sending a pack of type 16LobbyUpdateState
[2023-Feb-06 11:38:20.471768] TRACE network - Received CPack of type 11LobbySe

P.S.:Some maps still work, but not many.

Another bug: I just made a very small map for testing. After visiting an obelisk, the server crashed:

Warning: IntObject re-activated with mismatching used and active
Network error receiving a pack. Connection Connection with VCMI 1.2.0.GITDIR-NOTFOUND (server) (ID: 1 UUID: b43ea808-f91d-4882-a965-a3808c71d413) dies. What happened: read_some: End of file

The grail position was not explicitely set. Then i added the grail, tested again, and then no crash.

More bugs: I did not simply disable my mod, i uninstalled it, so that it was completely removed. Now the client crashes (window completely black, no action possible, closing impossible). I reinstalled my mod, still disabling it, still same crash. I think i wait for the next version.

This bonus was introduced in this commit: https://github.com/vcmi/vcmi/pull/676
Unortunatelly, this bonus works differently compare to older one (it has its own cons and prons), so I didn’t changed it, I’m waiting for better times. One day I will ask devs to ‘fix’ this but they have more important things to do now. So it’s only warning, not error. It means some wog artifacts (like Gate Key) don’t work properly.

I run into this bug by improving Adelaides Frost Ring bonus. So for now i deleted her from my mod. But since i still have major crashes i wait for better times, too :slight_smile:

@Ivan: Regarding those WoG objects, that are present in those “updated” map editors:
They all have an index. To make any use of them in map editor, they should be known to the engine by index and subindex. The same is true for those nice Fred79 objects. These too have index and subindex. So my suggestion is: Add them to the core configuration, just with index, subindex, animation and name, but do not implement them. Implementation should then be done in the appropriate mod (f.ex. the WoG mod). So the core developers do not have to bother with configuring these objects.

An exception to this might be those snow versions, which have just exactly the same functionality as their no-snow versions. It might be useful if they are already configured in the core config.

Any file name that starts from “Z” is from WoG.
H3:SoD has no files Z358O4.def/Z358O5.def/etc.

I heavily doubt that vcmi can load wog maps at the moment, either in 1.1 or 1.2. Same goes for maps from HotA.
Sure, we can add all wog objects to our lists. But we also have HotA. And their ID’s would conflict with WoG. Which mod should get special treatment?

IMO what game needs is proper support for modified h3m formats, whether WoG or HotA

I agree that conflicting indexes are a problem. But with some effort these could be solved. They would have to be solved in the original lod files, but it is doable.

Since HotA is more complete regarding all object indexing, i’d recommend reindexing the WoG objects, if necessary. This would mean that old wog files would be incompatible to some degree (some objects would not be present or would be wrng objects), but even that could be fixed over time.

WoG mod (without indexes) works flawlessy from months and it’s pretty compatible with HotA and dozens other mods. Opening wog maps is pointless because 99% wog maps have scripts inside, so we would got lots of empty obejcts. I don’t think such regression is good idea. VCMI should read def names from maps and load corresponding defs (with identical names) from mod.

Well, vcmi loads the def file, and the object is shown. Did you ever try to visit a snow learning stone with vcmi? The object is shown. It is visitable. But it dies nothing. No bonus, no message, nothing. Absolutely nothing.

And if you make a mod, including this graphics, but obviously without index, it is another object. So a snow learning stone, placed on the map, is not the same object as a snow learning stone, placed on the map by random map generator. But it would be the same if the object was made known to the engine by just adding an empty config.

In some cases there is already such an empty config. So it may be the WoG mod needs to refere this instead of a new object. The problem is not about the graphics, it is about recognizing it as an object and call the correct handler. And a learning stone with subindex 1 simply does not have an associated handler. So visiting such an object simply does nothing.

Maybe it would help here to move the configuration for these objects to a “base” section, and then just add the subindexes, names and maybe graphics. The graphics are optional, since they are indeed read from the map file. For many such objects maybe even the name is optional and could be moved to the base section. This would automatically lead to the same behavior for all objects of this index and different subindexes.

The WoG mod does not work with those WoG objects placed on a map with the standard map editor! It does not work because it is about different objects.

Is there a possibility to configure the dwellings so that they accumulate creatures, but only if owned?

Not at the moment, but this feature should be easy to implement.

That would be very very nice!

Another idea, not so easy to implement:
Would it be possible to replace those creature banks with another object, after beating it? Simply said: Replace it with a dwelling of that creature type and just keep the graphics the same? I did that long ago with erm, and it was nice. I did that also with those relic shops, crypt, warriors tomb, and with the dragon utopia. With these the dwelling type should be similar to the golem factory, offering 4 different types. These should be the same as the guards.
Just an idea, not that important. But it makes those objects useful during whole gameplay. The original objects are just decoration after beating them.

I have a problem with a hero specialty. What i want is a growing bonus on creature growth in the visited town. The specialty config is:

					{
						"type" : "CREATURE_GROWTH",
						"subtype" : 0,
						"val" : 1,
						"valueType" : "BASE_NUMBER",
						"updater" : "TIMES_HERO_LEVEL",
						"propagator": "VISITED_TOWN_AND_VISITOR",
					},
					{
						"type" : "CREATURE_GROWTH",
						"subtype" : 1,
						"val" : 24,
						"valueType" : "BASE_NUMBER",
						"updater" : {
							"type" : "GROWS_WITH_LEVEL",
							"parameters" : [ 20, 2 ]
						},
						"propagator": "VISITED_TOWN_AND_VISITOR",
					},

I had the updater for the level 1 creature similar to that of level 2. I modified it to this one to test if there is still the same problem. It is. What i want here is a growth of level 1 creatures of 1 for first hero level, of 2 for level 2, and so on. So i levelled the hero to level 2 and checked.
h3err02
The growth should say:
Cathrine: +2
What went wrong?

I guess it’s impossible to implement. Updater shows how quickly (or slow) bonus growths with hero level.

Well, that worked in version 1.0. But you are right, i fear exactly that is the reason. The updater is applied to where the propagator points to.
Well, if so, that would still be useful. I prefer to limit this specialty to castle towns for this hero. So it applies only to castle towns. But as far as i remember this limiter applies to the hero. So either way would be useful. Either if both, the updater and the limiter apply to the propagated target, or both apply to the hero.

I could f.ex. set the growth to some percent of the normal creature growth. The drawback is that this does not grow with hero level. But ok, it would be acceptable. Perhaps i split this into two growths, one for visited town, and one for player. This way it would at least grow with the number of towns. An aspect that maybe fits even better to a king than growing with level. But in both cases it would be desirable to limit that to castle towns.

I also have the “nobility” skill, that does not have these limitations. And i plan to give a similar specialty bonus to King Boragus, and King Trallosk (a hero still to create). No idea currently for the other factions.

P.S. I added two very small test maps for download. I use them to quickly check the results of my modding. Maybe they are useful for other modders too. One on grass and one on snow. Both are set to “build grail”, so you can “play” with them a few rounds without immediate ending :slight_smile:

I tried to set up the Ironfists specialty as described above. It works partly. Here is the config (part of it):

				"bonuses" : [
					{
						"type" : "CREATURE_GROWTH",
						"subtype" : 0,
						"val" : 7,
						"valueType" : "BASE_NUMBER",
						"propagator": "VISITED_TOWN_AND_VISITOR",
					},
...
					{
						"type" : "CREATURE_GROWTH_PERCENT",
						"val" : 50,
						"valueType" : "PERCENT_TO_ALL",
						"propagator": "PLAYER_PROPAGATOR",
						"limiters" : [
							{
								"type" : "CREATURE_ALIGNMENT_LIMITER",
								"parameters" : [ "good" ],
							}
						],
					}
				],

The limiter to the last one does not work. The valueType works. So it makes a difference if you have built the castle or not. I’d prefer to not add their bonus to evil or neutral alligned towns. But that seems to be impossible. Well, not that good, but for now i can live with it. Will try now to setup the estates specialty in a similar way :slight_smile:

Correction: The limiter works! I had a typo in the config. Now it is close to what i want.

I tried a similar thing with another specialty bonus. But this one does not work:

					{
						"type" : "GENERATE_RESOURCE",
						"subtype" : "gold",
						"val" : 50,
						"valueType" : "PERCENT_TO_ALL",
						"propagator": "VISITED_TOWN_AND_VISITOR",
						
					},

The town gold production stays as it is without the visiting hero.

Because town (or mines) don’t use Bonus system for resource generation ¯_(ツ)_/¯

Well, for creature generation it works :smirk:

Interesting feature:

I added something to the creature generation specialty:

					{
						"type" : "CREATURE_GROWTH_PERCENT",
						"val" : 50,
						"valueType" : "PERCENT_TO_ALL",
						"propagator": "PLAYER_PROPAGATOR",
						"limiters" : [
							{
								"type" : "CREATURE_ALIGNMENT_LIMITER",
								"parameters" : [ "good" ],
							}
						],
					}

The idea was: Increase creature growth in all good aligned towns. But what i got instead was interesting. I got this extra bonus as long as i owned only good aligned towns. The first town conquered of other alignment nullified this bonus. So it seems the player is no more considered good aligned as soon as he conquers the first neutral or evil aligned town. Indeed very interesting. Perhaps i can exploit that with other bonuses too :slight_smile:

Problem secondary skill not available in university:

I think i found the reason. In older versions there was a “defaultGainChance” or “gainChance”, which was used as a default when not configured in heroClasses.json. Now these fields are undocumented in wiki, and the core skills do not have them. So this might be the reason. I observed this in older versions, when i set the gain chance to zero.

Now these gain chances seem to be configured only in heroClasses.json. So i’ll modify my mod and check that again. But then there is a question: If i build new skills, how are they available to heroes of new classes of new factions?

You can look into any new mod skill json to see how it was done (Magic Fader for example).