aliens

Author Topic: [DONE][Suggestion] More retaliation variants  (Read 3698 times)

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 125
  • Sorry for my bEd English
    • View Profile
[DONE][Suggestion] More retaliation variants
« on: August 08, 2023, 07:40:18 pm »
A few suggestions for further development of this functionality:
1. Now the attacking UFO appears instantly and immediately on the player's base. I would like to be able to customize the trajectory of the UFO so that it flies to the player's base as it does the last UFO in the original retaliation mission (generated in "spawnUfo"): from a random point in a straight line to the player's base. This way, the player may have the possibility to intercept such a UFO before attacking the base.
For example, the "spawnOnPlayerBase" parameter: when it is in the "true" state, the UFO will be generated instantly at the player's base (as it works now). When it in "false" state, the UFO is generated away from the base and flies to the player's base.
Code: [Select]
alienMissions:
  - type: STR_ALIEN_RETALIATION_INSTANT
    points: 0
    objective: 6                # the new objective type
#    ignoreBaseDefenses: true
    spawnUfo: STR_BATTLESHIP    # this is the UFO that will be spawned
    spawnOnPlayerBase: false    # true by default
    waves:
      - ufo: STR_BATTLESHIP     # just put something here, doesn't matter
        count: 1
        trajectory: P8
        timer: 3000
    raceWeights:
      0:
        STR_SECTOID: 20
        STR_FLOATER: 20

2. I would like to specify the number of UFOs attacking the player's base, not just one.
For example, their number should be specified in the new parameter "spawnUfoCount", and the interval of their generation would be set in the parameter "spawnUfoTimer". This is true for both the regular retaliation mission and this new instant retaliation mission.
Code: [Select]
alienMissions:
  - type: STR_ALIEN_RETALIATION_INSTANT
    points: 0
    objective: 6                # the new objective type
#    ignoreBaseDefenses: true
    spawnUfo: STR_BATTLESHIP    # this is the UFO that will be spawned
    spawnUfoCount: 2            # 1 by default
    spawnUfoTimer: 320          # 0 by default. How long after the previous UFO should this UFO arrive? (in minutes)
    waves:
      - ufo: STR_BATTLESHIP     # just put something here, doesn't matter
        count: 1
        trajectory: P8
        timer: 3000
    raceWeights:
      0:
        STR_SECTOID: 20
        STR_FLOATER: 20

3. How about adding retaliation UFO generation to the "waves" section (in addition to "spawnUfo")?
For example, a wave that should generate UFOs to attack the player base could be labeled with "isRetaliationWave: true". UFOs from such a wave would not be generated if previous "normal" waves have not found the player's base. The "trajectory" parameter in this wave is ignored: UFOs fly in a straight trajectory to attack the base. This opens up the possibility to make several waves to attack the player's base, between which there can be normal waves searching for the player's base.
Code: [Select]
alienMissions:
  - type: STR_ALIEN_RETALIATION
    points: 0
    objective: 4
    spawnUfo: STR_BATTLESHIP
    waves:
      - ufo: STR_BATTLESHIP
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_BATTLESHIP
        count: 2
        isRetaliationWave: true        # false by default
        trajectory: P8
        timer: 3000
      - ufo: STR_BATTLESHIP
        count: 3
        trajectory: P8
        timer: 3000
    raceWeights:
      0:
        STR_SECTOID: 20
        STR_FLOATER: 20
« Last Edit: August 08, 2023, 07:42:57 pm by Kozinsky »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11670
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Suggestion] More retaliation variants
« Reply #1 on: December 31, 2023, 12:43:38 pm »
I would like to understand the problem a bit more.
- What is the intended purpose of these features? I don't understand how the proposed solution differs from a normal retaliation (the description seems to describe the standard retal, too).
- What is "objective: 6" specifically for, if it's still X-Com base assault?
- Multiple UFOs: it's already possible, no? Ninjas in Piratez do that (the "ninja train" assault). Is it only about a new way to do this?
- What if UFOs with isRetaliationWave are mixed up with others? Is the mission interrupted if such a UFO is destroyed? If yes, what's the point of this feature? If no, what would be the intended purpose?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [Suggestion] More retaliation variants
« Reply #2 on: January 01, 2024, 10:42:40 am »
1. Now the attacking UFO appears instantly and immediately on the player's base. I would like to be able to customize the trajectory of the UFO so that it flies to the player's base as it does the last UFO in the original retaliation mission (generated in "spawnUfo"): from a random point in a straight line to the player's base. This way, the player may have the possibility to intercept such a UFO before attacking the base.
For example, the "spawnOnPlayerBase" parameter: when it is in the "true" state, the UFO will be generated instantly at the player's base (as it works now). When it in "false" state, the UFO is generated away from the base and flies to the player's base.

So, it's a normal retaliation mission without the "UFO scouting phase"?

If so, I can add a parameter to skip that phase for standard retaliation, that's much easier to do than changing the instant retaliation code.

2. I would like to specify the number of UFOs attacking the player's base, not just one.
For example, their number should be specified in the new parameter "spawnUfoCount", and the interval of their generation would be set in the parameter "spawnUfoTimer". This is true for both the regular retaliation mission and this new instant retaliation mission.

You can already specify multiple UFOs spawning in each wave and even say that the UFOs should not be automagically destroyed after the first base defense.

(But they must spawn either at the same time, or at least before the first base defense mission starts... if that's not enough I can add a parameter to keep spawning everything until the alien mission ends with last wave).

Try this in vanilla:

Code: [Select]
alienMissions:
  - type: STR_ALIEN_RETALIATION
    multiUfoRetaliation: true
    points: 0
    objective: 4
    spawnUfo: STR_BATTLESHIP # Spawned for the final retaliation run
    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_SMALL_SCOUT
        count: 2
        trajectory: P8
        timer: 0
      - ufo: STR_MEDIUM_SCOUT
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_MEDIUM_SCOUT
        count: 2
        trajectory: P8
        timer: 0
      - ufo: STR_LARGE_SCOUT
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_LARGE_SCOUT
        count: 2
        trajectory: P8
        timer: 0
      - ufo: STR_TERROR_SHIP
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_TERROR_SHIP
        count: 2
        trajectory: P8
        timer: 0

It spawns 3 small scouts, then 3 medium scouts, then 3 large scouts and at the end 3 terror ships.

When the base is found, the next wave will be replaced by 3 spawnUFOs (battleships); and because of `multiUfoRetaliation: true` all three will attack (or better said the 2nd and 3rd will not be automagically destroyed after the first base defense).

3. How about adding retaliation UFO generation to the "waves" section (in addition to "spawnUfo")?
For example, a wave that should generate UFOs to attack the player base could be labeled with "isRetaliationWave: true". UFOs from such a wave would not be generated if previous "normal" waves have not found the player's base. The "trajectory" parameter in this wave is ignored: UFOs fly in a straight trajectory to attack the base. This opens up the possibility to make several waves to attack the player's base, between which there can be normal waves searching for the player's base.

In standard retaliation, all waves are retaliation waves.

I can add a parameter to NOT replace the current UFO (from the wave definition) with spawnUFO if that helps...
« Last Edit: January 01, 2024, 03:01:58 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE][Suggestion] More retaliation variants
« Reply #3 on: January 01, 2024, 03:00:30 pm »

1/ If so, I can add a parameter to skip that phase for standard retaliation, that's much easier to do than changing the instant retaliation code.

2/ You can already specify multiple UFOs spawning in each wave and even say that the UFOs should not be automagically destroyed after the first base defense. But they must spawn either at the same time, or at least before the first base defense mission starts... if that's not enough I can add a parameter to keep spawning everything until the alien mission ends with last wave.

3/ I can add a parameter to NOT replace the current UFO (from the wave definition) with spawnUFO if that helps...

1/ https://github.com/MeridianOXC/OpenXcom/commit/032ebd1758b3a186556596d425d2c01efc092060

`skipScoutingPhase: true`
(works only for normal retaliation, not for instant retaliation)

3/ https://github.com/MeridianOXC/OpenXcom/commit/8eb046d467be91e2493a96146d094fa8aa7ddab5

