Difference between revisions of "User:Ivan/Mod format WIP"

From VCMI Project Wiki
Jump to: navigation, search
(Mod configuration format)
Line 49: Line 49:
 
<syntaxhighlight lang="javascript">  
 
<syntaxhighlight lang="javascript">  
 
{
 
{
 +
 
     // This is description on how files are organized in your mod
 
     // This is description on how files are organized in your mod
     // Make sure to replace "myMod" with name of your mod
+
     // Optional, by default it follow filesystem format description:
     // In most cases you do not need to modify anything else in this field
+
     // "Override" and "Content" folders
    // TODO: make this entry optional
 
 
     "filesystem":
 
     "filesystem":
 
     {
 
     {
Line 69: Line 69:
 
     // 2) Minor - some minor changes notable by players
 
     // 2) Minor - some minor changes notable by players
 
     // 3) Patch - small bugfix releases
 
     // 3) Patch - small bugfix releases
 +
    // Minor and Patch numbers are assumed to be 0 if not specified
 +
    // Used during updating and in dependencies resolution
 
     "version" : "1.0.2"
 
     "version" : "1.0.2"
 
      
 
      
     // autor of mod. Can be nickname, real name or name of team
+
     // author of mod. Can be nickname, real name or name of team
 
     "author" : "Anonymous"
 
     "author" : "Anonymous"
 
      
 
      
Line 84: Line 86:
 
     "depends" :
 
     "depends" :
 
     [
 
     [
         "baseMod"
+
        // Can be a single name
 +
         "baseMod",
 +
 
 +
        // Or using range of allowed versions
 +
        "1.0<modName<=5",
 
     ],
 
     ],
  
 
     // List of mods that can't be enabled in the same time as this one
 
     // List of mods that can't be enabled in the same time as this one
 +
    // Similar to dependencies can be either name of mod or mod name + versions range
 
     "conflicts" :
 
     "conflicts" :
 
     [
 
     [
Line 137: Line 144:
 
     // Overriding of configuration of another mod
 
     // Overriding of configuration of another mod
 
     // Uses same set of fields as mod configuration
 
     // Uses same set of fields as mod configuration
    // TODO: allow filesystem overriding as well?
 
 
     "override" :
 
     "override" :
 
     {
 
     {
Line 158: Line 164:
 
                 "config/myMod/artifactsAnotherMod.json"
 
                 "config/myMod/artifactsAnotherMod.json"
 
             ]
 
             ]
         },
+
         }
 
     }
 
     }
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 10:45, 4 January 2013

Future mod format, WIP

Filesystem format

All files from one mod are placed into mod directory located in Mods/ directory Name of directory also serves as unique identifier of mod

Main mod directory

Main mod directory contains following elements:

  • main mod configuration file
  • icon
  • content directory
  • override directory

Main mod configuration file

File named "mod.json", contains all data necessary to load this mod into modding system.

See mod configuration format for description

Icon

File named "icon.png". Any other formats are possible but not recommended

Definitely needed. Possible options on size\meaning are:

  • Large (~150px) logo that will be displayed alongside with description
  • Small (~30px) icon that will be displayed in list of available mods
  • Both. In this case there will be two files: icon.png and logo.png

Content directory

Directory with content added by mod Acts similar to game root directory: subfolders with game data.

See game data directories for list of possible directories.

Files from this directory will be available in-game as <name of mod>/<name of file>

Override directory

Used to override any files from Heroes III or any other mods. Acts as game root directory. Should be used with caution to avoid name conflicts.

See game data directories for full list

Data directories

Can be any of the following:

  • data/ - unorganized files, mostly bitmap images (.bmp, .png, .pcx) and some rarely changed files like fonts
  • config/ - json configuration files
  • maps/ - h3m maps added or modified by mod
  • music/ - music files. Mp3 is fully supported, ogg support may be added if needed
  • sounds/ - sound files, in wav format.
  • sprites/ - animation as well as any image sets (H3 .def files or VCMI .json files)
  • video/ - video files, .bik or .smk. In future there may be support for other formats

Mod configuration format

 
{

    // This is description on how files are organized in your mod
    // Optional, by default it follow filesystem format description:
    // "Override" and "Content" folders
    "filesystem":
    {
        "":
            [
                {"type" : "dir",  "path" : "ALL/MODS/myMod/Override"}
            ]
    },
 
    // Name of your mod. While it does not have hard length limit
    // it should not be longer than ~30 symbols to fit into allowed space
    "name" : "My test mod",
    
    // Version of the mod. Consists from up to 3 numbers:
    // 1) Major - changed when there is large change in functionality
    // 2) Minor - some minor changes notable by players
    // 3) Patch - small bugfix releases
    // Minor and Patch numbers are assumed to be 0 if not specified
    // Used during updating and in dependencies resolution
    "version" : "1.0.2"
    
    // author of mod. Can be nickname, real name or name of team
    "author" : "Anonymous"
    
    // Home page of mod or link to forum thread
    "weblink" : "http://example.com"
 
    // More lengthy description of mod. No hard limit
    // TODO: show it in some kind of mod manager
    "description" : "My test mods that add a lot of useless stuff into the game",

    // List of mods that are required to run this one
    "depends" :
    [
        // Can be a single name
        "baseMod",

        // Or using range of allowed versions
        "1.0<modName<=5",
    ],

    // List of mods that can't be enabled in the same time as this one
    // Similar to dependencies can be either name of mod or mod name + versions range
    "conflicts" :
    [
        "badMod"
    ],
 
    // Priority in which your mod will be loaded. Bigger priority will make mod load later
    // and override whatever changes were made by previous mod
    // Can be modified by user as well as by game so this field is more like a hint
    "priority" : 20,
 
    // Following section describes configuration files with content added by mod
    // It can be split into several files in any way you want but recommended organization is
    // to keep one file per object (creature/hero/etc) and, if applicable, add separate file
    // with translatable strings for each type of content
    // See "additional links" at the bottom of page for descriptions of each of these formats
 
    // list of factions/towns configuration files
    "factions" :
    [
        "config/myMod/faction.json"
    ]
 
    // List of hero classes configuration files
    "heroClasses" :
    [
        "config/myMod/heroClasses.json"
    ],


    // List of heroes configuration files
    "heroes" :
    [
        "config/myMod/heroes.json"
    ],
 
    // list of creature configuration files
    "creatures" :
    [
        "config/myMod/creatures.json"
    ],
 
    // List of artifacts configuration files
    "artifacts" :
    [
        "config/myMod/artifacts.json"
    ],
    
    // Overriding of configuration of another mod
    // Uses same set of fields as mod configuration
    "override" :
    {
        // Override of creature of base mod on which current one depends
        // This method may be used to replace any fields in config
        "baseMod" :
        {
            "creatures" :
            [
                "config/myMod/creaturesBaseMod.json"
            ]
        },

        // Override of artifact in another unrelated mod
        // In this case override will be used only if mod is present
        "anotherMod" :
        {
            "artifacts" :
            [
                "config/myMod/artifactsAnotherMod.json"
            ]
        }
    }
}