Proposal for creature config

It will be possible to make town dwellings function as both dwelling and horde at once or any other combination of functions.
So if you have creature with growth 10 and want to give town dwelling growth of 7 you will:

  1. Turn building into dwelling (total growth=10)
  2. Turn building into horde with growth -3 (total growth=7)

This is not how our system works internally. You don’t “instantiate” a dwelling. Instead town is essentially a dwelling and shares most of mechanics with external dwellings.

And what happens when creature is available in multiple dwellings? In H3 you can recruit elementals in 3 different dwellings:

  1. One shared elemental conflux
  2. Big version of dwelling, coming from RoE IIRC.
  3. Small version of dwellings, placed as random dwellings for Conflux.

Growth of which dwelling town building should choose?

I won’t mind but somebody would need to implement this. Somebody who more familiar with this area than me.

Maybe we use same name for different things but here my problem with that. Horde building as in H3 horde building is and extra building that:
1: increases said creature production
2: makes said growth immune to plague.

So it is not good to use this horde dwelling trick (for Pyre for example).

Here I am not so knowledgeable. From memory I think that like for every other castle there is one building exactly like the one present in town. That one should be used. To turn this around for you, if you have 3 different buildings and the growth is stored in creature config, how do you make the 3 have different growths?

I doubt that this part (plague immunity) is implemented right now. Interesting - is this a bug or feature of H3?

Anyway - all growth-related objects (castle, grail, hordes, legion parts\statue) use exactly same code. So plague immunity should be a separate option, not a part of “bonus growth” mechanics. So -3 horde is still valid.

Not anymore - see HotA :stuck_out_tongue:
There is no direct connection between town and external dwellings so there is no “exactly same” dwelling or primary dwellings or anything like that. What we have is

  1. Town which is (by itself) dwelling that produces some creatures
  2. Dwelling(s) that produce creatures and give +1 bonus to growth in towns

Why would someone do that? All creatures are connected to some towns (or are neutral). Town does not need to have more than one dwelling of a creature.
Yes - you can set creature as recruitable in another town but I doubt someone will use that - this creatures will be “alien” to town.

In short:
There is no easy way to connect dwellings and towns. The only viable option is to make town growth and external dwelling separate but this may be confusing to modders.

Standard H3 feature. If it started as bug… do not know. I consider it adds a little more depth to the game then if all creatures plagued.

Maybe if you indulge a last attempt from my side. I think I am still not understanding something. Here my understanding of how town (should produce)produces units, maybe you can spot out what I did not get.

Town by itself produces 0 units, but it has dwellings that will produce units. Town has some extra structures (citadel/castle/horde dwelling/grail) that modify these numbers. The same number produced by dwelling in town is produced outside town, because in fact they are another instance of the same building.

I just used your example of con-flux with 3 buildings for elemental. In your case (growth in creature config) all share same growth.

Here is short description on how dwellings\towns work in VCMI:
We have two c++ classes:

class Dwelling: public MapObject
class TownInstance : public Dwelling

So town is always a single dwelling. When you build some creature-producing buildings list of available creatures will be modified but there won’t be any new objects created.
On new week game will calculate growth based on presence of some buildings.

For external dwellings behaviour is mostly same but growth and available creatures are constants.

So you don’t instantiate dwellings - towns and dwellings are completely independent structures.

Yes - all external dwellings will always use the same growth. And there is no way to change that.
However I don’t remember requests like this anywhere. It seems that most people are satisfied with current situation.

And don’t forget scripts - this is what we should use for something significantly different from H3.

Does editing standard (those already added) creatures with mod’s .json files already work? Or are we just limited to adding new creatures for now? If editing the old ones is possible, then how to do this properly? I’m trying to change some values and names, but game crashes on startup if I use existing creature identifier (like “pikeman” or “archer”…). It crashes even on simpliest code like:

{
“pikeman”: {“name” :{“singular”: “Peasant”, “plural”: “Peasants”}},
}

or:

{
“pikeman”:
{
“attack” : 1,
},
}

It’s strange, because it doesn’t crash for newly added creatures.

Right now only new creatures can be added. Support for editing existing creatures will be implemented later.

Some changes that I’d like to add into config:
1.

"abilities" :
{
	"arbitraryName" : Bonus Format
},

Turn abilities from vector into structure. Reasoning: to allow mods to modify/remove bonus by name. This including fixing incorrect entries in original crtraits.txt (currently done using "“ability_remove” entry).

So instead of this
"ability_remove": “FLYING” ],
it will be possible to use this:
“abilities” : { “FLYING” : null }

"upgrades" :
{
	"anotherCreature" : true
},

Mostly same as above, but this can be expanded in future to allow (for example) custom upgrade cost instead of calculating cost difference.

Of course in both cases it is possible to support old format as well to avoid breaking things but I’d rather consider it as deprecated.

