aliens

Author Topic: Understand Node Ranks  (Read 3094 times)

Offline Nord

  • Commander
  • *****
  • Posts: 1625
  • The Gate is open.
    • View Profile
Understand Node Ranks
« on: December 14, 2019, 06:24:38 am »
Help me please.
I'm placing 4 spawn nodes with rank 4 (leader/commander in MapView2), hoping there will be commanders - and there are 2 commanders and 2 soldiers.
Placing with rang 0 - and got 1 technic and 3 medics.
What is going on?
I think that i just dont understand node rank mechanics, because node ranks not relative to alien race description.
But how can i place ONLY commanders or only terror units (no matter, i can resort alien race to pu

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: Understand Node Ranks
« Reply #1 on: December 14, 2019, 10:21:49 am »
Highest level order:
- xcom first
- then aliens
- then civilians

If "civilianSpawnNodeRank" > 0 for a deployment, then the order changes to:
- xcom first
- then civilians
- then aliens

During alien deployment, aliens are deployed in the order they are defined in "data" attribute... usually commanders first, leader next, soldier last... but it's up to you to define that.

Each alien then uses its rank to find a corresponding node, using the following table.
If alien rank > 7, then it is treated as alien rank = 7.

Code: [Select]
/* following data is the order in which certain alien ranks spawn on certain node ranks */
/* note that they all can fall back to rank 0 nodes - which is scout (outside ufo) */
const int Node::nodeRank[8][7] = {
{ 4, 3, 5, 8, 7, 2, 0 }, //commander
{ 4, 3, 5, 8, 7, 2, 0 }, //leader
{ 5, 4, 3, 2, 7, 8, 0 }, //engineer
{ 7, 6, 2, 8, 3, 4, 0 }, //medic
{ 3, 4, 5, 2, 7, 8, 0 }, //navigator
{ 2, 5, 3, 4, 6, 8, 0 }, //soldier
{ 2, 5, 3, 4, 6, 8, 0 }, //terrorist
{ 2, 5, 3, 4, 6, 8, 0 }  }; //also terrorist

For example alien rank 0 (commander), will use the first line:

Code: [Select]
{ 4, 3, 5, 8, 7, 2, 0 }, //commander

and will first look for node rank 4... if there is no such node free, it will look for node rank 3.... if not found, it will look for node rank 5... and so on.

If it doesn't find any node, it will not be generated.... unless on Superhuman difficulty where it will spawn anyway, next to some other already placed alien.

Offline kevL

  • Colonel
  • ****
  • Posts: 466
  • pitchforks and torches
    • View Profile
Re: Understand Node Ranks
« Reply #2 on: December 14, 2019, 10:34:16 am »
[please note that Meridian's post above takes precedent over this post, but since this may contain additional info or insight here it is -- ie, this is an opinion, while Meridian's post contains specific facts]


spawning aliens isn't a deterministic procedure. Or, if you really want it to be deterministic, you'd have to put a lot of time&effort into getting spawns to turn out just the way you'd want.

it involves "alienRaces", "alienMissions", "alienDeployments" ... plus the engine itself uses a fallback mechanism when trying to place an alien of specific rank on a node of specific rank: if it can't find a node of the alien's rank (or that node is already taken by a previously spawned alien, or the node doesn't match the alien's unit type, etc) it searches for a free node of that or another rank.

in short there are several reasons why an alien of rank doesn't spawn at a node of its rank, because it isn't determined simply by setting NodeRank + SpawnWeight in Mapview 1/2

there'd have to be enough aliens of rank, enough nodes of rank and other ranks (so that aliens of other ranks don't steal a node that you'd think should be reserved for a different rank), etc.


I've looked through the spawn-code many times and indeed rewritten substantial parts of it for my personal build, yet i still don't completely get it ...

or it could just be a bug,


But how can i place ONLY commanders or only terror units

i think you'd have to design the mission and deployment rules with very tight constraints ... possibly the routes file also.

Offline Nord

  • Commander
  • *****
  • Posts: 1625
  • The Gate is open.
    • View Profile
Re: Understand Node Ranks
« Reply #3 on: December 14, 2019, 11:43:18 am »
Ok, so if i understanding correct...
To create a room, full of commanders, and no commanders elewhere, i should:
Create a spawn nodes in this room with spawnrank 4. Enough of them.
Place commanders to the first place in deployment list.
spawn equal or less number of them to spawnnodes from p.1
And still that will be not enough for Superhuman.

I need to save this page...
Thanks.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: Understand Node Ranks
« Reply #4 on: December 14, 2019, 11:56:04 am »
I will probably make that superhuman feature optional... it doesn't fit well with any other feature.

Offline kevL

  • Colonel
  • ****
  • Posts: 466
  • pitchforks and torches
    • View Profile
Re: Understand Node Ranks
« Reply #5 on: December 15, 2019, 03:13:02 am »
seems, vaguely :\ like a good idea ...

perhaps a flag in each terrain: "goForMax" lul

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: Understand Node Ranks
« Reply #6 on: December 15, 2019, 03:37:30 pm »
Commanders will prefer to spawn on leader/commander nodes but can spawn on lower nodes if any are available. If you aren't getting enough commanders, you must define the deployment to send more.

Code: [Select]
  - type: STR_BATTLESHIP
      - alienRank: 0
        lowQty: 1
        highQty: 1
        dQty: 0

With this, you'll get 1 commander no matter how many commander nodes there are on the map.


To ensure commanders always go in X room, X room should be the only place with commander nodes. You can make commanders spawn in room X and leaders in room Y by putting the right amount of nodes in each room and putting a higher priority on the commander room's nodes. The commanders will spawn first and fill up room X. So long as there are no nodes remaining in room X, the leaders will spawn in room Y.
« Last Edit: December 15, 2019, 03:41:24 pm by The Reaver of Darkness »

Offline Nord

  • Commander
  • *****
  • Posts: 1625
  • The Gate is open.
    • View Profile
Re: Understand Node Ranks
« Reply #7 on: October 07, 2021, 04:56:20 pm »
Digging this topic up.

Is this not strange, that soldiers and terror units use same placement order? So if i build a kennels for alien dogs, and put spawn points with rank 6 in them, these kennels will be full of soldiers.

Maybe there is a way to avoid this?

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: Understand Node Ranks
« Reply #8 on: October 08, 2021, 06:25:31 am »
Maybe there is a way to avoid this?

Here is a possible way:
Have the kennels include engineers, and the soldier quarters include navigators.

Rank order for these four ranks should be:
6 terrorist
7 terrorist
2 engineer
4 navigator
5 soldier

Other ranks should be either before or after these ranks, these five should be in a solid block together.

On the map, do not place any rank 2: soldier nodes. In the kennels, place about enough rank 5: engineer nodes for all of the terrorists and engineers. In the quarters, place about enough rank 3: navigator nodes for all of the navigators and soldiers. If the maximum variation in unit numbers is small enough, then the terrorists and soldiers may never appear in the wrong place, though the engineers and navigators may have a more random placement.

This will also require that you use 100% odds of them appearing inside the ship.

It is a convoluted solution which can lead to problems in other areas, so use sparingly and carefully if at all.

- - - - -

Another solution is to put soldiers or terrorists into different rank slots. They don't have to be rank 5 and 6, 7.

Offline Nord

  • Commander
  • *****
  • Posts: 1625
  • The Gate is open.
    • View Profile
Re: Understand Node Ranks
« Reply #9 on: October 08, 2021, 08:42:45 am »
- - - - -

Another solution is to put soldiers or terrorists into different rank slots. They don't have to be rank 5 and 6, 7.
Looks like only real option. Because map can change via random blocks placement.