Modinfo.lua: Difference between revisions

From Spring
Jump to navigationJump to search
Flozi (talk | contribs)
m →Details: punctuation
Flozi (talk | contribs)
m Use numbers instead of strings for modtype (both are accepted)
Line 25: Line 25:
* <code>description</code> - A description of this content package.
* <code>description</code> - A description of this content package.


* <code>modtype</code> - What kind of content package is this? "1" for a game or mutator, "0" for a hidden base content file. Maps use "3" in [[mapinfo.lua]].
* <code>modtype</code> - What kind of content package is this? 1 for a game or mutator, 0 for a hidden base content file. Maps use 3 in [[mapinfo.lua]].


* <code>depend</code> - A table of other content packages, referenced by <code>name</code>, not their filename, which this package depends on. Spring will load them if they are present, or throw an error if they are missing. This is used by mutators to depend on main game file and by all games to depend on base content files. New games may particularly want to depend on <code>'Spring Cursors'</code> (provided as <code>cursors.sdz</code> in the Spring <code>base</code> directory) if they do not yet have their own [[MouseCursors|custom cursors]].
* <code>depend</code> - A table of other content packages, referenced by <code>name</code>, not their filename, which this package depends on. Spring will load them if they are present, or throw an error if they are missing. This is used by mutators to depend on main game file and by all games to depend on base content files. New games may particularly want to depend on <code>'Spring Cursors'</code> (provided as <code>cursors.sdz</code> in the Spring <code>base</code> directory) if they do not yet have their own [[MouseCursors|custom cursors]].
Line 43: Line 43:
   description = "An awesome game I made with units",
   description = "An awesome game I made with units",
   url = "http://www.linktomyawesomegame.com/",
   url = "http://www.linktomyawesomegame.com/",
   modtype = "1",
   modtype = 1,
}
}


Line 63: Line 63:
   description = "An awesome mutator I made for MASG",
   description = "An awesome mutator I made for MASG",
   url = "http://www.linktomyawesomegame.com/",
   url = "http://www.linktomyawesomegame.com/",
   modtype = "1",
   modtype = 1,
   depend = {
   depend = {
     "My Awesome Spring Game v1.0",
     "My Awesome Spring Game v1.0",
Line 80: Line 80:
   name = "Spring content v1",
   name = "Spring content v1",
   description = "Mods can depend on this archive to get all the spring content",
   description = "Mods can depend on this archive to get all the spring content",
   modtype = "0",
   modtype = 0,
   depend = {
   depend = {
     "Spring Bitmaps"
     "Spring Bitmaps"

Revision as of 21:10, 4 May 2011

Location

modinfo.lua is a file in the root directory of a Spring Game.

Purpose

The purpose of this file is to define a Spring content package as a game or game content archive. It is read both by the multiplayer lobbies and the engine itself.

Source

The engine source code which parses the data from this file is viewable here: https://github.com/spring/spring/blob/master/rts/System/FileSystem/ArchiveScanner.cpp

Details

The following tags are read, all are strings unless otherwise specified:

  • name - The name displayed in the lobby or via Spring.exe, version is automatically appended.
  • shortName - A short representation of the package name, usually an acronym of the above.
  • version - The version of this package.
  • mutator - Is the package an official release or a mutator?
  • game - What game is this package based on? This is subtly different from the name attribute. Consider that a main game archive and a mutator would have the same game, but different name values.
  • shortGame - Again an acronym representing the above.
  • description - A description of this content package.
  • modtype - What kind of content package is this? 1 for a game or mutator, 0 for a hidden base content file. Maps use 3 in mapinfo.lua.
  • depend - A table of other content packages, referenced by name, not their filename, which this package depends on. Spring will load them if they are present, or throw an error if they are missing. This is used by mutators to depend on main game file and by all games to depend on base content files. New games may particularly want to depend on 'Spring Cursors' (provided as cursors.sdz in the Spring base directory) if they do not yet have their own custom cursors.
  • replace - A table of content packages, again referenced by name, that this package is meant to replace. For example if you have a base content package with your game music, you may wish to replace it with an updated version later on without having to modify the modinfo.lua of all packages which depend on it. This is not usually used to update main game archives, however, as players may wish to continue playing a previous version.

Examples

Main Game file

local modinfo = {
  name = "My Awesome Spring Game",
  shortName = "MASG",
  game = "My Awesome Spring Game",
  shortGame = "MASG",
  mutator = "Official",
  version = "v1.0",
  description =	"An awesome game I made with units",
  url =	"http://www.linktomyawesomegame.com/",
  modtype = 1,
}

return modinfo

Mutator

A mutator depends on the main game file, but does not replace it, it will usually have a different name and shortName but the same game and shortGame values as the main game file. It should still have a modtype of 1.


local modinfo = {
  name = "My Awesome Spring Game Mutator",
  shortName = "MASGM",
  game = "My Awesome Spring Game",
  shortGame = "MASG",
  mutator = "Double Speed Mutator",
  version = "v1.0",
  description =	"An awesome mutator I made for MASG",
  url =	"http://www.linktomyawesomegame.com/",
  modtype = 1,
  depend = {
    "My Awesome Spring Game v1.0",
  }
}

return modinfo

Base Content

Base content is a hidden, unplayable content package which is depended on by your game. For example you might include music in a hidden content package so that it was not updated with the main game files. It must have a modtype of 0. The following example is from springcontent.sdz, which is automatically loaded by Spring for all games.


local modinfo = {
  name = "Spring content v1",
  description = "Mods can depend on this archive to get all the spring content",
  modtype = 0,
  depend = {
    "Spring Bitmaps"
  },
}

return modinfo


Further reading

Forum thread: Please fix:games contain version in "name" tag (modinfo.lua)
http://springrts.com/phpbb/viewtopic.php?f=14&t=25927