Author Topic: [DONE] Spawning missions at base coords  (Read 6011 times)

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
[DONE] Spawning missions at base coords
« on: March 20, 2020, 03:51:49 pm »
I have a request: an option to spawn a mission (not UFO) right at the coordinates of X-Com base. This would be the same as normal spawning at a fixed point, except instead of given coordinates it would choose one of your bases (at random, if there's more than one).

Justification (in the context of Piratez as a good example):
- It would allow to remove "comm waves", which are a not-so-elegant hack.
- It would allow special missions taking place directly at your base, for example "attack of creatures from the sewers".
- It would allow creation of some missions which would logically take place around the base.

Optional considerations:
Terrain used would be governed by alienDeployments, same as with normal missions, but also including your base.
Also, it would be nice to have an option to tie the terrain to the global texture instead of specifying it directly, because (for missions not actually happening inside your base, but outside) the game doesn't know where the player will put their bases.
« Last Edit: October 12, 2022, 09:02:28 pm by Meridian »

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: Spawning missions at base coords
« Reply #1 on: May 11, 2020, 04:14:19 pm »
This could be useful.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: Spawning missions at base coords
« Reply #2 on: May 11, 2020, 04:17:08 pm »
what is the purpose of "comm waves" today?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Spawning missions at base coords
« Reply #3 on: May 11, 2020, 04:26:36 pm »
Comm waves are a hack to spawn a base assault which cannot be prevented: it's a UFO which moves at light speed and therefore cannot be shot down. Basically it simulates a base assault which is not made by dropping the invading force from air, but in some other way: they come by land, or from the underground, or teleport in, whatever.

My request is partially a way to do it more cleanly, but this is not the most important part, more like an additional boon. The most important thing is to be able to create base assaults without UFOs and without X-Com base detection. It would also allow to make other missions which do not take place on the X-Com base, but still should be in the same place on the globe, like for example exploring the caves beneath your base in Piratez.

Offline Finnik

  • Colonel
  • ****
  • Posts: 490
  • Finnik#0257
    • View Profile
Re: Spawning missions at base coords
« Reply #4 on: May 11, 2020, 04:49:07 pm »
Maybe we can have syntax like that to solve the problem:
Code: [Select]
alienMissions:
  - type: STR_ALIEN_RETALIATION
    points: 0
    objective: 4
    spawnUfo: STR_BATTLESHIP # Vanilla - Spawned for the final retaliation run
    baseDefenseCustomDeployment: STR_BATTLESHIP #case we still want base defense without any ufo
    customMissionDeploument: STR_CULT_SAFEHOUSE #custom deployment, that would be spawned on top of the base
so before we to spawn a ufo with
Code: [Select]
const RuleUfo &battleshipRule = *mod.getUfo(_rule.getSpawnUfo(), true);
const UfoTrajectory &assaultTrajectory = *mod.getUfoTrajectory(UfoTrajectory::RETALIATION_ASSAULT_RUN, true);
Ufo *ufo = new Ufo(&battleshipRule, game.getId("STR_UFO_UNIQUE"));
ufo->setMissionInfo(this, &assaultTrajectory);
we can choose to spawn base defence with deployment `data:` loaded from `baseDefenseCustomDeployment:` or even just spawn a mission site within region's xcom base coordinates using `customMissionDeploument:`. I think we can process each rules suquencially using something like if(!ruleProperty.empty()), or pick only one with priorities customMissionDeploument -> baseDefenseCustomDeployment -> spawnUfo.

Also, I looked at how to tweak base defense deployment to make special one and end up to use the dirty hack, that is working more or less ok for FTA, but to make a general solution to use other properties other than `data` for baseDefenseCustomDeployment case it looks to me we should do a big job with battlsescape generation.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: Spawning missions at base coords
« Reply #5 on: May 11, 2020, 05:20:16 pm »
Comm waves are a hack to spawn a base assault which cannot be prevented: it's a UFO which moves at light speed and therefore cannot be shot down. Basically it simulates a base assault which is not made by dropping the invading force from air, but in some other way: they come by land, or from the underground, or teleport in, whatever.

My request is partially a way to do it more cleanly, but this is not the most important part, more like an additional boon.

ok, I will ignore this part for now

1) The most important thing is to be able to create base assaults without UFOs and without X-Com base detection.

2) It would also allow to make other missions which do not take place on the X-Com base, but still should be in the same place on the globe, like for example exploring the caves beneath your base in Piratez.

But 1) and 2) are two completely different things... I don't see how they relate at all... or how could they be done by just a single feature?

Can you elaborate why you talk about them as one feature?
How would implementing 1) also implement 2) ?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Spawning missions at base coords
« Reply #6 on: May 11, 2020, 05:54:07 pm »
The only difference as I see it is that one uses the X-Com base layout, and the other uses a terrain declared by the modder.

No idea if it makes sense from the coding perspective, but in my view it's the only functional difference.

Offline krautbernd

  • Commander
  • *****
  • Posts: 1116
    • View Profile
Re: Spawning missions at base coords
« Reply #7 on: May 11, 2020, 06:38:34 pm »
I'm not sure if I understand this correctly, but to me these sound like two distinct features:

1)Directly Trigger base assault without UFOs

2)Create mission sites at player base location

The difference - as far as  I can tell - is that mission sites can't trigger base assaults and by extension can't destroy player bases. Taking a stab in the dark here, but if I follow your train of thought (missions "at" the player base) aren't you also asking for a third feature - triggering base assaults (on the closest player base) on mission failure?