Note - in both cases the source of the problem is that it is not clear how mods should replace vectors in JSON. One way is to append items to original list and another is to replace vector completely. This proposition is the best solution I could come up with.

And I just realized that recent changes may remove our hard dependency on wog…

Sorry to intrude, but is this means, that in all mods creature abilities part in .json’s must be changed manually to new format? I’m already fear this!

With time - yes. We already have some differences in format compared to 0.92 like hero spellbook configuration that can use strings instead of numeric spell ID’s (which still work but will be reported as error in mod).

In my opinion we should support previous version (only one) to ease updating but supporting multiple versions is not a good idea at least till 1.0. So yes - in the end you’ll need to manually update your mods. Automating this update is a cool idea but it may not be trivial to implement.

OK, it’s the problem of open source in whole - formats are changing permanently.
Automation of conversion is must have function, I think. Cause there are already towns without support - who will convert them to new formats?

So at first I’ll wait for 0.93 with more readable json parser error reporting.
Without it it’s all very difficult to edit parameters.

PS Maybe you don’t need to do this complex change?
Just add a field with name to type config, and there will be no need to remake all hundreds of json:

{“type”:“FLYING”,
“name”:“FLYING”,
“subtype”:1}

It’s all aimed on mods for changing standart units?

If no one updates town in 3 months between our releases then it is likely that no-one plays this town at all - after all editing json config is not something overcomplicated. Especially with presence of json validation.

Not entirely. Did you knew that most of our modding system is side-effect from several changes in our code?

In this case using structure instead of vector is much, much more easier than implementing such fields like “name”.

BTW - and why this change is “complex”? It will take less than minute to update one creature to new format.

1 creature - 1 minute.
300 creatures - 5 hours:-)
And there will be other changes in json, as you said.
So it’s better, if there will be automatic update tool (it’s easier to fix few errors after this tool, that to test again all creatures and towns, that they work).

And about using structure instead of vector - if I am right, then structure will eat much more memory than vector - for each creature full volume of data will be stored.

Creating update tools takes time too. You should think of it as a trade-off: Ivan can spend his VCMI-time for creating that tool or fixing, let’s say, two bugs. Everyone will forget about the tool fairly soon while the bugs will be fixed forever (hopefully). Additionally there are quite many people who can update configs manually yet very few who can fix bugs. Now, pick your choice.

5 hours / 3 month = 3 minutes/day

Apart from this:

  1. Time to make creature properly (graphics, sounds, stats and balancing) is much bigger than that.
  2. We never stated that current modding system is set in stone. Some changes will happen over time.

Difference is not that significant - I think it should be around 10-20 bytes per item. But even “much more memory” won’t make a difference - ~90% of used memory is graphical files. Even if configs will use 10 times more memory it won’t have any notable effect on memory footprint.

Besides - most of Json data only used during loading. So it will not have any effect on running game - by that time most of configs will be deleted.

I fully understand this. I just want, that changes will be not too big to do them.
It’s like “Don’t pour the child with the water”. Often and big changes will scare people.

Memory is significant for portable devices and old machines (where H3 works, VCMI must work).

This change is extremely small while provides much bigger possibilities - editing H3 creatures via mods as well as removing some hacky workarounds like current “remove_bonus” field (used only in our config files).

There won’t be any notable difference. Worst case is that VCMI will use 10-20 kbytes of memory (only during loading). One extra object on map will have much bigger impact on amount of used memory. So instead of using (for example) 90 Mb of memory vcmi will use 90.01 Mb.

As for me, I don’t want to edit creature abilities through mods, but maybe someone will use this features…

Another way of solving this problem - just make all standard/WOG creatures like external mod (graphics will stay in LODs, but creature abilities etc and upgrades will be edited by users (modders).

By the way - how’s the work going to make creature/town icons be taken from paths and not by icons index?

And another question - do your new syntax checking logging also checks, that icons, defs files exist in written paths, or they are absent?
It will be very helpful, cause now only fatal error can show, that creature’s icons/defs are absent.

Maybe… someone…
I think that right now this is one of the most requested features along with scripting - it was asked for quite a lot. Easy-to-make balancing mods, more easier translating.

Internally editing H3 objects, WoG objects and objects from mods is one big feature. Where these objects located is not that important.

It requires quite large amount of changes. I’d like to add it along with OpenGL support because these changes will be done in that branch anyway. But no ETA right now.

No. Only checks that are local to json file. Perhaps later.

I have a question if I may about adding creatures. Is it possible to add their dwelling throught new objects ? From what I have seen, adding dwellings is possible by adding new towns. But what if I want to add a neutral creature? Would it work?

And another one - is it possible to create a simple map with new objects/artifacts to test it - something like this. I know there an editor won’t be anywhere soon, but a little guide how to crate a map for sod and editit it using hex editor or something would be nice.

Cheers! :smiley: