Author Topic: [DONE] [Suggestion] Soldier bonuses (from transformations and commendations)  (Read 19442 times)

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Can I alter vision (heatVision, psiVision, visibilityAtDark) with YS?

No, you cannot alter any attributes of Armor.
Armor is a read-only "globally shared" entity.

But you can use hooks on hitUnit, damageUnit, visibilityUnit, etc. to change the algorithms so that they don't use only Armor attributes, but also additionally your custom BattleUnit tags.
« Last Edit: October 25, 2021, 12:57:50 pm by Meridian »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
No, you cannot alter any attributes of Armor.
Armor is a read-only "globally shared" entity.

But you can use hooks on hitUnit, damageUnit, visibilityUnit, etc. to change the algorithms so that they don't use only Armor attributes, but also additionally your custom BattleUnit tags.
This, I would never permit altering armor data during play as it would be asking for troubles.

Offline zee_ra

  • Colonel
  • ****
  • Posts: 213
    • View Profile
Re: [DONE] [Suggestion] Soldier bonuses (from transformations and commendations)
« Reply #32 on: September 19, 2022, 12:47:51 am »
I have answered the question: "Does this apply to "visibilityAtDay", "psi-heatVision", "camouflageAt", "psiDefence", "meleeDodge", "antiCamouflageAt"?"

The answer is "Yes"...or in full sentence "Yes, this does apply to all those attributes" (except visibilityAtDay).

Where "this" = "No... stats, regen and visibility are tracked on each unit separately... that's why I could affect them with bonuses. Other attributes defined by armor are only on the armor itself, not on each unit, so they are the same for all units (having the same armor) and cannot be changed individually."

As written above, there are no such bonuses and they are not displayed anywhere.

Could you please clarify, if the bonuses are calculated as formulaes?

If so, which bonuses?  The Ruleset Reference mentions that recovery.XXX bonuses could be.  I wonder, if stats.tu, stats.bravery, etc. also could?  I assume, the vibilityAtDark, psiVision, camouflageAtDark, camouflageAtDay, psiCamouflage, antiCamouflageAtDark, antiCamouflageAtDay, heatVision, frontArmor, sideArmor, rearArmor, underArmor could all be affected by a formula.  So, for example, something like this should be entirely possible:

Code: [Select]
    psiVision:
      psiStrength: 0.25
    frontArmor:
      psiStrength: [ 0.0 , 0.001 ]

Is such definition possible?  Would it yield dynamic bonuses based on the current parameter (e.g. psiStrength in a case under consideration) values?

Your input and perspective would be appreciated.

UPDATE.

Apparently, the formulae (mapping from current parameter values) only work for the recovery.* and psiDefense params.  I wonder, if that is indeed the case.  If so, is there an argument against the implementation of these parameters as mappings (i.e. computable dynamically)?  Is there a reason why only some parameters were made dynamic?  Would it be very hard to implement those parameters as dynamic?  Are they hard-coded in the VM?  Or, perhaps, they're specified through some low-level config?

I would also like to clarify, whether those params are additive.  In particular, all params related to visibility, namely antiCamouflageAtDay, antiCamouflageAtNight, camouflageAtDay, camouflageAtNight, heatVision, psiVision, psiCamouflage, and visibilityAtDark.  Do those bonuses add across all commendations?  Would e.g. heavVision = 60 and heatVision = 20 from different soldier bonuses yield heatVision == 80?  And, when those two soldier bonuses are combined with a heatVision = 20 bonus from armor, would I have heatVision == 100?
« Last Edit: September 19, 2022, 04:06:00 am by zee_ra »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [DONE] [Suggestion] Soldier bonuses (from transformations and commendations)
« Reply #33 on: September 20, 2022, 04:13:54 pm »
Could you please clarify, if the bonuses are calculated as formulaes?

No, they are not all calculated as formulaes.

If so, which bonuses?

All bonuses under the "recovery" section (time, energy, morale, health, mana, stun).


The Ruleset Reference mentions that recovery.XXX bonuses could be.  I wonder, if stats.tu, stats.bravery, etc. also could?