If the player is supposed to fight off a invasion via the base sewers, what happens when he fails/abandons the mission? Shouldn't this trigger a "real" base assault?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: Spawning missions at base coords
« Reply #8 on: May 11, 2020, 06:44:21 pm »
ok, so maybe let's start from the beginning

I have a request: an option to spawn a mission (not UFO) right at the coordinates of X-Com base. This would be the same as normal spawning at a fixed point, except instead of given coordinates it would choose one of your bases (at random, if there's more than one).

Doable.

Optional considerations:
Terrain used would be governed by alienDeployments, same as with normal missions, but also including your base.

I don't get this... what does "including your base" mean?

Should it be a base defense mission (with a real base map) or not? Does the battlescape map correspond to a real base... or is it something fake/random?

Also, it would be nice to have an option to tie the terrain to the global texture instead of specifying it directly, because (for missions not actually happening inside your base, but outside) the game doesn't know where the player will put their bases.

What do I need to do here?
Isn't this already possible with the 'globeTerrain' mapscript constant? https://openxcom.org/forum/index.php/topic,7536.0.html

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Spawning missions at base coords
« Reply #9 on: May 14, 2020, 11:30:41 am »
Doable.

Bueno!

I don't get this... what does "including your base" mean?

Should it be a base defense mission (with a real base map) or not?

Yes!

Does the battlescape map correspond to a real base...

Yes!

or is it something fake/random?

Not sure what you mean exactly, but what I want is two separate options:

1) Real base map, exactly like on a normal base defence. (For base defence not triggered by a UFO.)
2) Some other terrain, defined in the alienDeployments. (For missions which should logically happen around your base, like exploring the surroundings, but not in the actual base.)

(So yes, Krautbernd is correct.)

What do I need to do here?
Isn't this already possible with the 'globeTerrain' mapscript constant? https://openxcom.org/forum/index.php/topic,7536.0.html
Perhaps, frankly I am not familiar with this option. I'll investigate.

If the player is supposed to fight off a invasion via the base sewers, what happens when he fails/abandons the mission? Shouldn't this trigger a "real" base assault?

I haven't planned anything this involved, a base defence is a base defence, doesn't matter from where.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: Spawning missions at base coords
« Reply #10 on: May 14, 2020, 11:42:26 am »
1) Real base map, exactly like on a normal base defence. (For base defence not triggered by a UFO.)
2) Some other terrain, defined in the alienDeployments. (For missions which should logically happen around your base, like exploring the surroundings, but not in the actual base.)

OK.

Just that option 1) is directly in conflict with the name of this thread "Spawning missions at base coords"... as no mission site will be spawned at all.
That was the confusion.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Spawning missions at base coords
« Reply #11 on: May 14, 2020, 12:33:40 pm »
OK.

Just that option 1) is directly in conflict with the name of this thread "Spawning missions at base coords"... as no mission site will be spawned at all.
That was the confusion.

All right, sorry for the confusion. Not sure if a base defence counts as a "mission" or not :)

Offline krautbernd

  • Commander
  • *****
  • Posts: 1116
    • View Profile
Re: Spawning missions at base coords
« Reply #12 on: May 14, 2020, 12:52:03 pm »
I haven't planned anything this involved, a base defence is a base defence, doesn't matter from where.
Sorry for being pedantic, but it's not a base defence if failing the mission doen't result in the player losing the base - that's why I was trying to ascertain what it is you're asking for.

One of your examples was "player base is attacked via the sewers", so you want a mission site spawned at the base coordinates that takes place in an underground/sewer map. But how would this be different from a "standard" sewer mission site? What is the incentive here if the player can simply ignore the site alltogether because it's not an actual threat to the base? I'm just trying to follow your train of thought to it's logical conclusion - which is either missions progressing into an "actual" base defence or substituting custom maps for base defence maps.

Maybe I'm misunderstanding your example and/or original intent, sorry if that should be the case.

« Last Edit: May 14, 2020, 12:55:40 pm by krautbernd »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Spawning missions at base coords
« Reply #13 on: May 14, 2020, 12:55:42 pm »
Sorry for being pedantic, but it's not a base defence if failing the mission doen't result in the player losing the base - that's why I was trying to ascertain what it is you're asking for.

Yes, it would work the same as any other base defence.

One of your examples was "player base is attacked via the sewers", so you want a mission site spawned at the base coordinates that takes place in an underground/sewer map. But how would this be diffrent from a "standard" sewer mission site? What is the incentive here if the player can simply ignore the site alltogether because it's not an actual threat to the base? I'm just trying to follow your train of thought to it's logical conclusion - which is either missions progressing into an "actual" base defence or substituting custom maps for base defence maps.

No, the hypothetical attack from the sewers would still be a normal base defence, with normal consequences.

That exploration you mentioned would be a different thing, taking place in a different terrain.

Offline krautbernd

  • Commander
  • *****
  • Posts: 1116
    • View Profile
Re: Spawning missions at base coords
« Reply #14 on: May 14, 2020, 01:24:14 pm »
Ah, okay. Sorry for the misunderstanding.

How exactely would these base defence mission be triggered and could they be defended against/avoided? Taking for example a small radar/interceptor base with a limited number of soldiers, would the player have any warning that an attack on the base would be forthcoming?

Also @Meridian, how would this interact with base defenses (if at all), or would these bypass base defense facilities alltogether?