Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Tools => Topic started by: ngld on March 29, 2015, 05:36:06 pm

Title: JSON specification for mod metadata
Post by: ngld on March 29, 2015, 05:36:06 pm
This specification attempts to record all metadata that's needed to install, launch and update a mod. It's more or less a successor to the FSO Installer's text files (http://www.hard-light.net/wiki/index.php/FSO_Installer_Text_Files).

The actual spec is available on GitHub (https://github.com/ngld/fsmod-json-spec/blob/master/repo.js).

The install process for a mod works like this:


A few notes on launching a mod:

Here's an example:

A depends on Z, self and B.
B depends on C.
C depends on nothing.
Z depends on C.

If you wanted to run mod A, you'd get this: -mod Z,A,B,C
If you want to run mod B, you'd have to use -mod B,C

Other notes:



The "official" server-side implementation is Nebula (https://github.com/Hellzed/hlp-nebula). A prototype is running on fsnebula.org (https://fsnebula.org).
Mod metadata is available at https://fsnebula.org/repo/test.json. Here's the metadata for FSO 3.7.2 RC5 (also included in the previous link): https://fsnebula.org/repo/fso_3.7.2_RC5.json

Known client-side implementations are m!m's Launcher (http://www.hard-light.net/forums/index.php?topic=88119.0) and Knossos (https://dev.tproxy.de/knossos/).



Thanks go to m!m and Hellzed who have helped me write this spec.
Feel free to post questions, constructive criticism and other comments. If you want to talk about Nebula or Knossos, please post here (http://www.hard-light.net/forums/index.php?topic=86364.new).
Title: Re: JSON specification for mod metadata
Post by: m!m on April 01, 2015, 05:37:24 am
A few notes on launching a mod:
  • To determine the "-mod" flag, it has to flatten the dependency tree. The following rules apply:
    • If a mod appears several times in the list, only the last appearance is kept.
Wouldn't this mean that a less important dependency overrides a more important dependency?
In your example Z and B depend on C but only the dependency of B is kept although Z is "more important" (as is appears earlier in the dependency list).
I would propose to change the "ordering" of the mods to be specified by topological sorting the dependency graph (AFAIK that or something similar is what most package managers use). That would make sure that dependencies are resolved in the right order without allowing for much interpretation by the implementation.

A few notes on launching a mod:
  • To determine the "-mod" flag, it has to flatten the dependency tree. The following rules apply:
    • The special mod ID "self" refers to the mod which listed it as a dependency.
I know that the "self" dependency is designed to allow ST:R to specify a "primarymod" dependency but do we really have to make it this complicated? How do you implement the dependency resolution when a mod has a "self" dependency?
I use a graph to represent dependencies but when a mod has a "self" dependency I would need to restructure the graph and find a new root node. What do you think about simply providing a "primary dependencies" functionality that prepends the dependency to the -mod line? Most mods will never need to use it and it would greatly simplify the dependency resolution implementation.
Title: Re: JSON specification for mod metadata
Post by: ngld on April 01, 2015, 03:39:06 pm
Wouldn't this mean that a less important dependency overrides a more important dependency?
In your example Z and B depend on C but only the dependency of B is kept although Z is "more important" (as is appears earlier in the dependency list).
I would propose to change the "ordering" of the mods to be specified by topological sorting the dependency graph (AFAIK that or something similar is what most package managers use). That would make sure that dependencies are resolved in the right order without allowing for much interpretation by the implementation.
You're right about that but what happens if B overrides files contained in C? If C appears anywhere in the mod list before B, those files won't be overriden. My approach ensures that all overrides are applied.

I know that the "self" dependency is designed to allow ST:R to specify a "primarymod" dependency but do we really have to make it this complicated? How do you implement the dependency resolution when a mod has a "self" dependency?
I use a graph to represent dependencies but when a mod has a "self" dependency I would need to restructure the graph and find a new root node. What do you think about simply providing a "primary dependencies" functionality that prepends the dependency to the -mod line? Most mods will never need to use it and it would greatly simplify the dependency resolution implementation.
I wanted to avoid adding new fields. Couldn't you ignore the "self" dependency when you build your graph? If it's easier for you, I can add a new field instead, however that means that I'll also need to add that field to the Nebula page.  :blah:
Title: Re: JSON specification for mod metadata
Post by: ngld on June 29, 2015, 06:04:13 pm
Alright, here's a new proposal.
Instead of adding special mod IDs to the dependencies, we can add the following new fields:
Code: [Select]
"primarylist": ["<mod id>", "<mod id>", ...],
"type": "<mod|tc|engine|addon>",

"primarylist" works pretty much the same way it does now: The mods contained in this list will appear before the mod in the "-mod" list. Those mods still have to be listed as dependencies.

"type":

I hope that made sense... It's 1am here so I might've missed something.
Title: Re: JSON specification for mod metadata
Post by: chief1983 on June 30, 2015, 10:39:20 am
So excited to see you back on this, you have no idea.  FotG was just discussing how we'd like to package and distribute our first closed beta, whether to just do manual downloads, SVN access, or perhaps do a limited release over one of the distribution systems like this.
Title: Re: JSON specification for mod metadata
Post by: ngld on June 30, 2015, 02:30:18 pm
Glad you're excited about this. I haven't been able to spend much time on this lately, hence the long silence.
I hope we can resolve this soon because this is the only thing left to resolve before I can finish TC support for the Knossos launcher.

@chief: Do you have a rough estimate as to when you're going to release FotG?
Title: Re: JSON specification for mod metadata
Post by: chief1983 on June 30, 2015, 03:35:46 pm
No, as I said, we were just discussing preliminary packaging details yesterday.  If we had this at our disposal to test with though, we might be able to get something releasable very soon.