Author Topic: Not spawning the expected units inside the UFO?  (Read 2564 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Not spawning the expected units inside the UFO?
« on: May 27, 2023, 12:15:41 am »
I've been trying to spawn 1 terror unit in each of these four rooms at the top of this ship but for some reason they only spawn randomly on other nodes.
Spoiler:

The node has been set to only spawn their ranks (I think) and I've also tried limiting it to only large flying units.

The results of this is that if I have it set to "Any" soldiers spawn on the node instead and if it is setup to "Large Flying" nothing spawns on the node despite the expected unit being a 2x2 flying unit. (Hallucinoid)


The alienDeployments: is also setup for percentageOutsideUfo: 0 which I thought would force them to spawn inside the ship if possible.

Code: [Select]
alienDeployments:

# [=] Whirligig [=] (Small)
  - type: STR_MFTD_WHIRLIGIG
    data:
      - alienRank: 5
        lowQty: 1
        highQty: 3
        dQty: 5
        percentageOutsideUfo: 0
        itemSets:
          -
            - STR_SONIC_PISTOL
            - STR_PISTOL_POWER_CLIP
            - STR_PISTOL_POWER_CLIP
            - STR_SONIC_PULSER
          -
            - STR_SONIC_BLASTA_RIFLE
            - STR_BLASTA_POWER_CLIP
            - STR_BLASTA_POWER_CLIP
            - STR_SONIC_PULSER
          -
            - STR_SONIC_CANNON
            - STR_CANNON_POWER_CLIP
            - STR_CANNON_POWER_CLIP
            - STR_SONIC_PULSER
      - alienRank: 4
        lowQty: 1
        highQty: 1
        dQty: 1
        percentageOutsideUfo: 25
        itemSets:
          -
            - STR_SONIC_PISTOL
            - STR_PISTOL_POWER_CLIP
            - STR_PISTOL_POWER_CLIP
            - STR_SONIC_PULSER
          -
            - STR_SONIC_CANNON
            - STR_CANNON_POWER_CLIP
            - STR_CANNON_POWER_CLIP
            - STR_SONIC_PULSER
          -
            - STR_SONIC_CANNON
            - STR_CANNON_POWER_CLIP
            - STR_CANNON_POWER_CLIP
            - STR_SONIC_PULSER
            - STR_SONIC_PULSER
      - alienRank: 3
        lowQty: 1
        highQty: 1
        dQty: 1
        percentageOutsideUfo: 0
        itemSets:
          -
            - STR_SONIC_PISTOL
            - STR_PISTOL_POWER_CLIP
            - STR_PISTOL_POWER_CLIP
            - STR_SONIC_PULSER
          -
            - STR_SONIC_CANNON
            - STR_CANNON_POWER_CLIP
            - STR_CANNON_POWER_CLIP
            - STR_SONIC_PULSER
          -
            - STR_SONIC_CANNON
            - STR_CANNON_POWER_CLIP
            - STR_CANNON_POWER_CLIP
            - STR_SONIC_PULSER
            - STR_SONIC_PULSER
      - alienRank: 6
        lowQty: 2
        highQty: 2
        dQty: 0
        extraQty: 0
        percentageOutsideUfo: 0
        itemSets:
          -
            []
          -
            []
          -
            []
      - alienRank: 7
        lowQty: 2
        highQty: 2
        dQty: 0
        extraQty: 0
        percentageOutsideUfo: 0
        itemSets:
          -
            []
          -
            []
          -
            []
    width: 50
    length: 50
    height: 5
    briefing:
      palette: 4
      music: GMISPOSH


Code: [Select]
ufos:
# [=] Whirligig [=] (Small)
  - type: STR_MFTD_WHIRLIGIG
    size: STR_SMALL
    sprite: 1
    damageMax: 300
    speedMax: 2800
    power: 30
    range: 13
    score: 75
    reload: 56
    breakOffTime: 250
    battlescapeTerrainData:
      name: WHIRLIGIG
      mapDataSets:
        - BLANKS
        - UEXT2
        - UEXT3
        - UINT1
        - UINT2
        - UINT3
      mapBlocks:
        - name: WHIRLIGIG
          width: 20
          length: 20


Here are the craft's map files:
WHIRLIGIG.MAP
WHIRLIGIG.RMP


Code: [Select]
    terrains:
      - UEXT2
      - UEXT3
      - UINT1
      - UINT2
      - UINT3


What am I missing?
« Last Edit: May 27, 2023, 12:20:41 am by The Martian »

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: Not spawning the expected units inside the UFO?
« Reply #1 on: May 27, 2023, 08:40:41 am »
(i don't do TftD really, but) maybe the non-terrorist spawns are happening before the terrorist spawns and are taking those nodes.

as a test, try removing all spawns from the deployment except the terrorists, and see what happens

set their lowQty and highQty to 2 (for each terrorist-type) and dQty to 0

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Not spawning the expected units inside the UFO?
« Reply #2 on: May 29, 2023, 04:06:19 am »
I just tried removing all of the other spawns and setting their lowQty: & highQty to 2. Unfortunately the Hallucinoid are still choosing not to spawn on the expected nodes.

Here is the code I used:
Code: [Select]
alienDeployments:

# [=] Whirligig [=] (Small)
  - type: STR_MFTD_WHIRLIGIG
    data:
      - alienRank: 6
        lowQty: 2
        highQty: 2
        dQty: 0
        extraQty: 0
        percentageOutsideUfo: 0
        itemSets:
          -
            []
          -
            []
          -
            []
      - alienRank: 7
        lowQty: 2
        highQty: 2
        dQty: 0
        extraQty: 0
        percentageOutsideUfo: 0
        itemSets:
          -
            []
          -
            []
          -
            []
    width: 50
    length: 50
    height: 5
    briefing:
      palette: 4
      music: GMISPOSH


Is there a difference in the way TFTD handles its terror unit ranks in the .RMP file vs the original X-COM: UFO Defense?

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: Not spawning the expected units inside the UFO?
« Reply #3 on: May 30, 2023, 09:40:19 am »
Is there a difference in the way TFTD handles its terror unit ranks in the .RMP file vs the original X-COM: UFO Defense?

no i don't believe so. Am pretty sure the format of the RMP file is the same for both UFO and TFTD.

OxC/e hardcode matches up the data in alienDeployments.rul with appropriate noderanks in the RMP files (per the order of the ranks listed in alienRaces.rul).


I mucked and poked and tested and thought a bunch on this "force alienrank at node" issue today. But unfortunately I don't have OxC or OxCe setup in an IDE so my investigations were hampered ...

I did see and note some things that could be done a bit better (imo) -- for example, the game crashed arbitrarily (about 50%) when trying to do a quickbattle with only 1 terrorist spawning ('could not place any alien units on the map'), and that only the highest spawnpriority seems to be chosen (i could be wrong, depends on things I didn't look at completely) but lesser priority-values of the same rank are ignored (ie. rather than weighted). etc

perhaps somebody with the code already setup, and a curiosity about this stuff (again, merely my perception here) can or is interested in a more detailed look ...

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Not spawning the expected units inside the UFO?
« Reply #4 on: May 31, 2023, 11:54:42 am »
I just tried reworking the nodes so that there was only 1 of each rank like this:
Spoiler:


Then tried two experiments. The first spawned one Rank 6 Hallucinoid and the second spawned one Rank 7 Hallucinoid.

The result was the same both times, the units for Rank 6 and Rank 7 only spawned on the Rank 2 node instead of their own rank's node:
Spoiler:


This can't be right, I must be missing something here.

Here is the test route file with the above node setup:
WHIRLIGIG_TEST.RMP

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: Not spawning the expected units inside the UFO?
« Reply #5 on: June 01, 2023, 09:04:29 am »
so i set up a little spawntest and ran it against OxCe, and a Hallucinoid spawned at the correct node

Code: [Select]
alienRaces:
  - id: STR_AQUATOID_UNDERWATER
    members:
      - STR_AQUATOID_COMMANDER
      - STR_AQUATOID_NAVIGATOR
      - STR_AQUATOID_MEDIC
      - STR_AQUATOID_TECHNICIAN
      - STR_AQUATOID_SQUAD_LEADER
      - STR_AQUATOID_SOLDIER
      - STR_HALLUCINOID_TERRORIST
      - STR_HALLUCINOID_TERRORIST

Code: [Select]
alienDeployments:
  - type: STR_SPAWNTEST
    width: 20
    length: 20
    height: 4
    terrains:
      - SPAWNTEST
    data:
      - alienRank: 7
        lowQty: 1
        highQty: 1
        dQty: 0
        pctOutsideUfo: 100
        itemSets:
          -
            []
          -
            []
          -
            []

Code: [Select]
terrains:
  - name: SPAWNTEST
    music:
      - GMTACWET
    mapDataSets:
      - BLANKS
      - SAND
      - ROCKS
      - WEEDS
      - DEBRIS
      - UFOBITS
    depth: [1, 2]
    ambience: 67
    script: THREEBIG
    mapBlocks:
      - name: SEABED00
        width: 10
        length: 10
        groups: 1
      - name: SEABED01
        width: 10
        length: 10
        groups: 1
      - name: SEABED02
        width: 10
        length: 10

I modified SEABED02.RMP (see screenshot) with 4 civ/scout nodes in the corners and a Terrorist2 node in the middle (all spawnweights=1)

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: Not spawning the expected units inside the UFO?
« Reply #6 on: June 02, 2023, 12:42:01 am »
yeh so i did another test with noderanks 2..5 (Soldier through Medic) (civ/scout nodes appear to be ignored for this)

the Hallucinoid terrorist spawned at Soldier node, and if no Soldier node is present then at Medic node, then Squad Leader node, then at Navigator/Commander node ...

ignoring the Terrorist2 spawnnode until all the others were set to civ/scout ...

[edit]
it looks like these lines in the hardcode are responsible:

Savegame/Node.cpp
Code: [Select]
const int Node::nodeRank[8][7] =
    // ..
    { NR_SOLDIER, NR_ENGINEER, NR_NAVIGATOR, NR_LEADER, NR_MISC1, NR_MISC2, NR_SCOUT }, //terrorist
    { NR_SOLDIER, NR_ENGINEER, NR_NAVIGATOR, NR_LEADER, NR_MISC1, NR_MISC2, NR_SCOUT }  //also terrorist

ie. terrorists spawn at Soldier nodes preferentially ... (note that those constants are based on UFO but translate to TFTD ranks, with (ufo)Engineer as (tftd)Medic, etc)

[edit2]
here's the (rewritten) table in my personal build:

Code: [Select]
const int Node::nodeRank[8u][8u]
{
    { NR_LEADER,    NR_NAVIGATOR, NR_ENGINEER,  NR_SOLDIER,  NR_MEDIC,     NR_MISC2,  NR_MISC1, NR_SCOUT }, // commander
    { NR_LEADER,    NR_NAVIGATOR, NR_ENGINEER,  NR_SOLDIER,  NR_MEDIC,     NR_MISC2,  NR_MISC1, NR_SCOUT }, // leader
    { NR_ENGINEER,  NR_LEADER,    NR_NAVIGATOR, NR_SOLDIER,  NR_MEDIC,     NR_MISC2,  NR_MISC1, NR_SCOUT }, // engineer
    { NR_MEDIC,     NR_NAVIGATOR, NR_ENGINEER,  NR_LEADER,   NR_SOLDIER,   NR_MISC2,  NR_MISC1, NR_SCOUT }, // medic
    { NR_NAVIGATOR, NR_LEADER,    NR_ENGINEER,  NR_SOLDIER,  NR_MEDIC,     NR_MISC2,  NR_MISC1, NR_SCOUT }, // navigator
    { NR_SOLDIER,   NR_ENGINEER,  NR_NAVIGATOR, NR_MEDIC,    NR_LEADER,    NR_MISC2,  NR_MISC1, NR_SCOUT }, // soldier
    { NR_MISC1,     NR_MISC2,     NR_SOLDIER,   NR_ENGINEER, NR_NAVIGATOR, NR_LEADER, NR_MEDIC, NR_SCOUT }, // terrorist1
    { NR_MISC2,     NR_MISC1,     NR_SOLDIER,   NR_ENGINEER, NR_NAVIGATOR, NR_LEADER, NR_MEDIC, NR_SCOUT }  // terrorist2
};

but it has 8 ranks in the 2nd dimension .....
« Last Edit: June 02, 2023, 01:32:50 am by kevL »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Not spawning the expected units inside the UFO?
« Reply #7 on: June 02, 2023, 10:43:53 am »
Thank you for figuring that out, in that case I can work around it for this map.

it looks like these lines in the hardcode are responsible:

Savegame/Node.cpp
Code: [Select]
const int Node::nodeRank[8][7] =
    // ..
    { NR_SOLDIER, NR_ENGINEER, NR_NAVIGATOR, NR_LEADER, NR_MISC1, NR_MISC2, NR_SCOUT }, //terrorist
    { NR_SOLDIER, NR_ENGINEER, NR_NAVIGATOR, NR_LEADER, NR_MISC1, NR_MISC2, NR_SCOUT }  //also terrorist

ie. terrorists spawn at Soldier nodes preferentially ... (note that those constants are based on UFO but translate to TFTD ranks, with (ufo)Engineer as (tftd)Medic, etc)

Do you think the terror units not using their own rank if there is any other rank's spawn node is a bug in OpenXcom or is that how classic X-Com handled the terror spawns as well?
« Last Edit: June 02, 2023, 11:06:35 am by The Martian »

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: Not spawning the expected units inside the UFO?
« Reply #8 on: June 02, 2023, 02:50:28 pm »
I honestly don't know what the rationale is/was ... but that's the only thing i can think of (ie. it's not a bug per se)