ArchipelagoMW / Archipelago

Archipelago Multi-Game Randomizer and Server
https://archipelago.gg
Other
412 stars 556 forks source link

Factorio: Starting the client should auto-manage installed mods and actually start a client #3030

Open Hexicube opened 3 months ago

Hexicube commented 3 months ago

What feature would you like to see?

Right now starting the Factorio "client" through the launcher actually only starts up a server, and then requires you to separately start up a client (which can't use the same files due to locking) as well as requiring manually placing the AP mod in both mods folders.

The launcher flow should instead be:

  1. Ensure two copies of a Factorio installation exist and have identical versions (data/base/info.json)
    • If only the "Factorio" folder exists (or versions differ), offer to make a copy called something like "Factorio Client"
  2. Verify the user logged in with their client (player-data.json "service-username")
    • If needed launch the client for them to do so
  3. Ask the user to select the run-specific mod zip and copy this into the client's mod folder, and delete any other AP mod in there
  4. Copy the entire mods folder from client to server (doing it this way around allows in-game config tweaking for other mods)
  5. Ensure the player is admin for unpausing ("--server-adminlist"), then start the server with a new world and pause it
  6. Start the client and auto-connect to the server ("--mp-connect localhost")
  7. Unpause on countdown
Hexicube commented 3 months ago

Update:

There's actually a far easier method to dual-instance through the launcher by creating a copy of the config file and changing the write path.

The config/config.ini file can be copied (I used "config-alt.ini") and the write-data path changed to point into a folder (I appended "/altwrite"), allowing for the same install to be used for both client and server. The client would then be launched with "--config ./Factorio/config/config-alt.ini".

Mods would still need copying from client to server (in this case the client mod folder is now inside the altwrite folder) but this eliminates needing two installations and needing to verify they match as both will use the same files for base game content.

This would eliminate part of the launcher flow where it has to verify the installations have matching versions as well as any required handling if they do not.

New flow:

  1. Ensure a copy of config.ini exists, if not create it and modify the write-path folder to point elsewhere
  2. Verify the user logged in with the second config client (it has its own player-data.json file)
  3. Ask the user to select the run-specific mod and copy this into the inner mods folder, removing previous AP mods if needed
  4. Copy the entire mods folder to the main mods folder
  5. Ensure the player is admin for unpausing
  6. Start the client using "--config /Factorio/config/config-alt.ini --mp-connect localhost" to join the server automatically
  7. Unpause on countdown