User Tools

Site Tools


mods

Documentation::Mods structures and Filesystem

Terminology

During conception of my modding system I defined a few name conventions for simple things.

  • An Asset is a readable file from within the engine. Asset names are of the form './directory/asset.txt', denoting virtual files.
  • A Mod is a collection various assets, bundled in either a .zip or a folder, containing at least a valid './mod.txt' asset, defined further in this document.
  • The Mods Manager takes care of loading all mods in increasing order of priority, leading to the most prioritized mod being loaded last and possibly overwriting assets from the other ones.
  • The Mods Manager can also provide an Asset Hierarchy, which is put simply a queue containing all versions of an asset, from the top, active version, to the 'core' version if one such exists.
  • The res/ folder in the root of the game files acts as the 'base', it's always loaded first and acts as the base content and reference for mods. It is also denoted as the Core content most of the codebase.

Mods can be downloaded from servers automatically on connection, such mods are placed within the servermods/ folder and named by their md5 hash. Mods can be force-reloaded ingame (can cause issues!) by using control-F12

The basic folder structure

The default content of the games (core) lives in the res/ folder and can serve as a basis for how you should organize your mods files. There aren't a lot of subsystems that enforce some directories for their assets, but it's good practice to mimic what the base content does.

The mod.txt file provides information about the mod such as author, name or description. An optional, 128×128 modicon.png file may be provided to serve as an illustration.

Tip to modders: You may want to provide server owners with a seperate set of jars to put in their general plugins/ folder to avoid bundling serverside files to end-users ( for security, intellectual property and file size )

Loading of user code

All .jar files found within a mod will be analyzed, the game will look for a plugin.info to determine wether the .jar is a plugin or not. The game will also lists all .class files in the .jar and allow their use in custom objects. Any classes loaded from within a mod will be put onto the supervision of a SecurityManager and will have restricted access to io, net, etc for obvious security reasons.

mods.txt · Last modified: 2017/02/07 23:17 by gobrosse