Author Topic: [DONE] [Suggestion] Alien missile strikes  (Read 3829 times)

Offline Eddie

  • Commander
  • *****
  • Posts: 545
    • View Profile
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #15 on: October 28, 2018, 06:48:31 pm »
Some ideas to further expand on this feature:

Assuming this is not a nuclear missile hitting the base but an UFO doing bombing runs, the function of base defence facilities could be different. There is not one bombing run but the UFO continuously bombs the base (doing a bit of damage each run) while base defence keeps shooting at it. Once the UFO is sufficiently damaged by the base defences (or runs out of ammo, e.g. timer runs out) it disengages and stops the bombing. Stronger base defence shortens the time of bombing. This way, weak base defence is still useful.

To make base bombing less punishing, gradual damage models could be implemented. For example, a living quarters is changed to "damaged" on the first hit, "rubble" on the second. The damaged living quarters is still a living quarters, but has reduced capacity. The "build over" feature can then be used to repair the facility, defining repair time and cost.

Offline Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 6320
  • Aaand we're back!
    • View Profile
    • My Wiki
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #16 on: October 29, 2018, 07:02:00 pm »
@Meridian,
I was looking at the code dealing with alien missile strikes and I have a question: when selecting which facility will be hit, does the code favor larger (2x2) structures? Naturally 2x2 facilities have 4 times the odds of being hit than a 1x1 structure because they occupied a larger area, but from looking at the code it seemed to me that larger facilities will always be selected first for destruction. Did I misunderstood the code?

If you didn't change "missileAttraction", then all facilities have equal chance of being hit. Same chance for 2x2 hangar as for 1x1 radar.

Assuming this is not a nuclear missile hitting the base but an UFO doing bombing runs, the function of base defence facilities could be different. There is not one bombing run but the UFO continuously bombs the base (doing a bit of damage each run) while base defence keeps shooting at it. Once the UFO is sufficiently damaged by the base defences (or runs out of ammo, e.g. timer runs out) it disengages and stops the bombing. Stronger base defence shortens the time of bombing. This way, weak base defence is still useful.

No, thank you.
And yes, it is a missile... either conventional (destroys facilities), or nuclear (destroys bases).

To make base bombing less punishing, gradual damage models could be implemented. For example, a living quarters is changed to "damaged" on the first hit, "rubble" on the second. The damaged living quarters is still a living quarters, but has reduced capacity. The "build over" feature can then be used to repair the facility, defining repair time and cost.

Done.
You can now define different destroyed facility for each facility:

Code: [Select]
facilities:
  - type: STR_HANGAR
    destroyedFacility: STR_HANGAR_DAMAGED    # must be of same size as the original facility

If not defined, the global rubble facility setting still applies: https://openxcom.org/forum/index.php/topic,6668.msg105690.html#msg105690
« Last Edit: October 30, 2018, 02:28:06 pm by Meridian »

Offline Hobbes

  • Commander
  • *****
  • Posts: 3502
  • Infiltration subroutine in progress
    • View Profile
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #17 on: October 30, 2018, 01:58:39 am »
Done.
You can now define different destroyed facility for each facility:

Code: [Select]
facilities:
  - type: STR_HANGAR
    destroyedFacility: STR_HANGAR_DAMAGED    # must be of same size as the original facility

If not defined, the global rubble facility setting still applies.

I'm happy because of the possibilities, I'm crying because I'll have to design damaged and rubble versions of 50+ maps :D

Offline Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 6320
  • Aaand we're back!
    • View Profile
    • My Wiki
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #18 on: October 30, 2018, 01:00:29 pm »
Two more updates:

1. damaged facilities logic now applies to battlescape (base defense) missions too

Especially relevant with this setting: https://openxcom.org/forum/index.php/topic,6663.0.html

2. changed the order of construction/destruction

First a damaged facility is constructed and added to the base and only after that the original facility is destroyed... this means that whatever can be saved will be saved, e.g. craft in the hangar, transfers/hires/purchases of items/craft/scientists/engineers, ongoing manufacturing projects, etc. considering limits enforced by the damaged facilities of course

Offline Hobbes

  • Commander
  • *****
  • Posts: 3502
  • Infiltration subroutine in progress
    • View Profile
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #19 on: October 30, 2018, 04:21:43 pm »
2. changed the order of construction/destruction

First a damaged facility is constructed and added to the base and only after that the original facility is destroyed... this means that whatever can be saved will be saved, e.g. craft in the hangar, transfers/hires/purchases of items/craft/scientists/engineers, ongoing manufacturing projects, etc. considering limits enforced by the damaged facilities of course

So previously when a facility was damaged, all its content was destroyed automatically. Now, when a facility is damaged some of its content can still be saved, depending on the damaged facility that replaces it?

