Skip to content

Commit

Permalink
Merge pull request #405 from Cold-War-Project/pop-growth-fuckery
Browse files Browse the repository at this point in the history
Pop growth fuckery
  • Loading branch information
DZappala authored Jul 11, 2023
2 parents bddfd4a + 87fa904 commit d459bfd
Show file tree
Hide file tree
Showing 25 changed files with 605 additions and 204 deletions.
2 changes: 2 additions & 0 deletions common/building_groups/00_building_groups.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ bg_agriculture = {
economy_of_scale = yes
urbanization = 5
infrastructure_usage_per_level = 1
proportionality_limit = 0.5
should_auto_expand = {
default_auto_expand_rule = yes
}
Expand Down Expand Up @@ -106,6 +107,7 @@ bg_subsistence_agriculture = {
is_subsistence = yes
default_building = building_subsistence_farms
fired_pops_become_radical = no
proportionality_limit = 1
hires_unemployed_only = yes
}

Expand Down
1 change: 1 addition & 0 deletions common/decisions/china_decisions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ roc_great_retreat = {
# Retreat to Formosa/Taiwan
is_shown = {
and = {
exists = c:PRC
exists = c:ROC
this = c:ROC
}
Expand Down
10 changes: 5 additions & 5 deletions common/defines/cwp_defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,19 @@ NPops = {
### Pop Growth Constants
@min_birthrate = 0.0015
@max_birthrate = 0.0040
@min_mortality = 0.0010
@min_mortality = 0.0015
@max_mortality = 0.0070
@pop_growth_sol_equilibrium = 5 # Equilibrium is where (with no birthrate/death-rate mods) growth is stagnant
@pop_growth_sol_delta_cap = 20 # SoL Delta Cap is where net growth stops increasing with rising SoL, i.e. both drop at the same pace
@pop_growth_sol_cap = 40 # SoL Cap is where they birthrate/death-rate stop dropping
@pop_growth_sol_delta_cap = 7 # SoL Delta Cap is where net growth stops increasing with rising SoL, i.e. both drop at the same pace
@pop_growth_sol_cap = 20 # SoL Cap is where they birthrate/death-rate stop dropping

@mortality_at_equilibrium = @[max_birthrate-(pop_growth_sol_equilibrium*(max_birthrate-min_birthrate)/pop_growth_sol_cap)]
@birthrate_at_delta_cap = @[max_birthrate-(pop_growth_sol_delta_cap*(max_birthrate-min_birthrate)/pop_growth_sol_cap)]
@improving_slope = @[(birthrate_at_delta_cap-min_birthrate+min_mortality-mortality_at_equilibrium)/(pop_growth_sol_delta_cap-pop_growth_sol_equilibrium)]
@improving_intercept = @[-1*improving_slope*pop_growth_sol_equilibrium+mortality_at_equilibrium]
@mortality_at_delta_cap = @[improving_slope*pop_growth_sol_delta_cap+improving_intercept]
@fixed_delta_slope = @[(min_mortality-mortality_at_delta_cap)/(pop_growth_sol_cap-pop_growth_sol_delta_cap)]

NPops = {
POP_GROWTH_BIRTHRATE_REDUCTION_PER_SOL = @[(max_birthrate-min_birthrate)/pop_growth_sol_cap]
POP_GROWTH_MORTALITY_AT_EQUILIBRIUM = @mortality_at_equilibrium
Expand All @@ -259,7 +259,7 @@ NPops = {
POP_GROWTH_IMPROVING_INTERCEPT = @improving_intercept
POP_GROWTH_FIXED_DELTA_SLOPE = @fixed_delta_slope
POP_GROWTH_FIXED_DELTA_INTERCEPT = @[-1*fixed_delta_slope*pop_growth_sol_cap+min_mortality]

POP_GROWTH_MIN_BIRTHRATE = @min_birthrate # Minimum base birthrate per month (at SOL_POP_GROWTH_CAP)
POP_GROWTH_MAX_BIRTHRATE = @max_birthrate # Maximum base birthrate per month (at SOL = 0)
POP_GROWTH_MIN_MORTALITY = @min_mortality # Maximum base mortality per month (at SOL_POP_GROWTH_CAP)
Expand Down
2 changes: 1 addition & 1 deletion common/goods/00_goods.txt
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,9 @@ bonds = {
texture = "gfx/interface/icons/goods_icons/financial_services.dds"
cost = 25
category = industrial
tradeable = no
fixed_price = yes
prestige_factor = 1
convoy_cost_multiplier = 0.05
}

tourism = {
Expand Down
20 changes: 1 addition & 19 deletions common/history/global/00_global.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,7 @@ GLOBAL = {
# Urbanization Setup
every_country = {
every_scope_state = {
set_local_variable = {
name = var_urban_rate
value = {
value = total_urbanization
divide = {
value = arable_land
multiply = 100
add = 1
add = total_urbanization
}
add = -0.5
multiply = 50
}
}
remove_modifier = urbanization_modifier
add_modifier = {
name = urbanization_modifier
multiplier = local_var:var_urban_rate
}
onaction_urbanization_modifier = yes
every_scope_building = {
limit = {
is_building_type = building_renewable_energy_facility
Expand Down
4 changes: 2 additions & 2 deletions common/laws/cwp_14_education_system.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ law_mixed_funded_schools = {
state_education_access_wealth_add = 0.0025
state_assimilation_mult = 0.025
interest_group_in_government_attraction_mult = 0.025
state_education_access_add = 0.01
state_education_access_add = 0.025
}
modifier = {
country_institution_schools_max_investment_add = 2
Expand Down Expand Up @@ -217,7 +217,7 @@ law_state_funded_schools = {
institution_modifier = {
interest_group_in_government_attraction_mult = 0.05
state_assimilation_mult = 0.05
state_education_access_add = 0.025
state_education_access_add = 0.05
}
modifier = {
country_institution_schools_max_investment_add = 3
Expand Down
10 changes: 4 additions & 6 deletions common/laws/cwp_15_health_system.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ law_church_run_hospitals = {
unlocking_technologies = {
}
modifier = {
country_institution_health_system_max_investment_add = 2
}
institution = institution_health_system
institution_modifier = {
state_mortality_mult = -0.035
state_mortality_mult = -0.01
interest_group_ig_moralists_pol_str_mult = 0.2
}
# Don't return to charity if we have something more advanced
Expand Down Expand Up @@ -100,7 +99,6 @@ law_private_health_insurance = {
unlocking_technologies = {
}
modifier = {
country_institution_health_system_max_investment_add = 3
}
institution = institution_health_system
institution_modifier = {
Expand Down Expand Up @@ -146,11 +144,11 @@ law_subsidized_health_insurance = {
unlocking_technologies = {
}
modifier = {
country_institution_health_system_max_investment_add = 4
country_institution_health_system_max_investment_add = 2
}
institution = institution_health_system
institution_modifier = {
state_mortality_mult = -0.013
state_mortality_mult = -0.005
state_mortality_wealth_mult = -0.0005
}
pop_support = {
Expand Down Expand Up @@ -194,7 +192,7 @@ law_universal_healthcare = {
}
institution = institution_health_system
institution_modifier = {
state_mortality_mult = -0.026
state_mortality_mult = -0.01
}
pop_support = {
value = 0
Expand Down
12 changes: 5 additions & 7 deletions common/modifiers/00_static_modifiers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ working_conditions = {

malnourishment = {
icon = gfx/interface/icons/timed_modifier_icons/modifier_fire_negative.dds
state_birth_rate_mult = -0.05 # per level below equilibrium
state_mortality_mult = 0.1
state_birth_rate_mult = -0.5 # per level below equilibrium
state_mortality_mult = 0.25
}

commander_battle_end_victory = {
Expand Down Expand Up @@ -334,7 +334,7 @@ legislative_efficiency = {
political_dysfunction = {
icon = gfx/interface/icons/timed_modifier_icons/modifier_flag_negative.dds
country_opposition_ig_approval_add = -10
state_radicals_from_sol_change_mult = 0.20
state_radicals_from_sol_change_mult = 0.2
}

# Excess DIP increases Infamy decay by up to 25% at 2x production to usage
Expand Down Expand Up @@ -406,12 +406,12 @@ battle_navy_average_kill_rate = {

battle_average_provinces_captured = {
icon = gfx/interface/icons/timed_modifier_icons/modifier_rifle_positive.dds
unit_provinces_captured_mult = 1.0
unit_provinces_captured_mult = 1
}

battle_average_provinces_lost = {
icon = gfx/interface/icons/timed_modifier_icons/modifier_rifle_negative.dds
unit_provinces_lost_mult = 1.0
unit_provinces_lost_mult = 1
}

# Scales with how much population is under low pop threshold
Expand Down Expand Up @@ -499,7 +499,6 @@ country_literacy_rate = {
country_weekly_innovation_max_add = 750
country_tech_spread_add = 475
character_health_add = 1
state_birth_rate_mult = -0.25
}

# Scales with number of excess innovation points
Expand Down Expand Up @@ -580,7 +579,6 @@ early_demobilization = {
country_expenses_add = 1
}


# Scaled by building_mobilization_cost_mult
mobilized_battalion_consumption = {
icon = gfx/interface/icons/timed_modifier_icons/modifier_coins_negative.dds
Expand Down
2 changes: 1 addition & 1 deletion common/on_actions/00_code_on_actions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ on_resource_discovered = {
# Root = State
on_resource_depleted = {
effect = {
owner = {
state_region = {
post_notification = resource_depleted
}
}
Expand Down
1 change: 0 additions & 1 deletion common/pop_types/cwp_academics.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
limit = {
literacy_rate > 0.2
}
# baseline: ( literacy - 0.2 ) * 10 + ( wealth / 10 ), norm 5
add = {
value = literacy_rate
subtract = 0.2
Expand Down
7 changes: 3 additions & 4 deletions common/pop_types/cwp_administrators.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@
qualifications = {
if = {
limit = {
literacy_rate > 0.2
literacy_rate > 0.1
}
# baseline: ( literacy - 0.2 ) * 10 * ( 2 if accepted culture and religion), norm 6 for Literacy 50% and Accepted C/R
add = {
value = literacy_rate
subtract = 0.2
multiply = 20
subtract = 0.1
multiply = 15
desc = QUALIFICATIONS_LITERACY_FACTOR
}
if = {
Expand Down
21 changes: 16 additions & 5 deletions common/pop_types/cwp_clergy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,31 @@
qualifications = {
if = {
limit = {
literacy_rate > 0.2
literacy_rate > 0.1
}
# baseline: ( literacy - 0.2 ) * 20, norm 6 for Literacy 50% and Accepted Religion
add = {
value = literacy_rate
subtract = 0.2
multiply = 20
subtract = 0.1
multiply = 15
desc = QUALIFICATIONS_LITERACY_FACTOR
}
if = {
limit = {
or = {
is_pop_type = laborers
is_pop_type = academics
is_pop_type = farmers
}
}
multiply = {
value = 5
desc = QUALIFICATIONS_FAVORED_TYPE
}
}
if = {
limit = {
or = {
is_pop_type = informal_workers
is_pop_type = laborers
}
}
multiply = {
Expand Down
67 changes: 47 additions & 20 deletions common/pop_types/cwp_creatives.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,59 @@
}
qualifications_growth_desc = CREATIVES_QUALIFICATIONS_DESC
qualifications = {
# baseline: ( wealth - 5 ) / 2, norm 10 for service_workers with Wealth 15
add = {
value = wealth
subtract = 5
min = 0
desc = QUALIFICATIONS_WEALTH_FACTOR
}
if = {
limit = {
is_pop_type = professionals
literacy_rate > 0.1
}
multiply = {
value = 5
desc = QUALIFICATIONS_FAVORED_TYPE
add = {
value = literacy_rate
subtract = 0.1
multiply = 15
desc = QUALIFICATIONS_LITERACY_FACTOR
}
}
if = {
limit = {
or = {
is_pop_type = academics
is_pop_type = service_workers
add = {
subtract = 5
min = 0
desc = QUALIFICATIONS_WEALTH_FACTOR
}
if = {
limit = {
or = {
is_pop_type = academics
is_pop_type = professionals
}
}
multiply = {
value = 5
desc = QUALIFICATIONS_FAVORED_TYPE
}
}
if = {
limit = {
or = {
is_pop_type = service_workers
is_pop_type = clergy
}
}
multiply = {
value = 2
desc = QUALIFICATIONS_FAVORED_TYPE
}
}
if = {
limit = {
culture_accepted = no
}
multiply = {
value = 0.1
desc = QUALIFICATIONS_CULTURAL_DISCRIMINATION
}
}
multiply = {
value = 2
desc = QUALIFICATIONS_FAVORED_TYPE
}
else = {
value = {
desc = QUALIFICATIONS_INSUFFICIENT_LITERACY_DECAY
value = -2
}
}
}
Expand Down
1 change: 0 additions & 1 deletion common/pop_types/cwp_engineers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
limit = {
literacy_rate > 0.2
}
# baseline: ( literacy - 0.2 ) * 5 + ( wealth / 20 ), norm 2.5 for Wealth 20 and Literacy 50%
add = {
value = literacy_rate
subtract = 0.2
Expand Down
Loading

0 comments on commit d459bfd

Please sign in to comment.