`spawnUfo: ""`
(theoretically works for both retaliations, but instant retaliation anyway can spawn only one UFO, so it doesn't matter)

2/ https://github.com/MeridianOXC/OpenXcom/commit/e63179fa7e79885590c297ca4c4c7b5841a7a8c9

`multiUfoRetaliationExtra: true`
(theoretically works for both retaliations, but instant retaliation anyway can spawn only one UFO, so it doesn't matter)

Here's an example combining all 3:

Code: [Select]
alienMissions:
  - type: STR_ALIEN_RETALIATION
    skipScoutingPhase: true # mark all xcom bases in the mission region as retaliation targets automatically at the mission start (and also before each UFO is spawned, if the modder decides to spawn more UFOs)
    spawnUfo: "" # STR_BATTLESHIP # Spawned for the final retaliation run; if empty, use wave UFO
    multiUfoRetaliation: true # Keep generating UFOs until the first base defense
    multiUfoRetaliationExtra: true # Keep generating UFOs until the end of the alien mission

Code: [Select]
    waves:
      - ufo: STR_MEDIUM_SCOUT
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_MEDIUM_SCOUT
        count: 2
        trajectory: P8
        timer: 0
      - ufo: STR_LARGE_SCOUT
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_LARGE_SCOUT
        count: 2
        trajectory: P8
        timer: 0
      - ufo: STR_TERROR_SHIP
        count: 1
        trajectory: P8
        timer: 3000
      - ufo: STR_TERROR_SHIP
        count: 2
        trajectory: P8
        timer: 0

And attached is a video of how this example looks in game.
« Last Edit: January 01, 2024, 03:13:12 pm by Meridian »

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 125
  • Sorry for my bEd English
    • View Profile
Re: [Suggestion] More retaliation variants
« Reply #4 on: January 02, 2024, 04:30:51 pm »
I would like to understand the problem a bit more.
- What is the intended purpose of these features? I don't understand how the proposed solution differs from a normal retaliation (the description seems to describe the standard retal, too).
- What is "objective: 6" specifically for, if it's still X-Com base assault?
- Multiple UFOs: it's already possible, no? Ninjas in Piratez do that (the "ninja train" assault). Is it only about a new way to do this?
- What if UFOs with isRetaliationWave are mixed up with others? Is the mission interrupted if such a UFO is destroyed? If yes, what's the point of this feature? If no, what would be the intended purpose?

When I created this suggestion I thought that the player's base is always attacked by only one UFO specified in "spawnUfo". I thought that if the very first scout in the first wave finds the player base, then all the following scouting waves are canceled and a retaliatory UFO is generated to attack the found player base. Thanks to your questions and Meridian's explanation I realized that I was wrong))
So point 2 and 3 of my suggestion make no sense and should be ignored. As for the first point, Meridian suggested an adequate alternative via the "skipScoutingPhase: true" parameter.

"objective: 6" is a recently introduced new option for an "immediate" attack on the player's base, where a mission to defend the base is generated immediately, rather than a UFO flying to attack the base:
https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Alien_Missions


1/ skipScoutingPhase: true
3/ spawnUfo: ""
2/ multiUfoRetaliationExtra: true

Thank you very much! This is pretty much what I needed. Thanks to my new knowledge in this field I will be able to realize everything I wanted with these tools.

While testing the new features, I ran into a strange problem. For testing I use version OXCE 7.10.3, only X-Com Files mod and my test mod with this alien mission are used:
Code: [Select]
missionScripts:
  - type: testRocket
    targetBaseOdds: 100
    startDelay: 120
    missionWeights:
      0:
        STR_TEST_ROCKET: 100
alienMissions:
  - type: STR_TEST_ROCKET
    skipScoutingPhase: true
    points: 0
    retaliationOdds: 0
    objective: 4
    spawnUfo: "" #STR_SMALL_ROCKET
    multiUfoRetaliation: true
    multiUfoRetaliationExtra: true
    raceWeights:
      0:
          STR_SECTOID: 100
    waves:
      - ufo: STR_SMALL_SCOUT
        count: 1
        trajectory: P8
        timer: 10
        interruptPercentage: 5
When generating a ground battle on base defense according to the settings of this mission, for some reason the number of attacking sectoids is about 50, also cyberdiscs are present. However, for a small scout such a crew is clearly excessive. The same crew composition and when selecting any other vanilla UFO. I can't understand what the problem is?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [Suggestion] More retaliation variants
« Reply #5 on: January 02, 2024, 04:55:17 pm »
When generating a ground battle on base defense according to the settings of this mission, for some reason the number of attacking sectoids is about 50, also cyberdiscs are present. However, for a small scout such a crew is clearly excessive. The same crew composition and when selecting any other vanilla UFO. I can't understand what the problem is?

Base defense alien deployment is hard-coded/defaulted to STR_BASE_DEFENSE.

If you want to override it for your UFO, you can use this:

Code: [Select]
ufos:
  - type: STR_SMALL_SCOUT
    missionCustomDeploy: STR_MEDIUM_SCOUT   # mission site / base defense deployment override
« Last Edit: January 02, 2024, 04:57:34 pm by Meridian »

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 125
  • Sorry for my bEd English
    • View Profile
Re: [DONE][Suggestion] More retaliation variants
« Reply #6 on: January 09, 2024, 11:41:38 am »
I am exploring the possibility of using alien missions with the "skipScoutingPhase: true" parameter. When generating such a mission at the beginning of the month, all player bases are marked with "retaliationTarget: true", regardless of whether the alien mission has started or not. I.e. player bases are marked "retaliationTarget: true" even if, for example, this mission has "spawnCountdown: 22355" at the beginning of the month.
I think this is not right. Player bases should become visible to aliens at the moment when such an alien mission starts (i.e. when it has "spawnCountdown: 0" and it generates the first UFO from the first wave).

