aliens

Author Topic: Rank inconsistency  (Read 856 times)

Offline Delian

  • Commander
  • *****
  • Posts: 527
    • View Profile
Rank inconsistency
« on: September 11, 2024, 01:45:44 am »
In ground battles, unit's rank is represented by a single number, rankInt. For friendly units, this rank starts with 0 for rookies, and goes up to 5 for commander. However, for the enemies, this number does not represent a unit's military rank, but is instead the unit's race member index (limited to 7), which usually has the opposite order. So this number has two different meanings, depending on which faction the unit belongs to.

This creates a problem with formulae which contain rank. Some mods have items where damage scales with rank. If you put such an item in the hands of a common enemy soldier, the item will suddenly do very high damage, because the race member index of such a soldier has a high rankInt number.

So, I think that for better consistency, the number used for rank in formulae should always come only from unit's military rank:
STR_LIVE_SOLDIER = STR_LIVE_TERRORIST = STR_ROOKIE = 0
STR_LIVE_NAVIGATOR = STR_SQUADDIE = 1
STR_LIVE_MEDIC = STR_SERGEANT = 2
STR_LIVE_ENGINEER = STR_CAPTAIN = 3
STR_LIVE_LEADER = STR_COLONEL = 4
STR_LIVE_COMMANDER = STR_COMMANDER = 5

Offline Nord

  • Commander
  • *****
  • Posts: 1748
  • The Gate is open.
    • View Profile
Re: Rank inconsistency
« Reply #1 on: September 11, 2024, 05:42:06 am »
This will break vanilla game.
Use unit faction check instead(unit.getFaction). This will make script longer, but will work.
« Last Edit: September 11, 2024, 05:44:25 am by Nord »

Offline Delian

  • Commander
  • *****
  • Posts: 527
    • View Profile
Re: Rank inconsistency
« Reply #2 on: September 11, 2024, 10:48:39 am »
I'm not saying that the behavior of the existing rankInt should be changed, it cannot be changed because AI depends on it (how patrol paths are determined). I'm saying that when rank is used in formulae, rankInt should not be read, and instead a new number that comes from the rank string should be generated and used. Or is there some other solution?
« Last Edit: September 11, 2024, 10:53:04 am by Delian »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3358
    • View Profile
Re: Rank inconsistency
« Reply #3 on: September 11, 2024, 10:37:38 pm »
keyword is "normalized", I think I can add some thing like this

Offline Delian

  • Commander
  • *****
  • Posts: 527
    • View Profile
Re: Rank inconsistency
« Reply #4 on: September 12, 2024, 03:06:17 am »
The term normalized in this game has a specific meaning, as a value between 0 and 1. I don't think it makes sense for ranks to be 0.0, 0.2, 0.4, 0.6, 0.8 and 1.0. And even if you added a rankNormalized formula term, that wouldn't solve the problem with the original rank term.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3358
    • View Profile
Re: Rank inconsistency
« Reply #5 on: September 12, 2024, 10:49:02 am »
I mean "normalized" in more general term, like both will grown in same direction too, like 1.0 will be always for top alien and solder.