One question: this only applies if the Storage Limits For Recovered Items option is activated?

Offline Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 6320
  • Aaand we're back!
    • View Profile
    • My Wiki
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #20 on: October 30, 2018, 05:02:14 pm »
So previously when a facility was damaged, all its content was destroyed automatically. Now, when a facility is damaged some of its content can still be saved, depending on the damaged facility that replaces it?

Best would probably be an example.

Let's say you have 2 workshops (50 space each, together 100) and 40 engineers working on 2 projects each taking 30 space and half of the engineers.

1. If one workshop is destroyed... OpenXcom needs to deallocate 50 workshop space... it will first deallocate all 40 engineers, but because it is not enough (10 space missing), it will cancel also one project (and keep the second project).

2a. If one workshop is damaged and replaced by a "damaged workshop" with just 25 capacity... before the change I did, first the workshop would be destroyed (same as in point 1), 40 engineers will be deallocated and 1 project cancelled... and after that a new workshop will be built without any impact

2b. If one workshop is damaged and replaced by a "damaged workshop" with just 25 capacity... after the change I did, first a new workshop would be added, so the game would have 25 workshop space more (total 125)... and then the original workshop would be destroyed (space decreased to 75), but instead of -40 engineers and -1 project... the game would only need to do -25 engineers and -0 projects.

Other facilities have similar algorithms... long story.

One question: this only applies if the Storage Limits For Recovered Items option is activated?

No, this setting doesn't have any impact here.
« Last Edit: October 30, 2018, 05:04:53 pm by Meridian »

Offline Hobbes

  • Commander
  • *****
  • Posts: 3502
  • Infiltration subroutine in progress
    • View Profile
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #21 on: October 30, 2018, 05:51:03 pm »
Best would probably be an example.

Let's say you have 2 workshops (50 space each, together 100) and 40 engineers working on 2 projects each taking 30 space and half of the engineers.

1. If one workshop is destroyed... OpenXcom needs to deallocate 50 workshop space... it will first deallocate all 40 engineers, but because it is not enough (10 space missing), it will cancel also one project (and keep the second project).

2a. If one workshop is damaged and replaced by a "damaged workshop" with just 25 capacity... before the change I did, first the workshop would be destroyed (same as in point 1), 40 engineers will be deallocated and 1 project cancelled... and after that a new workshop will be built without any impact

2b. If one workshop is damaged and replaced by a "damaged workshop" with just 25 capacity... after the change I did, first a new workshop would be added, so the game would have 25 workshop space more (total 125)... and then the original workshop would be destroyed (space decreased to 75), but instead of -40 engineers and -1 project... the game would only need to do -25 engineers and -0 projects.

Other facilities have similar algorithms... long story.

OK, that's clear regarding projects. But I still a doubt about items/personnel/craft. Let's say a Hangar is occupied by 2 craft, it is hit and damaged reducing it's capacity to 1. What happens to the excess craft? It is destroyed or can it be transferred to a base with spare capacity? My question also applies to personnel/items when living quarters/stores are hit.

Offline Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 6320
  • Aaand we're back!
    • View Profile
    • My Wiki
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #22 on: October 30, 2018, 06:09:25 pm »
OK, that's clear regarding projects. But I still a doubt about items/personnel/craft. Let's say a Hangar is occupied by 2 craft, it is hit and damaged reducing it's capacity to 1. What happens to the excess craft? It is destroyed or can it be transferred to a base with spare capacity? My question also applies to personnel/items when living quarters/stores are hit.

Only one craft can occupy a hangar.
If the hangar "allows" more than one craft, additional craft are stored in the base, NOT in any particular hangar.
So if the capacity is reduced to 1, the single craft that occupied the hangar before will be saved... and other craft will also be saved, or better said not affected, because they are not in any hangar.

As for other things:

1/ Destroying hangar:

a/ If it has a "main" craft:
- deassigns any soldiers assigned to the main craft
- deequips all items assigned to the main craft (not counting craft weapons I think)
- destroys the main craft (and its weapons I think)

b/ If it doesn't have a main craft:
- destroys craft production for this hangar... potentially for the base too (until base limit is reached), if you allow craft that are not in a hangar
- destroys craft transfers for this hangar... potentially for the base too (until base limit is reached), if you allow craft that are not in a hangar

2/ Destroying psi lab:
- just removes people from training

3/ Destroying labs:
- just removes scientists from projects... does NOT cancel projects

4/ Destroying workshops:
- removes engineers from projects
- cancels projects if necessary too

5/ Destroying stores:
- does NOT destroy items in the base...
- ... but, destroys excess transfers/purchases for this base

