Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split out WBI play modes #8275

Merged
merged 1 commit into from
Jan 10, 2021
Merged

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Dec 23, 2020

Problem

See #8270, the WildBlueIndustries mods have something called "play modes" which are sets of configurations that can be swapped out to change how several mods work. They're distributed inside the downloads, with the default play mode's files distributed as .cfg files and the other play modes' files distributed as .txt files. Changing the play mode renames a bunch of files from .cfg to .txt and others from .txt to .cfg.

Currently CKAN just installs all of these files as they are in the ZIP, which is essentially unmaintainable, because the user can use a tool built into the mods to switch play modes, which renames the files, which means CKAN loses track of them and can't remove, upgrade, etc. properly.

Changes

NOTE: These changes are almost ready for merge! So far it looks like this solution will work, but it would be a good idea to validate it with @Angel-125 before merging, and we should wait to test the Heisenberg+USI combo when it is ready.

Now the play modes are split into separate <Mod>-PlayMode-<PlayModeName> modules for these mods:

Mod Play modes
WildBlueTools ClassicStock, CRP, Pristine, Simplified, USI
Buffalo ClassicStock, CRP, USI
DSEV ClassicStock, CRP, Pristine, USI
MOLE ClassicStock, CRP, Pristine, USI
Pathfinder ClassicStock, CRP, Pristine, Simplified, USI
Heisenberg ClassicStock, CRP, Pristine, Simplified

The USI play mode is from @TheDogKSP's separate mod, also added in this PR. It is handled as a single module providing play modes for multiple mods, since it is distributed in one ZIP.

  • Each play mode module installs .cfg files only, renaming upstream files from .txt as necessary.
  • Each play mode module provides a <MainMod>-PlayMode virtual module, which is added to the main mods' depends lists. This way CKAN compels you to choose a play mode when installing any of these mods.
  • Play mode modules depend on the main WildBlue-PlayMode-<Whatever> module for their play mode and conflict with the other play mode modules for the same mod, so you can only have one play mode installed at a time, and it will be the same one for all mods
  • When a mod doesn't ship a set of files for a particular play mode, the core WildBlue play mode provides that play mode for that mod. For example, if you choose to install Buffalo, you can choose from Buffalo-PlayMode-ClassicStock, Buffalo-PlayMode-CRP, WildBlue-PlayMode-USI, WildBlue-PlayMode-Pristine, and WildBlue-PlayMode-Simplified. This way all play modes are available for all mods.
  • Since only one play mode will be installed at a time, the in-game mode switcher built into the WBI mods automatically detects that play mode and doesn't let the user switch to other play modes; switching play modes is done by removing and installing play mode modules in CKAN.
  • To make Heisenberg work, HooliganLabsAirships is marked as compatible with KSP 1.11
  • Staging is enabled for all the play modes and mods with play modes, so there will be a manual review process of the metadata after any new versions are released and before the metadata is published to users, to allow us to detect new play modes or new .txt files within a play mode

ClassicStockResources:

  • Now depends on WildBlue-PlayMode-ClassicStock, because it is only compatible with the ClassicStock play mode
    • WildBlue-PlayMode-ClassicStock in turn suggests ClassicStockResources
  • Is removed from the depends of WildBlueTools, Buffalo, DSEV, Heisenberg, MOLE, and Pathfinder, to avoid installing it when other play modes are in use.

Now CKAN will be able to properly upgrade and remove these mods, since it will know which files are installed for each. A user who installs Buffalo and MOLE, switches to CRP mode, and then installs an upgrade will end up with a valid install instead of a mix of renamed CRP .cfg files from before the upgrade and newly installed ClassicStock .cfg files from after the upgrade.

Fixes #8270.

Future maintenance planning

Scenario Action
A new play mode is created Create a new module for each mod supporting the new play mode, providing <ModName>-PlayMode-<NewMode>, conflicting with other play modes for same mod, depending on WildBlue-PlayMode<NewMode>, rename all the .txt files to .cfg using install[].as, add <Mod>-PlayMode-<NewMode> to provides of WildBlue-PlayMode-<NewMode> for any missing mod+mode combos
A new WBI mod is created Index that mod, filter out its Templates folder, install Templates/Common, depend on <NewMod>-PlayMode, make one module providing that virtual module for each play mode included, rename the .txt files to .cfg using install[].as, add <NewMod>-PlayMode-<MissingMode> to the provides of WildBlue-PlayMode-<MissingMode> for any play modes not provided
A new version of a mod is released A bunch of pull requests will be submitted for review, make sure there aren't any new .txt files, then merge them
A new .txt file is added to a play mode Update the install stanzas to install it renamed to .cfg

@HebaruSan

This comment has been minimized.

@HebaruSan

This comment has been minimized.

@ghost
Copy link

ghost commented Dec 23, 2020

If you like 3rd party testing once its done, sign me up!
Will be available from 27th dec. on.

@HebaruSan
Copy link
Member Author

@TheDogKSP good idea, here's a repo URL you can plug into the CKAN client to get the testing data (Settings→CKAN settings→New button at top→Enter a name, paste the below under URL→Add→Close settings→Refresh):

