Author Topic: [Suggestion] Custom base sets and New Game starting base selection  (Read 825 times)

Offline WarStalkeR

  • Captain
  • ***
  • Posts: 56
  • Repensum Est Canicula
    • View Profile
[Suggestion] Custom base sets and New Game starting base selection
« on: September 04, 2024, 12:27:14 pm »
Hello Meridian! I implemented code that allows to define custom base sets and (if related option is enabled) to select them in a new game menu. I was pretty much inspired by this XPZ submod: https://openxcom.org/forum/index.php?topic=12172.0 - then went to the chat, asked people about it and everybody pretty much welcomed this idea.

You can find relevant dedicated (atomic) commit here: https://github.com/WarStalkeR/OpenXcomExMore/commit/5fbd227d415efa55b399618acec030460b1c5172

This is how it looks right now:


Code-wise it requires modders to define in rule file something like this:
startingBaseSets:
- name: STR_INIT_BASE_NAME
  baseDefault:
    ...base code here...

And it follow exactly same code structure as in 'startingBase', so everything is well known.

Beside 'baseDefault' there is also 'baseBeginner', 'baseExperienced', 'baseVeteran', 'baseGenius' and 'baseSuperhuman' for each difficulty, just like with original 'startingBase' and 'startingBaseDIFF'. Localization-wise, for every base set name (i.e. STR_INIT_BASE_NAME), you also need to add '_DESC' variant with description (i.e. STR_INIT_BASE_NAME_DESC) and base set is good to go.

You might see me using 'YAML::Clone()' in code a lot - but that's because not I wanted, but because sometimes when variables were reset via empty 'YAML::Node()' actual mod data was lost.

As always, if anything else needs to be improved, please tell me so and I will work on it. Thankfully, a lot of similar code already exists, so I didn't had many changes to screw everything up in a very horrible, horrible manner.

And if everything is good to go, give me a green light and I will create dedicated OXCE commit and pull request.
« Last Edit: September 04, 2024, 12:39:30 pm by WarStalkeR »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9093
    • View Profile
Re: [Suggestion] Custom base sets and New Game starting base selection
« Reply #1 on: September 04, 2024, 01:35:52 pm »
Just a bland answer:
we already have the ability to define custom starting bases, in mods and submods. I am not interested in having the "same" feature implemented multiple times.

then went to the chat, asked people about it and everybody pretty much welcomed this idea.

If modders want this feature, they need to show their interest here on the forum. Then I might reconsider my position/opinion.
(I am not (and will not be) available anymore on any 3rd party chat platform.)

Offline WarStalkeR

  • Captain
  • ***
  • Posts: 56
  • Repensum Est Canicula
    • View Profile
Re: [Suggestion] Custom base sets and New Game starting base selection
« Reply #2 on: September 04, 2024, 02:16:06 pm »
we already have the ability to define custom starting bases, in mods and submods. I am not interested in having the "same" feature implemented multiple times.
As of right now it is possible to define only single custom starting base per submod. And next submod will overwrite it.

Here you can define base sets for various scenarios within same submod. Whether it is abandoned X-COM Base from First Alien War in Europe, pristine locked out Research Center in USA or forgotten and somewhat intact Nuclear ICBM Silo in North Korea, including them containing unique facilities for each base, and kick-starting completely different scenario chains.
« Last Edit: September 04, 2024, 02:18:53 pm by WarStalkeR »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9093
    • View Profile
Re: [Suggestion] Custom base sets and New Game starting base selection
« Reply #3 on: September 04, 2024, 02:54:04 pm »
Yes, I understand.

In one solution you can select it in the "Start New Game" GUI, in the other solution you can select it in the "Mods" GUI.
(in both solutions submods overwrite each other and the parent)
(the current solution requires multiple submods for multiple options, which I don't see as a disadvantage or a problem)

Offline WarStalkeR

  • Captain
  • ***
  • Posts: 56
  • Repensum Est Canicula
    • View Profile
Re: [Suggestion] Custom base sets and New Game starting base selection
« Reply #4 on: September 04, 2024, 03:08:06 pm »
Yes, I understand.

In one solution you can select it in the "Start New Game" GUI, in the other solution you can select it in the "Mods" GUI.
(in both solutions submods overwrite each other and the parent)
(the current solution requires multiple submods for multiple options, which I don't see as a disadvantage or a problem)
Exactly. Pretty much QoL (and a little bit flavor-text) feature.

Either way, I will be more than happy to receive your input regarding the code I wrote and how it can be improved (of course when you're free, since you have a lot of OXCE-related things to handle). I'm pretty sure there are some parts of code that could be done better and I have much to learn, when it comes to C++.