6/ Destroying living quarters:
- does NOT kill people at the base...
- ... but, KILLS scientists/engineers in transfer/hired... does NOT kill soldiers in transfer/hired

If a facility has more than one of these attributes... all effects are applied simultaneously in OXCE.
In OpenXcom, only the first relevant effect (in the above order) would be applied (which is a bug IMO, that's why we changed it).


PS:
7/ Destroying training facility (gym)... doesn't do anything yet... I could swear I added it some time ago... but I can't find it... I'll add it too... and it will just remove people from training same as psi labs
« Last Edit: October 30, 2018, 06:28:36 pm by Meridian »

Offline Hobbes

  • Commander
  • *****
  • Posts: 3502
  • Infiltration subroutine in progress
    • View Profile
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #23 on: October 30, 2018, 06:31:35 pm »
Very clear, thank you very much for the detailed explanation - this is info that players will need.

Offline animal310

  • Captain
  • ***
  • Posts: 53
    • View Profile
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #24 on: June 23, 2019, 01:40:11 pm »
I'm a little confused as to how this works.

Does any ship in an Alien Retaliation Mission with the MissilePower command line have the ability to attack a base as opposed to just the last ship in the mission (the battleship)? How does this work? Does it fly around looking for a base and then attack if it detects it?

When base defences are activated do they attack the attacking ship or the 'missile'? For example if a medium scout attacks will the base defences be up again the Medium Scouts armour level?

Looks like a great feature!

Edit, I'm thinking I might be wrong, would this work?

Code: [Select]
alienMissions:
  - type: STR_ALIEN_RETALIATION_1
    points: 0
    objective: 4
    spawnUfo: STR_MEDIUM_SCOUT # Spawned for the final retaliation run
    operationType: 0
    raceWeights: # In the case of a shootdown, race comes from the UFO that triggered the mission.
      0:
        STR_SECTOID: 20
        STR_SNAKEMAN: 20
        STR_ETHEREAL: 20
        STR_MUTON: 20
        STR_FLOATER: 20
    waves:
      - ufo: STR_SMALL_SCOUT
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_MEDIUM_SCOUT
        count: 2
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 1
        radarRange: 1018
      - ufo: STR_LARGE_SCOUT
        count: 3
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 2
        radarRange: 1018
      - ufo: STR_MEDIUM_SCOUT
        count: 2
        trajectory: P0
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 1
        radarRange: 1018
  - type: STR_ALIEN_ RETALIATION_2
    points: 0
    objective: 4
    spawnUfo: STR_LARGE_SCOUT # Spawned for the final retaliation run
    operationType: 0
    raceWeights: # In the case of a shootdown, race comes from the UFO that triggered the mission.
      0:
        STR_SECTOID: 20
        STR_SNAKEMAN: 20
        STR_ETHEREAL: 20
        STR_MUTON: 20
        STR_FLOATER: 20
    waves:
      - ufo: STR_SMALL_SCOUT
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_FIGHTER_SHIP
        count: 2
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        radarRange: 1344
      - ufo: STR_SENTRY_SHIP
        count: 3
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 3
        radarRange: 1018
      - ufo: STR_LARGE_SCOUT
        count: 2
        trajectory: P0
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 2
        radarRange: 1018
  - type: STR_ALIEN_ RETALIATION_3
    points: 0
    objective: 4
    spawnUfo: STR_SENTRY_SHIP # Spawned for the final retaliation run
    operationType: 0
    raceWeights: # In the case of a shootdown, race comes from the UFO that triggered the mission.
      0:
        STR_SECTOID: 20
        STR_SNAKEMAN: 20
        STR_ETHEREAL: 20
        STR_MUTON: 20
        STR_FLOATER: 20
    waves:
      - ufo: STR_SMALL_SCOUT
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_MEDIUM_SCOUT
        count: 2
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 1
        radarRange: 1018
      - ufo: STR_LARGE_SCOUT
        count: 3
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 2
        radarRange: 1018
      - ufo: STR_SENTRY_SHIP
        count: 2
        trajectory: P0
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 3
        radarRange: 1018
  - type: STR_ALIEN_ RETALIATION_4
    points: 0
    objective: 4
    spawnUfo: STR_TERROR_SHIP  # Spawned for the final retaliation run
    operationType: 0
    raceWeights: # In the case of a shootdown, race comes from the UFO that triggered the mission.
      0:
        STR_SECTOID: 20
        STR_SNAKEMAN: 20
        STR_ETHEREAL: 20
        STR_MUTON: 20
        STR_FLOATER: 20
    waves:
      - ufo: STR_SMALL_SCOUT
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_FIGHTER_SHIP
        count: 2
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        radarRange: 1344
      - ufo: STR_SENTRY_SHIP
        count: 3
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 3
        radarRange: 1018
      - ufo: STR_TERROR_SHIP
        count: 2
        trajectory: P0
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 5
        radarRange: 1344
  - type: STR_ALIEN_RETALIATION_HK
    points: 0
    objective: 4
    spawnUfo: STR_BATTLESHIP # Spawned for the final retaliation run
    operationType: 0
    raceWeights: # In the case of a shootdown, race comes from the UFO that triggered the mission.
      0:
        STR_SECTOID: 20
        STR_SNAKEMAN: 20
        STR_ETHEREAL: 20
        STR_MUTON: 20
        STR_FLOATER: 20
    waves:
      - ufo: STR_SMALL_SCOUT
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_MEDIUM_SCOUT
        count: 2
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 1
        radarRange: 1018
      - ufo: STR_LARGE_SCOUT
        count: 3
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 2
        radarRange: 1018
      - ufo: STR_BATTLESHIP
        count: 2
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        radarRange: 1344
  - type: STR_ALIEN_RETALIATION
    objective: 4
    spawnUfo: STR_BATTLESHIP #Spawned for the final retaliation run
    operationType: 0
    raceWeights: # In the case of a shootdown, race comes from the UFO that triggered the mission.
      0:
        STR_SECTOID: 20
        STR_SNAKEMAN: 20
        STR_ETHEREAL: 20
        STR_MUTON: 20
        STR_FLOATER: 20
    waves:
      - ufo: STR_SMALL_SCOUT
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_FIGHTER_SHIP
        count: 2
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        radarRange: 1344
      - ufo: STR_SENTRY_SHIP
        count: 3
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        huntBehavior: 1
        missilePower: 3
        radarRange: 1018
      - ufo: STR_BATTLESHIP
        count: 2
        trajectory: P8
        timer: 3000
        hunterKillerPercentage: 50
        huntMode: 2
        huntSpeed: 100
        radarRange: 1344
  - missionWeights:
      0:
        STR_ALIEN_RETALIATION_1: 50
        STR_ALIEN_RETALIATION: 25
        STR_ALIEN_RETALIATION_HK: 25
      1:
        STR_ALIEN_RETALIATION_1: 25
        STR_ALIEN_RETALIATION_2: 25
        STR_ALIEN_RETALIATION: 25
        STR_ALIEN_RETALIATION_HK: 25
      3:
        STR_ALIEN_RETALIATION_1: 10
        STR_ALIEN_RETALIATION_2: 30
        STR_ALIEN_RETALIATION_3: 10

        STR_ALIEN_RETALIATION: 25
        STR_ALIEN_RETALIATION_HK: 25
      6:
        STR_ALIEN_RETALIATION_1: 10
        STR_ALIEN_RETALIATION_2: 10
        STR_ALIEN_RETALIATION_3: 20
        STR_ALIEN_RETALIATION_4: 10
        STR_ALIEN_RETALIATION: 25
        STR_ALIEN_RETALIATION_HK: 25
      9:
        STR_ALIEN_RETALIATION_2: 10
        STR_ALIEN_RETALIATION_3: 10
        STR_ALIEN_RETALIATION_4: 30
        STR_ALIEN_RETALIATION: 25
        STR_ALIEN_RETALIATION_HK: 25

« Last Edit: June 23, 2019, 04:40:57 pm by animal310 »

Offline Hobbes

  • Commander
  • *****
  • Posts: 3502
  • Infiltration subroutine in progress
    • View Profile
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #25 on: June 27, 2019, 03:52:19 pm »
Does any ship in an Alien Retaliation Mission with the MissilePower command line have the ability to attack a base as opposed to just the last ship in the mission (the battleship)? How does this work? Does it fly around looking for a base and then attack if it detects it?


No, only the UFO spawned for the retaliation run performs the missile attack. The base needs to be detected by the previous UFOs.

Quote
When base defences are activated do they attack the attacking ship or the 'missile'? For example if a medium scout attacks will the base defences be up again the Medium Scouts armour level?

There's no actual missile, it's the UFO that performs the attack, so yes if a Medium Scout was attacking, the base defenses would be up against it.


Offline animal310

  • Captain
  • ***
  • Posts: 53
    • View Profile
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #26 on: June 29, 2019, 02:54:06 pm »
Thanks Hobbes

Another great feature, finally missile defences have a use!!


Offline animal310

  • Captain
  • ***
  • Posts: 53
    • View Profile
Re: [DONE] [Suggestion] Alien missile strikes
« Reply #27 on: July 17, 2019, 02:51:42 pm »
Earlier in the thread there was mention of the ‘corridor mod’ to replace damaged sections of the base. Does anyone have this mod (or a STR_RUBBLE one) or know where I can find them?