Author Topic: [Suggestion] Facility Upgrade vs Build over options  (Read 179 times)

Offline 0xEBJC

  • Colonel
  • ****
  • Posts: 180
  • Y'all are awesome! Thankful for this community.
    • View Profile
    • My Projects
[Suggestion] Facility Upgrade vs Build over options
« on: March 25, 2024, 08:58:14 pm »
It would be a helpful feature for mods to configure facilities to have the ability for specific other facilities to upgrade over them without affecting what they currently provide to the base, vs build over them.

The 'buildOverFacilities' options seams to stop the previous facilities provided resources, for example build over the HQ with the Virtualized HQ, I loose the lab capacity.


Example of desired outcome:
Code: [Select]
  - type: STR_GENERAL_STORES
    canBeBuiltOver: true
    allowableUpgradeOverFacilities:
      - STR_GENERAL_STORES_2
      - STR_GENERAL_STORES_3


So upgrading building a large or huge storage facility over a regular general stores would allow the base to still have the 50 storage space of the general store while the new facility is being upgraded over top.  But, I i built a Hangar over the general stores then I'd loose the storage space during the new build time because the Hangar isn't in that list.

Offline Yankes

  • Commander
  • *****
  • Posts: 3210
    • View Profile
Re: [Suggestion] Facility Upgrade vs Build over options
« Reply #1 on: March 25, 2024, 10:39:00 pm »
This is limitation of engine, when you upgrade you effective remove old building, it do not exists any more.

As from "game logic" then you put 100 workers to scrap all old hardware and put new one then its hard have normal functionality.

Offline 0xEBJC

  • Colonel
  • ****
  • Posts: 180
  • Y'all are awesome! Thankful for this community.
    • View Profile
    • My Projects
Re: [Suggestion] Facility Upgrade vs Build over options
« Reply #2 on: March 26, 2024, 09:18:15 pm »
Thanks for the quick reply.

So, I understand that it's a limitation currently of the game engine, I also don't understand why then do some facilities have properties such as:
Code: [Select]
    canBeBuiltOver: true

    buildOverFacilities:
      - STR_INTEL_LABORATORY

if the game is always 'destroying' the old facility weather you build over or manually remove then build a new facility, is there really any different in affect to have these settings as opposed to removing the facility and building a new facility?  I can understand that it may disconnect part of the base so building over a facility is helpful to not remove part of the base.  I've also have seen in X-Com Files where building Virtualized HQ over HQ allowed current researchers allocated in the HQ to continue researching as an over the total amount allowed as long as they don't stop or are removed from the research allocation.


I don't know if this would be an easy implementation or not, but what I was thinking would be for mod developers to have the ability to design and specify specific facilities they could upgrade over.

So for example if a mod has set the STR_GENERAL_STORES_2 to be allowed to be upgraded over by STR_GENERAL_STORES_3, then building the STR_GENERAL_STORES_3 over the STR_GENERAL_STORES_2 the facilities provided by the STR_GENERAL_STORES_2 would remain until the STR_GENERAL_STORES_3 was completed.

This could be done by:
1.) checking if the facility has the "canBeBuiltOver: true" flag and matches the "allowableUpgradeOverFacilities:"
2.) when building over and upgrading the facility there would be an additional new line in the facility listing in the base facilities, which would keep the old facilities base functions until the new facility is built.
Code: [Select]
      - type: STR_GENERAL_STORES_3
        x: 0
        y: 0
        buildTime: 4
        upgradingOver: STR_GENERAL_STORES_2
3.) The "upgradingOver" value would tell the game engine to keep those base facility functions until that line is removed.
4.) Once the new facility builtTime finished the facility functions would immediately shift from the old facility functions to the new facility functions.
5.) The game engine would ignore any checks and take the mod designers settings explicitly and assume they know what they are doing, so building a larger storage over a smaller one or similar for a hangar over a hangar or workshop over workshop makes sense, but if the mod developer said build over living quarters with sickbay the engine would ignore that this was probably wrong as after the upgrade, if the living quarters was maxed out before hand, you now have 50 living space used over the max with the new sickbay providing none of the living space.
6.) It probably would be helpful to have some sort of check or warning, after the end of the build, or at the end of the month when there is a warning about having a negative amount of money remaining, to also have a warning about "Base facilities are over used" and force a sell of people, items, ships, aliens, etc. This is also usually triggered at the end of a mission when supplies is going back to that base over the amount allowed.

