SoD files mod like


#201

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


#202

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.


#203

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.


#204

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…


#205

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

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


#206

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.


#207

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:


#208

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?


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

Surely passing cleared objects won’t work :wink:


#210

noooooooooooo :->


#211

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.


#212

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


#213

I have uploaded the Mod to github.com/krs0/vcmi/tree/Resou … actor/Mods

It is not final version but should be close to 90%

The H3 data is missing obviously, but the folder structure is there.

Overall suggestions and comments are welcome.


#214

Just remove “sprites” word from “animation”, “map” etc. and all will be fine.


#215

Removing of sprites, sounds, etc seems to be working ty.

Now, I wonder if there is a way to specify in Json something like a macro or variable so you do not have to write all the time the same string?

eg: animationPath = “factions/castle/townScreen/animations”

{
	"castle" :
	{
		"town" :
		{
			"structures" :
			{
				"extraAnimation": { "animation" : "factions/castle/townScreen/animations/TBCSEXT2.def", "x" : 46,  "y" : 119 },
				"mageGuild1":     { "animation" : "factions/castle/townScreen/animations/TBCSMAGE.def", "x" : 707, "y" : 166, "z" : 1, "border" : "TOCSMAG1.bmp", "area" : "TZCSMAG1.bmp" },
				"mageGuild2":     { "animation" : "factions/castle/townScreen/animations/TBCSMAG2.def", "x" : 706, "y" : 135, "z" : 1, "border" : "TOCSMAG2.bmp", "area" : "TZCSMAG2.bmp" },
				"mageGuild3":     { "animation" : "factions/castle/townScreen/animations/TBCSMAG3.def", "x" : 704, "y" : 107, "z" : 1, "border" : "TOCSM301.bmp", "area" : "TZCSM301.bmp" },
				"mageGuild4":     { "animation" : "factions/castle/townScreen/animations/TBCSMAG4.def", "x" : 704, "y" : 76,  "z" : 1, "border" : "TOCSM401.bmp", "area" : "TZCSM401.bmp" },
				"tavern":         { "animation" : "factions/castle/townScreen/animations/TBCSTVRN.def", "x" : 0,   "y" : 230, "z" : 1, "border" : "TOCSTAV1.bmp", "area" : "TZCSTAV1.bmp" },
				"shipyard":       { "animation" : "factions/castle/townScreen/animations/TBCSDOCK.def", "x" : 478, "y" : 134, "border" : "TOCSDKMS.bmp", "area" : "TZCSDKMS.bmp" },
				"fort":           { "animation" : "factions/castle/townScreen/animations/TBCSCSTL.def", "x" : 595, "y" : 66,  "border" : "TOCSCAS1.bmp", "area" : "TZCSCAS1.bmp" },
				"citadel":        { "animation" : "factions/castle/townScreen/animations/TBCSCAS2.def", "x" : 478, "y" : 66,  "border" : "TOCSCAS2.bmp", "area" : "TZCSCAS2.bmp" },

#216

Mod definitions updated: github.com/krs0/vcmi/tree/Resou … r/Mods/SoD

Next Hurdle: even though I see no differences to HotA mod I get these errors for Castle mod

2017-Feb-04 21:31:37.186417 WARN global [1934] - Data in castle is invalid!
2017-Feb-04 21:31:37.189417 WARN global [1934] - At <root>
	 Error: Unknown entry found: creatures
At <root>
	 Error: Unknown entry found: dwellings
At <root>
	 Error: Unknown entry found: heroClases

EDIT: I have managed to find out what was wrong with the above…

  • Creatures is not in node “Factions” but in .Town
  • dwellings should be listed under the unintuitive “objects” node “objects” : “config/hota/dwellings” ], (why not “mapObjects”)
  • heroClases … well this one was just misspelled (heroClasses), but not in the mod.json but in an inner file.

#217

Next problem. I see some inconsistencies between HotA definition of dwellings and the serialized version i got when I serialized core from code…

So can anyone please check the below definition for a dwelling? When I get an ok I will update all dwellings according to this structure.

(I am not interested in the values, but in the structure itself. EG: is “animation” part of “base”? Is “creatureGeneratorCommon” the name for this node and not dewllings?)

{
	"castle" :
	{
		"dwellings" :
		{
			"guardhouse" : 
			{
				"name" : "Guardhouse",
				"creatures" : 
					
						"pikeman"
					]
				],
				"base" : {
					"animation" : "factions/castle/adventureMap/dwellings/AVGPIKE0.def",
					"mask" : 
						"VVV",
						"VBB",
						"VAA"
					],
					"visitableFrom" : 
						"---",
						"+++",
						"+++"
					]
				},
			},

For reference this is HotA mod…

{
	"core:creatureGeneratorCommon" : {
		"types" : {
			"waterfall" : {
				"name" : "Waterfall",
				"creatures" :  "nymph" ]],
				"templates" : {
					"default" : {
						"animation" : "hota/map/waterfall",
						"mask" :  "VVV", "VVV", "VBA" ]
					}
				}
			},

Ans this is serialized from core…

creatureGeneratorCommon
{
	"base" : {
		"base" : {
			"mask" : 
				"VVV",
				"VBB",
				"VAA"
			],
			"visitableFrom" : 
				"---",
				"+++",
				"+++"
			]
		}
	},
	"handler" : "dwelling",
	"index" : 17,
	"name" : "Creature Generator 1",
	"types" : {
		"airConflux" : {
			"base" : {
				"mask" : 
					"VVV",
					"VBB",
					"VAA"
				],
				"visitableFrom" : 
					"---",
					"+++",
					"+++"
				]
			},
			"creatures" : 
				
					"airElemental"
				]
			],
			"index" : 7,
			"templates" : {
			}
		},

#218

It’s not inconsistence. HotA is a mod, so we must “core:” creatureGeneratorCommon schema to add new dwellings to ‘database’.

I think that your third code is most proper code and animation part must be in the same part of base with masks.


#219

I have not understood how object templates should work.
So now I have 2 versions like below. Which one to use?

{
	"creatureGeneratorCommon" :
	{
		"guardhouse" : 
		{
			"name" : "Guardhouse",
			"creatures" : 
				
					"pikeman"
				]
			],
			"base" : {
				"animation" : "factions/castle/adventureMap/dwellings/AVGPIKE0.def",
				"mask" : 
					"VVV",
					"VBB",
					"VAA"
				],
				"visitableFrom" : 
					"---",
					"+++",
					"+++"
				]
			},
		},
{
	"creatureGeneratorCommon" :
	{
		"guardhouse" : 
		{
			"name" : "Guardhouse",
			"creatures" : 
				
					"pikeman"
				]
			],
			"templates" : 
			{
				"default" : 
				{
					"animation" : "factions/castle/adventureMap/dwellings/AVGPIKE0.def",
					"mask" : 
						"VVV",
						"VBB",
						"VAA"
					],
					"visitableFrom" : 
						"---",
						"+++",
						"+++"
					]
				}
			}
		},

#220

In Hero Classes “commander” is needed.

Error: Required entry commander is missing

Since this is not SoD, could this be made optional?