-
-
Notifications
You must be signed in to change notification settings - Fork 108
Implement custom mission support with CampaignTagSelector #518
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
base: develop
Are you sure you want to change the base?
Conversation
Nightly build for this pull request:
|
6414310
to
787614a
Compare
787614a
to
1485f2a
Compare
ba2aa28
to
35a20f2
Compare
…fig from custom missions
…on selector user setting controls
I took a liberty of adding some improvements to this PR.
The spawner PR which is required for the custom mission logic to work correctly in YR has been updated accordingly as well, as has been Phobos' develop branch to improve compatibility with the show briefing feature. There is currently no work done on any sort of campaign progression tracker or global variable toggles. They might be better saved for another PR anyway. |
@Starkku Do you have a migration guide on |
For the purposes of legacy support and ease of use, it may be worth making the CampaignSelector able to create a default set of controls if it doesn't find the ones expected. |
good thought @Starkku is that possible? |
Yes and no. Default settings are doable but partly defeat the purpose and other If it really is that big of an issue that example configs (both the TS client one already included if need be, one in Mod Base) do not solve then can consider it I guess. I would however probably just write a migration guide alongside other docs and provide example configs. |
Back when Maybe something like an upgrade script could be provided? Or a legacy compatibility mode that is default off, or something like that. |
Not enthusiastic towards either of those. Upgrade script would take way too much time to work out and take a lot of edge-cases into accord (especially since it would have to somehow know the built-in defaults in client for the legacy windows) and compatibility mode would just be extra complexity on client side. For me right now it is either full migration with maybe docs/example configs like it already has or I'll just revert the migration, I have no interest in taking any other approach at this point in time. If someone else wants to work on either of those be my guest, although I would advise against the legacy compatibility mode. |
- btnReturn is now an optional control - Fixed user setting controls not being handled correctly - Added a client side-solution for save/load missing ingame strings for now
@Starkku I suggest revert the initializablewindow migration in CampaignSelector. We can perform this migration when global variables are introduced, in another PR |
If the migration is not introduced now, this will be just an optional feature that people don't have to do anything to upgrade to this version. Otherwise we'll have to release 2.13. Since (safe: no breaking changes and no bugs on existing features that exist for a long time) |
This reverts commit 8959f55.
Reverted |
private CampaignTagSelector campaignTagSelector; | ||
|
||
private List<Mission> Missions = new List<Mission>(); | ||
private List<Mission> lbCampaignListMissions = new List<Mission>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not listbox, hence the lb
prefix is incorrect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
82ac513 Rename lbCampaignListMissions to selectedMissions
// copy the CSF file if exists | ||
foreach ((string ext, string filename) in new (string, string)[] | ||
{ | ||
("csf", ClientConfiguration.Instance.CustomMissionCsfName), | ||
("pal", ClientConfiguration.Instance.CustomMissionPalName), | ||
("shp", ClientConfiguration.Instance.CustomMissionShpName), | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about making this customisable and not just csf, pal, shp? just need to ensure it doesn't override any client files accidentally
not sure if better done in this PR or left for another one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
34a5675 Allow customized custom mission supplemental files
if (SafePath.GetFile(SafePath.CombineFilePath(ProgramConstants.GamePath, sourceFileName)).Exists) | ||
File.Copy(SafePath.CombineFilePath(ProgramConstants.GamePath, sourceFileName), SafePath.CombineFilePath(ProgramConstants.GamePath, filename)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have linking now which would make sense if some additional stuff like custom assets is supplied, I think could use them here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b051a1a Create hard links for supplemental mission files
didn't encounter this error on my machine. will workaround it anyway |
… if undefined in mission config
Looks good to me now. The supplementary file logic currently makes assumptions that there are no multiple files included with same file extension (it cannot handle this case gracefully) but I am unsure if this is required, only scenario I can think of is separate LS for the different resolutions, this is not required in YR but might in TS, uncertain how to solve that. I took a liberty of adjusting the defaults for loading screen files to use the ones from the supplementary file definitions if undefined in mission config, as there is practically no reason for it to be customized in mission config most of the time when it should match whatever is in supplementary file definitions to work unless there is a loading screen with that name that is included in game/mod files (which will still work if you write that in the mission config). |
@Metadorius Can this PR be merged? |
```ini | ||
[Settings] | ||
CustomMissionPath=Maps/CustomMissions ; path to the folder containing fan-made maps | ||
CustomMissionSupplementDefinition=csf|stringtable99.csf|pal|custommission.pal|shp|custommission.shp ; supplement files that are supposed to be copied to the game folder when a custom mission is played |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason to introduce new syntax like this? Can't you do the same with ,
as a separator or simple as separate keys?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be the only place where the list is processed as pairs. Therefore I want to use a different separator to notify modders. And | representing pairs is also used in Win32 OpenFileDialog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more confusing part is that the pairs are also separated from other pairs by |
The entire system also hinges on not defining more than one pair with same file extension. It cannot currently handle that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more confusing part is that the pairs are also separated from other pairs by |
The "pairs are also separated from other pairs" matches the same convention in https://learn.microsoft.com/en-us/dotnet/api/microsoft.win32.filedialog.filter
e.g.,
dlg.Filter = "Word Documents|*.doc|Excel Worksheets|*.xls|PowerPoint Presentations|*.ppt" +
"|Office Files|*.doc;*.xls;*.ppt" +
"|All Files|*.*";
The entire system also hinges on not defining more than one pair with same file extension. It cannot currently handle that.
This can be ignored for now, left as another PR. The TS resolution things require a special handling so we can leave it as a future work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think non-IT modders ever encountered that, so that diminishes the example. Why not define those all as separate keys?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think non-IT modders ever encountered that, so that diminishes the example. Why not define those all as separate keys?
Yeah, right. Regex is friendly to non-IT modders but "|" symbol is not.
Whatever. So what's the prefered way to express the setting? csf,stringtable99.csf,pal,custommission.pal,shp,custommission.shp
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, right. Regex is friendly to non-IT modders but "|" symbol is not.
I never claimed it is, regex is hostile to anyone, even IT people lol. In that case it provided flexbility though, in this case it doesn't provide flexibility.
I thought of something like
CustomMissionFile0Extension=csf
CustomMissionFile0CopyAs=stringtable99.csf
CustomMissionFile1Extension=...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, right. Regex is friendly to non-IT modders but "|" symbol is not.
I never claimed it is, regex is hostile to anyone, even IT people lol. In that case it provided flexbility though, in this case it doesn't provide flexibility.
I thought of something like
CustomMissionFile0Extension=csf CustomMissionFile0CopyAs=stringtable99.csf CustomMissionFile1Extension=...
I would prefer the following, still making the setting in oneline
csf:stringtable99.csf, pal:custommission.pal
:
or =
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is somewhat better because it's possible to add new parameters without breaking backwards compatibility, but I am still not a fan of cramming everything in one line, it's not like we're constrained on storage space.
I've stolen some of the changes into my branch for campaign game options, I propose we merge that first and then rebase this one (if even needed), since my changes are a subset of those and doing things backwards would most likely guarantee a conflict. |
This PR includes and therefore closes #367 and closes #370, avoiding maintaining too many PRs
This PR works with CnCNet/yrpp-spawner#19
the campaign tag selector
This PR is backward compatible as by default the option is off. Modders can enable the
CampaignTagSelectorEnabled
option to use this feature.This feature enables modders to make a "choose your side" interface before the campaign selector. Choosing among "Act 1/Act 2/..." or any other tags is also possible.
The screenshot below shows the feature. (I am not an expert in beautifying user interfaces so it is only a working example. Fully configurable through ini files.)
The modders define tags for missions in
battle.ini
and customize the selector window inCampaignTagSelector.ini
using the new INItializableWindow ini format.I use TSC v6 client as an example. The corresponding files are attached here.
TSC.v6.example.zip
the custom mission support
Apart from the campaign tag selector feature brought by #370, this PR also include a custom mission support for YR and Ares/Phobos.
Users can drop third-party fan-made singleplayer missions in
Maps\CustomMissions
folder, like this:This installs a custom mission named
vnsepa
.vnsepa.map
file is basically a.map
file containing campaigns, with the following new-added sectiones:The two sections define mission info for the client as well as YR spawner.
To show custom missions, modders need to define a button
ButtonTag_CUSTOM
in fileCampaignTagSelector.ini
.