After that you should have the new modules and changed versions of the old modules.

@ghost
Copy link

ghost commented Dec 26, 2020

First tests on a blank install:

Test Case 1: GOOD

  • on clean system, select WildBlueTools for install
  • expected: enforced to choose one (and only one) corresponding playmode; associated files active as .cfg
  • actual: enforced to choose one playmode; files active as .cfg

Test Case 2: GOOD

  • after TC1, select a different playmode to install
  • expected: conflicts with previous one; after changing no leftover files from previous mode and new files active as .cfg
  • actual: mode changed successfully

Test Case 3: GOOD

  • after TC2, select playmode USI
  • expected: conflicts with previous one; WBI tools has only common folder left, playmode usi installed under GameData
  • actual: installed as expected

Test Cases 4a/b/c/d: PARTIAL GOOD

  • on clean system, select (a)Pathfinder (b)MOLE (c)DSEV (d)Buffalo for install
  • expected: enforced to choose one (and only one) corresponding playmode; associated files active as .cfg in WBI Tools and Pathfinder
  • actual: installed with Classic Stock playmode [but that's ok and a reasonable default for all Angel-125 mods];
    a) Pathfinder: actually all templates installed (classicstock as active, rest as inactive)
    b) MOLE: same
    c) DSEV: same
    d) Buffalo: same

Test Case 5: NOT YET READY

  • after TC4, switch playmode to CRP
  • expected: respective CRP playmode templatest activated in WBI Tools/Pathfinder/Mole/DSEV/BUffalo
  • actual: switched to CRP playmode for WBI Tools, Pathfinder/Mole/DSEV/BUffalo uninstalled due to prereqs unmet [currently a good behaviour as it avoids inconsistencies]

Test Case 6: NOT YET READY

  • after TC5. switch to playmdoe USI
  • expected: after WBI mods only leave folder common, rest of the playmodes uninstalled, playmode usi installed under GameData
  • actual: TBD, after Pathfinder/Mole/Dsev/Buffalo are ready

-> I am highly impressed, this is working magnificiently!
Now getting this into the actual parts mods (Pathfinder/Mole/Dsev/Buffalo) will be quite some more work I guess, but then it'll work like a charm!! 👍

@HebaruSan

This comment has been minimized.

@HebaruSan HebaruSan force-pushed the fix/wildblue-playmodes branch 4 times, most recently from 7f971b1 to 6b1e316 Compare December 27, 2020 03:33
@HebaruSan

This comment has been minimized.

@HebaruSan HebaruSan force-pushed the fix/wildblue-playmodes branch 4 times, most recently from b316aa1 to 87ba01c Compare December 27, 2020 04:44
@HebaruSan

This comment has been minimized.

@HebaruSan HebaruSan force-pushed the fix/wildblue-playmodes branch 2 times, most recently from b9430c8 to bf4153f Compare December 27, 2020 05:04
@HebaruSan

This comment has been minimized.

@HebaruSan
Copy link
Member Author

HooliganLabsAirships author confirms compatibility with KSP 1.11 on forum thread:

@HebaruSan HebaruSan force-pushed the fix/wildblue-playmodes branch 5 times, most recently from ea4ed70 to 471b70d Compare December 27, 2020 07:08
@DasSkelett
Copy link
Member

That sounds like something we should enable staging for, so we don't miss new files being added that need to be renamed. (Even if this means comparing all the files on each mod update 😢)

@HebaruSan
Copy link
Member Author

Staging added in latest commit. Thanks, that answers the open question of how to catch relevant changes.

@HebaruSan
Copy link
Member Author

@TheDogKSP don't put your .git folder in the ZIP ;)

image

@ghost
Copy link

ghost commented Dec 31, 2020

@TheDogKSP don't put your .git folder in the ZIP ;)

Ops, caught me, packed the zip from the wrong folder, thanks!

Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a reasonable concept to handle this mod family, good job figuring it out @HebaruSan. Also thanks for the extensive documentation in the PR message.
I've glanced over the metadata and from what I can see it looks good (without checking all the individual files though).
Thanks a lot @TheDogKSP for bringing this to our attention and play-testing it!

From my side this is good to go, maybe we can also reach Angel to discuss this with us.

@HebaruSan
Copy link
Member Author

We just got a positive reaction from Angel-125. 🎉

@TheDogKSP, the last loose end here is whether your play mode will support Heisenberg. Should we wait for that or merge this without it?

@ghost
Copy link

ghost commented Jan 10, 2021

We just got a positive reaction from Angel-125

@TheDogKSP, the last loose end here is whether your play mode will support Heisenberg. Should we wait for that or merge this without it?

Go ahead with the merge, i didnt have time to do sth about heisenberg so far...

@HebaruSan HebaruSan merged commit 2dc3ed5 into KSP-CKAN:master Jan 10, 2021
@HebaruSan HebaruSan deleted the fix/wildblue-playmodes branch January 10, 2021 17:26
@HebaruSan
Copy link
Member Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wild Blue Industries support concerns
2 participants