And also, after repelling an attack of this mission on one of the player's bases (when that base's "retaliationTarget: false" flag is cleared), all other player bases stay marked with "retaliationTarget: true".
« Last Edit: January 09, 2024, 12:03:08 pm by Kozinsky »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE][Suggestion] More retaliation variants
« Reply #7 on: January 09, 2024, 03:02:21 pm »
I am exploring the possibility of using alien missions with the "skipScoutingPhase: true" parameter. When generating such a mission at the beginning of the month, all player bases are marked with "retaliationTarget: true", regardless of whether the alien mission has started or not. I.e. player bases are marked "retaliationTarget: true" even if, for example, this mission has "spawnCountdown: 22355" at the beginning of the month.
I think this is not right. Player bases should become visible to aliens at the moment when such an alien mission starts (i.e. when it has "spawnCountdown: 0" and it generates the first UFO from the first wave).

a/ it doesn't mark all bases, just the bases in the mission region... which in 99.9% of cases is just one base

b/ the bases are literally marked when the mission starts, in the function called AlienMission::start() https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Savegame/AlienMission.cpp#L727

...if you want to mark it later than when the mission starts, for example when UFOs or mission sites are spawned, it can be implemented

And also, after repelling an attack of this mission on one of the player's bases (when that base's "retaliationTarget: false" flag is cleared), all other player bases stay marked with "retaliationTarget: true".

Normally, a player has only one base in a given region, so this will happen very rarely.

But yes, I implemented that intentionally.

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 125
  • Sorry for my bEd English
    • View Profile
Re: [DONE][Suggestion] More retaliation variants
« Reply #8 on: January 09, 2024, 03:29:41 pm »
b/ the bases are literally marked when the mission starts, in the function called AlienMission::start() https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Savegame/AlienMission.cpp#L727

...if you want to mark it later than when the mission starts, for example when UFOs or mission sites are spawned, it can be implemented
Yes, it would be nice and more logical to have the player's base marked "retaliationTarget: true" immediately at the moment of generation of the first UFO attacking that base.
Otherwise, for example, if several retaliation missions are active, among which there are both "standard" and missions with the flag "skipScoutingPhase: true", it can lead, in my opinion, to some unpleasant consequences.

Normally, a player has only one base in a given region, so this will happen very rarely.

But yes, I implemented that intentionally.
Okay, I'm fine with that explanation. I don't see much trouble from this decision so far.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE][Suggestion] More retaliation variants
« Reply #9 on: January 09, 2024, 03:36:38 pm »
Otherwise, for example, if several retaliation missions are active, among which there are both "standard" and missions with the flag "skipScoutingPhase: true", it can lead, in my opinion, to some unpleasant consequences.

This also cannot happen.
Retaliation missions are limited to one per region.

EDIT: I was wrong, that only applies to mission generation from dogfights, not for monthly mission scripts
« Last Edit: January 10, 2024, 10:52:21 am by Meridian »

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 125
  • Sorry for my bEd English
    • View Profile
Re: [DONE][Suggestion] More retaliation variants
« Reply #10 on: January 10, 2024, 11:37:10 am »
EDIT: I was wrong, that only applies to mission generation from dogfights, not for monthly mission scripts
Is this going to be fixed? I mean, will this fix block multiple retaliation missions (generated by the monthly mission scripts) per region per month?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE][Suggestion] More retaliation variants
« Reply #11 on: January 10, 2024, 11:59:02 am »
Is this going to be fixed? I mean, will this fix block multiple retaliation missions (generated by the monthly mission scripts) per region per month?

Preferably not, it's vanilla.

But I'll make the other chnages you asked for above.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE][Suggestion] More retaliation variants
« Reply #12 on: January 10, 2024, 09:27:22 pm »
I've changed the missions with `skipScoutingPhase: true` to not mark xcom bases as retaliation targets at all.

Now the UFOs just go straight for a base without any marking in-between.

https://github.com/MeridianOXC/OpenXcom/commit/cf951c335fb93a58429541a5d311d313a959b624

Offline Finnik

  • Commander
  • *****
  • Posts: 502
  • Finnik#0257
    • View Profile
Re: [DONE][Suggestion] More retaliation variants
« Reply #13 on: February 24, 2024, 02:03:04 pm »
Do we have an option to change briefing description for retaliation mission?

In case not alien vessel attack the base, but, say, subsurface creatures with `instantRetaliation` option?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE][Suggestion] More retaliation variants
« Reply #14 on: February 24, 2024, 03:12:54 pm »
Do we have an option to change briefing description for retaliation mission?

In case not alien vessel attack the base, but, say, subsurface creatures with `instantRetaliation` option?

There is no retaliation mission on battlescape.
All retaliation geoscape missions produce a base defense battlescape mission.