A better way to handle modpacks

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
AnZaNaMa
Burner Inserter
Burner Inserter
Posts: 7
Joined: Tue Dec 05, 2017 4:59 am
Contact:

A better way to handle modpacks

Post by AnZaNaMa »

Hello, I am currently looking into creating either a mod or external program that will be able to manage "modpacks" for Factorio

This, I believe, is something that would help make it easier for groups of people to play the game together. Additionally, I feel like modpacks are something that could add a whole new level of immersion to the game. They allow creative minds to come up with unique combinations of mods and settings to give players a specific challenge or different way to play the game.

However, I have found that there's no real way to accomplish such a task. At the moment, the Lua API does not provide a way to manage the state of other mods. Currently, the way users have been handling modpacks is by creating a mod that lists all the pack's mods as dependencies. This, however is very limited in what it can do. From what I can tell, even if a mod has listed dependencies, there is no way to automatically install those dependencies when the mod is installed. So, the user must go and manually download each mod required for the pack.

Additionally, this does not provide an easy way to switch between "modpacks". If someone is playing with one "modpack" and wants to switch to another one, they would have to disable all the mods from the original modpack one-by-one and enable the ones for the new modpack.

The final hurdle to having a good solution for "modpack" management is that modpacks should have a way to come with preconfigured settings for the mods they include. However, this is less of a problem as it can be handled by distributing the mod settings files with the modpacks themselves.

Solutions:
There are a couple of ways I can see that would allow this sort of functionality to take place. One of these would be to add some sort of functionality to the lua API that would allow a "Modpack Manager" mod to install new mods, as well as enable and disable the mods that are already installed.

Another solution that may even be easier than the first one would be to expose the API that the game is already using that allows it to view listings for mods on the "mods.factorio.com" site and make requests to download mod files. Since the game already includes this functionality, all that would be required is to allow us to see what requests we need to make in order to list and download mods.

I have been inspecting the source of the website and I have found that the different mods have a well-defined structure, but the download URIs for all the mods include a randomized string that makes it impossible for a mod manager to predict what the URI will be. Sure, it would be possible to scrape the information needed from the website, but this feels like a dirty solution to this problem and I believe the game itself already has access to this sort of "API" that we just can't see, as all the network traffic from the game is encrypted.

Boodals
Fast Inserter
Fast Inserter
Posts: 129
Joined: Sun Feb 11, 2018 7:10 pm
Contact:

Re: A better way to handle modpacks

Post by Boodals »

AnZaNaMa wrote:
Sat Mar 16, 2019 12:46 am
At the moment, the Lua API does not provide a way to manage the state of other mods.
Any mod can change any prototype from any other mod that it depends on. Remote interfaces can be added to scripts to allow scripts to interact and work together.
AnZaNaMa wrote:
Sat Mar 16, 2019 12:46 am
Currently, the way users have been handling modpacks is by creating a mod that lists all the pack's mods as dependencies. This, however is very limited in what it can do. From what I can tell, even if a mod has listed dependencies, there is no way to automatically install those dependencies when the mod is installed. So, the user must go and manually download each mod required for the pack.

Additionally, this does not provide an easy way to switch between "modpacks". If someone is playing with one "modpack" and wants to switch to another one, they would have to disable all the mods from the original modpack one-by-one and enable the ones for the new modpack.
As of 0.17.12, the ingame mod GUI will install dependencies. It might even automatically enable dependencies, but i'm too lazy to test.
AnZaNaMa wrote:
Sat Mar 16, 2019 12:46 am
The final hurdle to having a good solution for "modpack" management is that modpacks should have a way to come with preconfigured settings for the mods they include. However, this is less of a problem as it can be handled by distributing the mod settings files with the modpacks themselves.
Mods can change the default values of other mod's settings in their own settings.lua files, but there may be issues if the user also uses the mod outside of the mod-pack. If you don't want to let users change the settings, you can change the allowed_values of the setting so that they can't change it.
AnZaNaMa wrote:
Sat Mar 16, 2019 12:46 am
Solutions:
There are a couple of ways I can see that would allow this sort of functionality to take place. One of these would be to add some sort of functionality to the lua API that would allow a "Modpack Manager" mod to install new mods, as well as enable and disable the mods that are already installed.

Another solution that may even be easier than the first one would be to expose the API that the game is already using that allows it to view listings for mods on the "mods.factorio.com" site and make requests to download mod files. Since the game already includes this functionality, all that would be required is to allow us to see what requests we need to make in order to list and download mods.
Something like this is impossible because scripts are only loaded when you load a save game or start a new one. No lua can be ran while in the main menu. The best you could do is add a scenario that includes all of the mods scripts combined together, but that can't do anything with prototypes, and you'll have to check each mod's license.


In short, there are existing solutions, that is why people already make mod packs. They may not be perfect, but they're good enough.

AnZaNaMa
Burner Inserter
Burner Inserter
Posts: 7
Joined: Tue Dec 05, 2017 4:59 am
Contact:

Re: A better way to handle modpacks

Post by AnZaNaMa »

Thanks for your response. I apologize, I should have taken a look at the newer versions of Factorio before I made any conclusions. I was unaware that newer versions allowed dependencies to be automatically installed. I have been playing on the latest release and hadn't opted into beta versions through Steam.

Post Reply

Return to “Modding interface requests”