No.

I assume, the vibilityAtDark, psiVision, camouflageAtDark, camouflageAtDay, psiCamouflage, antiCamouflageAtDark, antiCamouflageAtDay, heatVision, frontArmor, sideArmor, rearArmor, underArmor could all be affected by a formula.  So, for example, something like this should be entirely possible:

Code: [Select]
    psiVision:
      psiStrength: 0.25
    frontArmor:
      psiStrength: [ 0.0 , 0.001 ]

Is such definition possible?

No.

Would it yield dynamic bonuses based on the current parameter (e.g. psiStrength in a case under consideration) values?

No.

Apparently, the formulae (mapping from current parameter values) only work for the recovery.* and psiDefense params.  I wonder, if that is indeed the case.

no, `psiDefense` param doesn't exist

If so, is there an argument against the implementation of these parameters as mappings (i.e. computable dynamically)?

Yes.

Is there a reason why only some parameters were made dynamic?

Yes.

Would it be very hard to implement those parameters as dynamic?

Some yes, some no.

Are they hard-coded in the VM?

What's a VM?

Or, perhaps, they're specified through some low-level config?

No.

I would also like to clarify, whether those params are additive.  In particular, all params related to visibility, namely antiCamouflageAtDay, antiCamouflageAtNight, camouflageAtDay, camouflageAtNight, heatVision, psiVision, psiCamouflage, and visibilityAtDark.

The only parameter that exists is `visibilityAtDark` and it is additive.

The other parameters don't exist.

Do those bonuses add across all commendations?

Yes.

Would e.g. heavVision = 60 and heatVision = 20 from different soldier bonuses yield heatVision == 80?

No, parameter `heatVision` doesn't exist.

And, when those two soldier bonuses are combined with a heatVision = 20 bonus from armor, would I have heatVision == 100?

No, parameter `heatVision` doesn't exist.

Offline StarMan

  • Squaddie
  • *
  • Posts: 8
  • Really love this Game!
    • View Profile
Re: [DONE] [Suggestion] Soldier bonuses (from transformations and commendations)
« Reply #34 on: September 20, 2022, 08:31:50 pm »
Is this going to be part of oxce in the future or is there a mod for this?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [DONE] [Suggestion] Soldier bonuses (from transformations and commendations)
« Reply #35 on: September 20, 2022, 08:51:31 pm »
This is part of oxce already.

Offline Aldorn

  • Commander
  • *****
  • Posts: 750
    • View Profile
This is part of oxce already.

Meridian,

I read this full thread, your posts included, but I still would have two question about Commendations and SoldierBonuses

Let's assume I have a commendation as follow:
10 levels of commendation with 4 levels of bonuses:
- Commendation L1 to L4 => SoldierBonus L1
- Commendation L5 to L7 => SoldierBonus L2
- Commendation L8 to L9 => SoldierBonus L3
- Commendation L10 => SoldierBonus L4

Code: [Select]
commendations:
  - type: STR_COMMENDATION_ALIENS_KILLED #Total number of kills across a soldier's career that meet the specified criteria
    description: STR_COMMENDATION_ALIENS_KILLED_DESCRIPTION
    sprite: 1
    criteria:
      killsWithCriteriaCareer: [10, 20, 30, 40, 50, 75, 100, 200, 300, 500]
    soldierBonusTypes: [STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED2, STR_SB_COMMENDATION_ALIENS_KILLED2, STR_SB_COMMENDATION_ALIENS_KILLED2, STR_SB_COMMENDATION_ALIENS_KILLED3, STR_SB_COMMENDATION_ALIENS_KILLED3, STR_SB_COMMENDATION_ALIENS_KILLED4]
    killCriteria:
      -
        - [1, ["STATUS_DEAD", "FACTION_HOSTILE"]]

soldierBonuses:
  - name: STR_SB_COMMENDATION_ALIENS_KILLED1
    stats:
      tu: 5
  - name: STR_SB_COMMENDATION_ALIENS_KILLED2
    stats:
      health: 5
  - name: STR_SB_COMMENDATION_ALIENS_KILLED3
    stats:
      tu: 5
  - name: STR_SB_COMMENDATION_ALIENS_KILLED4
    stats:
      health: 5

