SoD files mod like

I am talking mainly about .json work. I’ve spent some 100+ hours for that and I would be sad if it will see no usage :(.

The other part was merging spell configs and adding unit skills. That was the part that cut all my enthusiasm. Some spells have bugs, some are incomplete, many creature abilities are missing, there is that ugly AC mapping and on top .json files get updated in trunk frequently making diffs quite hard.

So what I want to do is have in repository at lest the biggest chunk of those .json config files (the factions) and the script for extracting and moving files. Then see if I continue from there.

Personally I would very much like to continue working on making SoD as mod happen and then go implement H3 with H2 graphics. But I have to recognize in some places I was at the end of my knowledge of the VCMI-project. That means that I will have to wait in some parts for work to be done by people with more knowledge of the whole system.

" submods support? I am interested in this feature but right now I don’t have time for anything other than bugfixing."

Maybe I bring this up here once more. I think maturing the modding system should be no1 priority at least for one developer. There is a lot of work that could be done in parallel by guys with not so much skill in coding the whole thing. A lot of testing will go to waste/will be redone once features start moving from full/partially hardcoded to configs. Tons of code will get so much cleaner once that is done. Partially because of moving stuff out and partially because of the implied review those parts would get.

That being said, you the team are doing all the work. I for one am just buzzing around from time to time. But I really am interested in helping with those 2 parts I’ve mentioned earlier.

Considering that I’ve spent most of my coding time was spend on modding system this year it can be called as #1 priority for me. The problem is that we have more systems that must be taken care of than developers.

I’ll happy to implement submods but I just can’t do everything. Campaigns, unicode support/i18n, launcher, 32-bit graphics, submods - can you say that something from this list is unimportant? And all of these are needed for fully-functional modding system (including campaings - I’d like to have Chronicles mod at some point).

So all I can do right now is to promise to look into submods when I’ll get some time to do it. When this will happen? Frankly I have no idea.

Ty for your answer. You do not have to answer for below, it’s just my rant…

I try to be as objective as I can, but I still see submods as priority no1 over any of the others. (Unless I am missing something and something is really screaming for unicode). Campaigns should be on your 2014 :D, and 32-bit should come after SDL2? maybe?

There I’ve took care of your schedule, get back to work :D.

Now seriously, many will flock here around X-Mas vacations. “Coders” and “testers” alike. With the current VCMI state I do not think campaigns or 32 bit will be needed at that time.

“campaigns or 32 bit will be needed at that time”

So Unicode also.
I proposed earlier easy way to turn off standard towns. But it was rejected.
I think if we just turn off standard towns, then they will be accessed through mods.
And everyone will be happy.
PS So there will be no need to clean up hardcoded standard towns stuff right now.

krs,
Campaigns - one of biggest missing features for H3, requested a lot by players who are not interested in mods.
unicode support/i18n - needed for better support for localized versions of H3. Including mods. Right now it is impossible to (for example) install Russian mod into Polish version of H3.
launcher - needs some internal improvements, probably smallest feature from this list.
32-bit graphics - SDL 2.0 or not code majority of code that assumes that all images are 8-bit still needs rewrite/fixes, most notably - battles.

There would never be a single opinion on what feature should have highest priority - you want submods, some H3 players want campaigns, artists want 32 bit, on bugtracker there is request for unicode from Chinese players.

How many times I should repeat this: implementing even “special” field is far from trivial. Simplest example: random town was set to Castle or Rampart in editor. Now you made this factions “special”. How such situation should be resolved? This is most trivial example that I can think of even without looking in code.
If somebody will make bug-free patch that implement this then I’ll commit it. But othervice I’m not interested in working on this feature at this point.

As I said earlier, if town is written in editor, it must stay as placed. So are creatures.
There is no change.
Only change for “special” - is that town is not proposed to choose on game options selection, and not placed on map, if random town without limitation is there.
Submods will not change this behavior (as I understand Krs). Creatures, heroes and towns will be named the same.

Winter is coming, so is free time. How is the progress/mood on sub-mod support?

Right now I’m finishing another feature: dl.dropboxusercontent.com/u/223 … ements.png

As for what to do next - either submods or victory conditions for campaigns.

For campaigns - base system is already mostly done & tested as part of extended building requirements so implementing campaigns is a logical continuation.

For submods - recently I made some changes that should make implementing submods easier. I’ll take a closer look on this - if there won’t be any unexpected obstacles then it should be possible to implement them as next feature.

I would vote for campaigns. IMO campaigns have higher prio than submods.

I do agree with you but these features also have different scale.

If there won’t be any any blocking issues then submods support should be really simple:

  • add recursive search for mods
  • generate correct, non-conflicting mod ID’s
  • make launcher understands these changes
    And that’s all.

But campaigns are much more complex. Right now I am only interested in missing victory conditions. This still leaves at least this missing feature: bugs.vcmi.eu/view.php?id=1597 Not sure if I can implement it in “right” way - too much client-server interaction to my liking.
Delaying it will also give me some time to properly test logic expressions in something less critical than victory conditions.

That’s fine, if adding submods support is a easy task for you, then do it first. When logic expressions are tested properly, you can integrate it in special victory/loss conditions as you said. Perhaps Tow/Tow dragon can give some advices how to solve the “heroes are not moving to next scenario” problem in the “right” way.

Submod support imo make a lot more sense than campaigns for many reasons. Here some that spring to mind.

  • There will be changes to the mod structure and the less mods impacted the better.
  • There are a lot more mod makers than campaign one so the sooner they have a final/stable system also the better.
  • There will be lots of code changes and it makes sense to have them as soon as possible to have them tested and to spare the double work at fixing bugs.

EDIT:
I found a reason for campaign support also. A new HotA release! But that is a mod so…

I have updated the .json to match the latest changes in svn.

Any eta on submod support?
SoD_as_Mod.zip (453 KB)

In 2014? I would like submods for several ideas of my own (like translations) but last time I tried to implement them I ran into some issues during implementation of recursive mod search. Nothing critical but it turned out to be a bit more complicated than I expected it to be.

BTW - maybe you should try to implement this as a huge number of “normal” mods? Submods should behave identically to normal mods except for hidden(?) dependency on parent.

If I would have known it will take so long, I would have done it like you’ve suggested, but now I think I keep waiting for submods support :D.

One of the big points of this SoD mod is having everything nicely ordered in subfolders (configs and resources). And this I do not see possible without changes to the current modding system.

Will check again in 2014 :slight_smile:

I want to serialize “core” data into a json file. All data, creatures, artifacts, factions… etc. And I need it to be complete (heoriginal merged with “core mode”)

bool CContentHandler::ContentTypeHandler::loadMod(std::string modName, bool validate)
{
	ModInfo & modInfo = modData[modName];
	bool result = true;

	auto performValidate = &,this](JsonNode & data, const std::string & name){
		handler->beforeValidate(data);
		if (validate)
			result &= JsonUtils::validate(data, "vcmi:" + objectName, name);
	};

	// apply patches
	if (!modInfo.patches.isNull())
		JsonUtils::merge(modInfo.modData, modInfo.patches);

	for(auto & entry : modInfo.modData.Struct())
	{
		const std::string & name = entry.first;
		JsonNode & data = entry.second;

		if (vstd::contains(data.Struct(), "index") && !data"index"].isNull())
		{
			// try to add H3 object data
			size_t index = data"index"].Float();

			if (originalData.size() > index)
			{
				JsonUtils::merge(originalData[index], data);

				performValidate(originalData[index],name);
				handler->loadObject(modName, name, originalData[index], index);

				originalData[index].clear(); // do not use same data twice (same ID)

------------------>     logGlobal->traceStream() << "\n" << originalData[index];

				continue;
			}
		}
		// normal new object or one with index bigger that data size
		performValidate(data,name);
		handler->loadObject(modName, name, data);
	}
	return result;
}

