Check this: dl.dropbox.com/u/22372764/vcmi/hotapackage.zip
Creatures from hota + incomplete config for vcmi. All issues I know about are noted in readme but config may have other issues as well like missing or incorrectly named fields.
It looks that it is time for some “mod config” format. Specifying all creatures\heroes\artifacts\etc in one file will make it too big.
I think we should use something like this:
A:
{
"creatures" : "file1.json", "file2.json"], //list of files that actually store creature configuration
"artifacts" : "artifacts.json" ], // same for artifacts
"filesystem" : { <same as current format> }
<any extra fields like mod name>
}
B:
{
"content" : "file1.json", "file2.json"], //list of files that store *all* content (e.g. creatures and artifacts may be stored in one file)
"filesystem" : { <same as current format> }
<any extra fields like mod name>
}
Why? I’d rather keep all this data in one file. Filesystem even for complex mods won’t be large - 10-20 lines top and may be further decreased with some auto-detection.
It won’t be “detection”. In “B” file with content will look like this:
{
"creatures" : {...},
"artifacts" : {...}
}
Engine will merge all files in one structure and send all parts from it to creature\art\etc handlers.
With “A” data in each file won’t need “creatures” or “artifacts” nodes - they are already specified in main file.
As result json structure in “B” will be one level bigger.
Note that any files in root mod directory (“Mods/modname/”) are not available after loading - you’ll need to move them to config directory for now (and add appropriate entry to filesystem).
All of this should be fixed at some point - currently mod support from filesystem is quite basic.
EDIT:
Warmonger, in your last commit you’ve used “” as path sepatator for #include - please replace with “/”
What do we need from filesystem for mods?
complete tree with all loaded mods
tree for each mod which consists from entries from this mod + dependencies + base game.
tree to get data only from specific mod shouldn’t be needed - previous entry should suffice.
Yeah I got your idea.
As I said - right now files in “mod root” directory are unavailable for engine.
I’ll try to fix this soon but right now something similar to CAnimation::init() is the only way to get files from mods. Should be more than enough for creature test.
What I want to do:
Filesystem loader scans Mods directory and sends list of mods to ModHandler.
ModHandler marks enabled\disabled mods, reorder them to load dependencies first and sends resulting list back to filesystem.
Filesystem loads received mods and generates mod-specific filesystems (or some other way to get mod-specific data)
I’m not sure about that, I’d like to pre-load ALL the mods in firts place and then only enable / disable them at run time. So list of used mods will be stored internally in game and filesystem doesn’t have much to do later.
There are alreayd some structures to store all creatures and artifacts in Modhandler, just they’re unused.
If all mods are loaded into filesystem then what to do with files from disabled mods? Especially when they override files from H3 or even files from another mods.
Disabling\enabling mods in runtime should be easy. In this case loading process will be:
During loading:
Scan FS (same)
send list of available mods (maybe including main config file) to modhandler
After this anytime when (re-)configuring is needed:
I can understand that there can be only one filesystem at once, but for new creatures that’s not an issue. We can load an arbitrary number of them to ModHandler and then pas only some to CreatureHandler, so only enabled creatures will appear in random stacks.
Still, before we attempt to disable or replace anything, first we should add new content to game.
Ah. By “preloading” you also mean loading creatures configs into mod handler? Loading them should be OK but parsing may be a bad idea - what if this this creature is incomplete and based on some parent mods?
Anyway files with creatures are also part of filesystem, content (like icons) is also part of filesystem. This needs to be handled somehow… Can be tricky - in most cases prefix to URI (SPRITES or DATA) is inserted in bitmap\sound\def handlers. Mod-specific prefixes (“MODS/NAME/SPRITES/SOMEANIM”) won’t work with them.
So far best solution I found is to “tell” FS list of mods where file should be looked for with possibility to set default search list (=list of enabled mods).
Any other possibilities I found are even more tricky to implement.
Kinda missed that. Apart from list of files with content there will be such data like list of required mods, name, description, etc. So storing FS description here won’t help consistency anyway.
I suspect that access method for resources (all from H3/wog + all graphics) and VCMI configs (and most likely scripts except ERM) have to be different.
resource is defined by name and type but not (relative)path. And loaded from path defined in filesystem config
config cannot be accessed the same way, because different mods may have config files with same name.
main config + filesystem config must be handled separately anyway.
"CONFIG/" : <- this is directory where all files will be placed after initialization
{"type" : "dir", "path" : "ALL/MODS/HOTA/CONFIG"} <- this is path to directory, relative to H3 root directory. Prefix "ALL" is needed for user-specific directories on Linux.
]
This should make files in mods/hota/config directory available via “CONFIG/filename” URI from game.
In case of multiple mods with such config only file from last mod (alphabetically) will be available. To get all files check CAnimation::init();
True. This is main problem with URI’s right now. But this is true for graphical content as well.
Let’s imagine mod with 1 creature. What is the most logical name for creature icon? Icon.png? And half of mods will have such name…
Right now nearly all mods are in fact targeted to era (including HotA in future versions). Era has same issue with filenames. So requiring unique resource names wont be surprise for modders. OTOH this is an issue anyway.