Questions:
1) Do I need to declare
Code: [Select]
soldierBonusTypes: [STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED2, STR_SB_COMMENDATION_ALIENS_KILLED2, STR_SB_COMMENDATION_ALIENS_KILLED2, STR_SB_COMMENDATION_ALIENS_KILLED3, STR_SB_COMMENDATION_ALIENS_KILLED3, STR_SB_COMMENDATION_ALIENS_KILLED4]
or may I perhaps make it shorter
Code: [Select]
soldierBonusTypes: [STR_SB_COMMENDATION_ALIENS_KILLED1, , , , STR_SB_COMMENDATION_ALIENS_KILLED2, , , STR_SB_COMMENDATION_ALIENS_KILLED3, , STR_SB_COMMENDATION_ALIENS_KILLED4]
or even another solution ?


2) In given example, will the 10th level of Commendation provide cumulative bonus of
- tu +10
- health +10

or only the bonus attached to the 10th level
- health +5

Said differently, if I want a cumulative result, would I have to declare
Code: [Select]
soldierBonuses:
  - name: STR_SB_COMMENDATION_ALIENS_KILLED1
    stats:
      tu: 5
  - name: STR_SB_COMMENDATION_ALIENS_KILLED2
    stats:
      tu: 5
      health: 5
  - name: STR_SB_COMMENDATION_ALIENS_KILLED3
    stats:
      tu: 10
      health: 5
  - name: STR_SB_COMMENDATION_ALIENS_KILLED4
    stats:
      tu: 10
      health: 10

(It may have to do with reset option, but not sure how to make it work properly)

PS: Commendation and SoldierBonuses modding is really great  ::)
« Last Edit: February 26, 2023, 03:22:51 pm by Aldorn »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Questions:
1) Do I need to declare
Code: [Select]
soldierBonusTypes: [STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED1, STR_SB_COMMENDATION_ALIENS_KILLED2, STR_SB_COMMENDATION_ALIENS_KILLED2, STR_SB_COMMENDATION_ALIENS_KILLED2, STR_SB_COMMENDATION_ALIENS_KILLED3, STR_SB_COMMENDATION_ALIENS_KILLED3, STR_SB_COMMENDATION_ALIENS_KILLED4]
or may I perhaps make it shorter
Code: [Select]
soldierBonusTypes: [STR_SB_COMMENDATION_ALIENS_KILLED1, , , , STR_SB_COMMENDATION_ALIENS_KILLED2, , , STR_SB_COMMENDATION_ALIENS_KILLED3, , STR_SB_COMMENDATION_ALIENS_KILLED4]
or even another solution ?

You can omit the bonuses at the end.
Not in the middle, as far as I remember.
Test to be sure.

2) In given example, will the 10th level of Commendation provide cumulative bonus of
- tu +10
- health +10

or only the bonus attached to the 10th level
- health +5

Each commendation in the soldier's diary has only one level.
Each commendation level provides only one bonus.
There is no automagical cumulation.
« Last Edit: February 26, 2023, 07:28:50 pm by Meridian »

Offline Aldorn

  • Commander
  • *****
  • Posts: 750
    • View Profile
You are right, I will make tests

Thanks for the answers

And congrats for the good job!

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11728
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Since we have the option to alter visibilityAtDark with soldierBonuses, could I also request heatVision and psiVision? And if possible, also antiCamouflageAtDark, antiCamouflageAtDay, antiCamouflageAtDark and antiCamouflageAtDay?

This has been suggested by the community and I think I could do something useful with this.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
I could say that scripts could do this but it have drawback that you would need override default visibility calculations,
if you already override it for some units then this become problematic.
On top of that, `psiVision` is handed before script can do anything.

Overall, I think `heatVision` and `psiVision` could be handed by engine and standard rulesets but rest (aka "Camouflage")
should be handed by rolling your own implementation of visibility by scripts.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11728
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Thanks, heatVision and psiVision alone would already be useful.