I try to do that like the line above

logGlobal->traceStream() << "\n" << originalData[index];

and it does not work.

Is this the right place? Can i do it this way?

originalData[index].clear(); // do not use same data twice (same ID) 
logGlobal->traceStream() << "\n" << originalData[index];

Surely passing cleared objects won’t work :wink:

noooooooooooo :->

I have now a problem that resources are not found for my mod…

I have a “SoD” mod with a submod “Castle”.

Alttough all files are in place and seem to be loaded ok.

2017-Feb-04 11:56:59.688681 DEBUG global [22c] - 		Loading resource at MODS/sod/MODS/castle/Content
2017-Feb-04 11:57:00.501728 TRACE global [22c] - File system loaded, 484 files found

I get these “resource not found errors”…

2017-Feb-04 15:38:50.821014 WARN global [1ce4] - Data in angel is invalid!
2017-Feb-04 15:38:50.823014 WARN global [1ce4] - At /graphics/animation
	 Error: Def file "sprites//creatures//battle//CANGEL.def" was not found

2017-Feb-04 15:38:50.889018 WARN global [1ce4] - Data in archangel is invalid!
2017-Feb-04 15:38:50.892018 WARN global [1ce4] - At /graphics/animation
	 Error: Def file "sprites/creatures/battle/CRANGL.def" was not found

Can anyone tell only from this information what could be amiss?

I tried to specify the paths with single and double slashes. (see above)

I think if I have the files in the Content/sprites/creatures/battle/ folder they should be loaded automatically.

Hard to say, what is amiss without full json code.
But don’t write “sprites” in json def path. Game know that defs start to be in ‘sprites’ folder. So:
“sprites/creatures/battle/CANGEL.def” - BAD code
"creatures/battle/CANGEL.def" - OK code