Archipelago
Archipelago copied to clipboard
SC2: Add an automated installation process for the maps and mod within SC2Client.
As is, this PR adds a function that downloads a .zip of @TheCondor07 's Starcraft2ArchipelagoData ~~repo~~ latest release and extracts the Maps and Mods files to their appropriate locations. Here's what I want done before I remove the "draft" status:
- ~~I would like to search for map/mod files upon opening the client or connecting to a server, and prompt the user to begin this process if any are missing.~~ Edit: While I'd prefer a dialog box for this, the user is now prompted via
sc2_logger. - ~~I would like to improve logging and user-facing feedback during this process, writing less in most cases and writing more in others.~~
- ~~I would like to improve error handling and my understanding of the failure points in this process.~~ Edit: No longer relevant.
- ~~I would like someone else to assist me in error handling for the actual download. I know nothing about interfacing with the web. The code for the download was copy-pasted.~~
- ~~I would like to remove the command that runs this function.~~ Edit: No longer something I want.
- I would like to test this code on a variety of machines and with a variety of AP / SC2 installations.
As remarked on by strotlog, I also need to not use the stack overflow code, to avoid licensing issues.
Edit: This has now been addressed.
-
I think normally you would use releases or tags instead of the repo. You can ask github about them:
- releases: https://api.github.com/repos/TheCondor07/Starcraft2ArchipelagoData/releases
- latest release: https://api.github.com/repos/TheCondor07/Starcraft2ArchipelagoData/releases/latest (does not include pre-releases)
- tags: https://api.github.com/repos/TheCondor07/Starcraft2ArchipelagoData/tags
you parse the reply as json to then extract the download link.
The one problem that's hard to solve is that a mod may be incompatible to the seed or client. Should probably ask @TheCondor07 what the expected forward/backward compatibility is like.
In any case you should remember (write a text file to sc2?) which mod version was installed to be able to check for updates.
Checking for updates should probably be rate limited - i.e. use persistent storage to remember when the last check was and ignore if it was in the last ~5 minutes or so.
1b. currently we don't have a yes/no dialog in kivy. So that's something someone might want to dive into. If you want i could try extend the MessageBox helper - you would then
messagebox("SC2", "Install/update mod?", buttons={"Yes": update, "No": None})or something. -
whatever you write to logging should show up in the UI
-
in most cases you could just log the exception, so it shows up in the UI, and then handle "common problems" in the future should there be a need.
-
wrap in try-except and log the error.
-
may not be a good idea since forcing an update could be useful
-
see 1., i think the main problem could be backwards/forward compatibility. I can definitely try on my WINE sc2 once this is ready. I'm not sure we have any mac users (maybe ask on discord in #starcraft-2-wol)
Yes, releases would be preferred as often times I will have pre-release changes that I don't want automatically downloaded.
In terms of backwards compatibility, the mod is currently being developed with the mindset of being backwards and forwards compatible so that is not a concern. A text file should be added to Starcraft 2 to remember the version however. If you need something in the repo on github side of things to check against let me know.
Busy right now, but I will look into the code itself this weekend to give more feedback on it.
My goals are met for now. As requested, the downloader now has very rudimentary version checking (looks for the "tag_name" at the latest release and compares it to SC2PATH/ArchipelagoSC2Version.txt) and will check for updates upon connecting to a server. I am not currently using persistent storage for rate limiting; I don't expect users to run /connect or /download_data True often enough to make it an issue, but I can implement that if y'all want me to. (Me not doing it was more motivated by "wow that's a lot of code to read and figure out" and less by "I have meaningful insight into the implications and practice of rate limiting.")
This should be ready for testing.
Yes, releases would be preferred as often times I will have pre-release changes that I don't want automatically downloaded.
In terms of backwards compatibility, the mod is currently being developed with the mindset of being backwards and forwards compatible so that is not a concern. A text file should be added to Starcraft 2 to remember the version however. If you need something in the repo on github side of things to check against let me know.
Busy right now, but I will look into the code itself this weekend to give more feedback on it.
@TheCondor07 awaiting said feedback.
So have tested it and giving it my thumbs of approval. Once implemented going to expand this to included downloading files for an in-client tracker that I was holding on making a PR for until this was finished.