Project

General

Profile

Feature #801780

Friendly nuke

Added by 0xandr 0xandr 8 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Category:
Server
Target version:
Start date:
2019-02-09
Due date:
% Done:

0%

Estimated time:

Description

Allow nukes with decrease effectiveness.
Adds two settings:
  • nuke_pop_loss_pct [0,100] - percentage of population loss after nuke, instead of hard-coded 50%
  • nuke_defender_survival_chance_pct [0,100] - percentage chance of a unit inside the city to survive a nuke, does not affect units in open
    e.g.
    nuke_pop_loss_pct = 50
    nuke_defender_survival_chance_pct = 0
    replicates the existing behavior (and is the default setting)

History

#2 Updated by Marko Lindqvist 8 months ago

  • Target version changed from 2.6.1 to 3.1.0

Not a bugfix - not for stable branches. Please make patch against master.

- Comments documenting new ruleset fields should be added to supplied rulesets
- Values should be saved in rulesave.c
- No C++-comments ("//") in C-code, use ("/*" ... "*/")
- Space between 'if' and brace > "if ("
Variables should be declared in the beginning of the block (before any code), not in the middle
- The old code never destroyed the city (integer math, size reduction by 1/2 -> 0). Are you sure no further changes are needed for the case nuke_pop_loss_pct = 100?

#3 Updated by Marko Lindqvist 8 months ago

Will you make a new version of the patch?

#4 Updated by 0xandr 0xandr 8 months ago

Marko Lindqvist wrote:

Will you make a new version of the patch?

Sorry for the delay, I will. Thanks for the comments.
Re 100% population loss - I actually tested this in 2.6 and city was destroyed. I will double check against 3.1.0

#5 Updated by 0xandr 0xandr 8 months ago

Now that I re-read your comment it seems you consider new behavior with city getting destroyed when nuke_pop_loss_pct > 50 to be undesirable. We can add special handling to make sure city never goes to size 0 to be consistent with old behavior, however I wonder what is a more playable option? We also could make it another configuration switch. Thoughts?

#6 Updated by Marko Lindqvist 8 months ago

I were worried only that the following code might not be prepared for the city having been disappeared, but if there's no problem then there's no problem. Let's not overcomplicate this patch (if really desired, further settings to adjust this can go to a new ticket)

#7 Updated by 0xandr 0xandr 8 months ago

Ok, I verified the following settings in 3.0.91-dev on top of what I checked before by bombing a city of size 20

1) nuke_pop_loss_pct = 75

20 -> 5 -> 2 -> 1 -> 1 -> 1 -> ....

2) nuke_pop_loss_pct = 100

20 -> destroyed (along with all units in it)

3) nuke_pop_loss_pct = 30

20 -> 14 -> 10 -> 7 -> 5 -> 4 -> 3 -> 3 -> 3 -> ...

One change we could do here is to decrease a city size by min(1, calculated_pop_loss) instead of just calculated_pop_loss, but that also needs to account for case when nuke_pop_loss_pct = 0. Probably better to just keep it simple and leave as is, so it's easier to understand from player's standpoint

#8 Updated by 0xandr 0xandr 8 months ago

Uploaded patch against master, should have addressed all comments above

#9 Updated by Marko Lindqvist 8 months ago

Version that applies on top of Feature #804292

#10 Updated by Marko Lindqvist 8 months ago

  • Status changed from Resolved to Closed
  • Assignee set to Marko Lindqvist

Also available in: Atom PDF