Offline Yankes

  • Commander
  • *****
  • Posts: 3210
    • View Profile
Re: [Suggestion] Facility Upgrade vs Build over options
« Reply #3 on: March 26, 2024, 10:23:43 pm »
Thanks for the quick reply.

So, I understand that it's a limitation currently of the game engine, I also don't understand why then do some facilities have properties such as:
Code: [Select]
    canBeBuiltOver: true

    buildOverFacilities:
      - STR_INTEL_LABORATORY

if the game is always 'destroying' the old facility weather you build over or manually remove then build a new facility, is there really any different in affect to have these settings as opposed to removing the facility and building a new facility?  I can understand that it may disconnect part of the base so building over a facility is helpful to not remove part of the base.  I've also have seen in X-Com Files where building Virtualized HQ over HQ allowed current researchers allocated in the HQ to continue researching as an over the total amount allowed as long as they don't stop or are removed from the research allocation.


Because those are two different things, first determine if building can be "overrides" by anything, usually
used by corridors or other "place holder" building.

Second is for direct upgrading building that you have specific path of upgrades.

For researches, this is effective "bug" but as is beneficial to player and can't be exploited it become "feature".
We could "fix" it but then upgrading building would become bigger hassle.



I don't know if this would be an easy implementation or not, but what I was thinking would be for mod developers to have the ability to design and specify specific facilities they could upgrade over.

So for example if a mod has set the STR_GENERAL_STORES_2 to be allowed to be upgraded over by STR_GENERAL_STORES_3, then building the STR_GENERAL_STORES_3 over the STR_GENERAL_STORES_2 the facilities provided by the STR_GENERAL_STORES_2 would remain until the STR_GENERAL_STORES_3 was completed.

This could be done by:
1.) checking if the facility has the "canBeBuiltOver: true" flag and matches the "allowableUpgradeOverFacilities:"
2.) when building over and upgrading the facility there would be an additional new line in the facility listing in the base facilities, which would keep the old facilities base functions until the new facility is built.
Code: [Select]
      - type: STR_GENERAL_STORES_3
        x: 0
        y: 0
        buildTime: 4
        upgradingOver: STR_GENERAL_STORES_2
3.) The "upgradingOver" value would tell the game engine to keep those base facility functions until that line is removed.
4.) Once the new facility builtTime finished the facility functions would immediately shift from the old facility functions to the new facility functions.
5.) The game engine would ignore any checks and take the mod designers settings explicitly and assume they know what they are doing, so building a larger storage over a smaller one or similar for a hangar over a hangar or workshop over workshop makes sense, but if the mod developer said build over living quarters with sickbay the engine would ignore that this was probably wrong as after the upgrade, if the living quarters was maxed out before hand, you now have 50 living space used over the max with the new sickbay providing none of the living space.
6.) It probably would be helpful to have some sort of check or warning, after the end of the build, or at the end of the month when there is a warning about having a negative amount of money remaining, to also have a warning about "Base facilities are over used" and force a sell of people, items, ships, aliens, etc. This is also usually triggered at the end of a mission when supplies is going back to that base over the amount allowed.

I do not see point adding any new flags, only will complicate modding even more, how many will be there? 4 in total?
If anything would be done, then it would be for current flags but I do not think this is worth time to implement it.
Current solution provide 90% of requested functionality and all glitches are reasonable and do not break game heavily.

Simply our (my and Meridian) TODO list grow faster than we can even implements things from it.
This mean for use is better focus on thing that have bigger impact than improving current features that working fine.

(Meridian in theory could be interested, I did not ask him about this, but as he did not reply here its possible he do not have anything more to add).

Offline 0xEBJC

  • Colonel
  • ****
  • Posts: 180
  • Y'all are awesome! Thankful for this community.
    • View Profile
    • My Projects
Re: [Suggestion] Facility Upgrade vs Build over options
« Reply #4 on: March 27, 2024, 02:59:34 am »
OK, thanks for your feedback