Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quest on defending sports ground missing in SRP #69

Closed
SurDno opened this issue Nov 19, 2018 · 7 comments
Closed

Quest on defending sports ground missing in SRP #69

SurDno opened this issue Nov 19, 2018 · 7 comments

Comments

@SurDno
Copy link
Contributor

SurDno commented Nov 19, 2018

In vanilla, as soon as you capture the Military Base with a freedom squad, the game spawns a few dogs nearby and make them go capture the sports ground. In SRP, however, these dogs do spawn, but don't go capture this point.

image

Here comes the save.

@Decane
Copy link
Owner

Decane commented Nov 10, 2019

The reason this works consistently in vanilla but (sometimes) not (immediately) in the SRP is that, in vanilla, the attacking Freedom squad is prevented from 'settling' into the sports ground by a bug that was fixed in the SRP:

+ Prevented Kostyan's squad at the Military Warehouses becoming unresponsive after the assault on the military base.

Under "normal" circumstances in CS -- which apply here -- squads will only move to a neighboring camp if their squad_power + attack_power exceeds the squad_power of the camp's current occupants. Let's do some calculations:

  • Kostyan's squad:
    • 4 NPCs with rank 750
    • 1 NPC with rank 600 (heh, Kostyan is less experienced than his lackies)
      => squad_power: 4 * (5 * 750 / 1000) + 1 * (5 * 600 / 1000) = 18
  • Mutant squad:
    • 4 NPCs with rank 400
      => squad_power: 4 * (5 * 400 / 1000) = 8
    • No attack_power parameter specified for mil_dogs_lair_6 in configs\misc\squad_descr_military.ltx; it defaults to 0, although it rises over time to 100 by 1 point every game hour for mutants. So, it would take 11 game hours for the mutant squad to attack, assuming every member of Kostyan's squad survives the assault.

Now, because Kostyan's squad never technically captures the sports ground in vanilla, the game considers it empty. Hence, when the mutant squad spawns beside the sports ground, it readily moves there because the game considers there to be no resistance at the sports ground. (Incidentally, this is also why you don't get a quest to defend the sports ground in vanilla when the mutants attack.)

But in the SRP, Kostyan's squad does settle into the sports ground. Hence, the mutants don't attack - they're too weak compared to Kostyan's squad... Unless, of course, sufficiently many NPCs in Kostyan's squad die during the assault to bring his squad's squad_power below 8. In that case, the mutants do attack even in the SRP.

The solution here is to define an explicit attack_power for the mutant squad.

@Decane Decane self-assigned this Nov 10, 2019
Decane added a commit that referenced this issue Nov 10, 2019
@Decane
Copy link
Owner

Decane commented Nov 10, 2019

Fixed in 69b1c8a.

@WoTStalker
Copy link

Suslov constantly repeats farewell phrases. Can you fix it?

@SurDno
Copy link
Contributor Author

SurDno commented Nov 11, 2019

Open this as a separate issue please.

@SurDno
Copy link
Contributor Author

SurDno commented Nov 11, 2019

@Decane, what is 5 in base squad power calculation? Why don’t you just divide by 200? And what is Kostyan’s default attack power?

@Decane
Copy link
Owner

Decane commented Nov 11, 2019

The squad_power calculation appears in:

  • sim_squad_generic:create_npc()
  • sim_squad_scripted:create_npc()

Every NPC in a squad increments squad_power by 5 * obj:rank() / 1000. The sim_squad_generic variant of create_npc() also aborts the game if total squad_power > 25.

what is 5 in base squad power calculation?

The maximum number of NPCs in a 'generic' squad in Clear Sky. This, combined with the fact that squad_power must never exceed 25 (see above), means each NPC should increment squad_power by no more than 5 on average. This, in turn, means the average rank of NPCs in a 'generic' squad should be no more than 1000.

Why don’t you just divide by 200?

I'm guessing GSC expressed the increment as 5 * obj:rank() / 1000 instead of obj:rank() / 200 to emphasize that 1000 is the maximum rank an NPC should have and that 5 is the maximum number of 'points' of squad power that the increment should add up to. (Dividing by 200 is unlikely to be any faster because LuaJIT does constant folding.)

And what is Kostyan’s default attack power?

Not sure what significance the word "default" has in your question, but Kostyan's squad's attack_power is 400. That doesn't matter one bit for whether the mutants attack them at the sports ground, though. Only squad_power is factored into a squad's defensive capability in the eyes of the game.

@SurDno
Copy link
Contributor Author

SurDno commented Nov 12, 2019

  1. With attack power that high, why don’t they attack the mutant squad power themselves? 400 > 8.
  2. Do most squads have attack power which is hundreds more than their squad power? Does not that make squad power calculation insignificant?

SurDno pushed a commit to SurDno/SRP that referenced this issue Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants