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

Ai improvement (dynamic budget) + fix + comments #255

Merged
merged 11 commits into from
Apr 27, 2023
6 changes: 6 additions & 0 deletions common/history/buildings/13_australasia.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
BUILDINGS={
s:STATE_NEW_SOUTH_WALES={
region_state:AST={
create_building={
building="building_aluminum_refinery"
level=1
reserves=1
activate_production_methods={ "pm_hall_heroult_process" "pm_privately_owned_industry" "pm_professional_service_industry_no" "pm_no_environmental_tech" "pm_powered_assembly_lines_industry" }
}
create_building={
building="building_port"
level=4
Expand Down
4 changes: 4 additions & 0 deletions common/production_methods/01_industry.txt
JackEPepper marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5065,11 +5065,13 @@ pm_autonomous_ai = {
## Green Tech PMG
pm_no_environmental_tech = {
texture = "gfx/interface/icons/production_method_icons/no_green_tech.dds"
ai_value = 0
}

pm_basic_green_tech = {
texture = "gfx/interface/icons/production_method_icons/basic_green_tech.dds"
pollution_generation = -5
ai_value = 5000
unlocking_technologies = {
geological_sciences
}
Expand All @@ -5086,6 +5088,7 @@ pm_basic_green_tech = {
pm_more_green_tech = {
texture = "gfx/interface/icons/production_method_icons/green_tech_2.dds"
pollution_generation = -15
ai_value = 10000
unlocking_technologies = {
environmentalism
}
Expand All @@ -5102,6 +5105,7 @@ pm_more_green_tech = {
pm_advanced_green_tech = {
texture = "gfx/interface/icons/production_method_icons/advanced_green_tech.dds"
pollution_generation = -50
ai_value = 20000
unlocking_technologies = {
environmental_systems_engineering
}
Expand Down
144 changes: 104 additions & 40 deletions common/script_values/aroai_budgeting_values.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,70 @@ aroai_95_percent_of_credit = {
multiply = 0.95
}

aroai_gold_reserves_percent = {
value = gold_reserves
divide = {
value = gold_reserves_limit
min = 1
}
}

aroai_weeks_of_reserves = {
if = {
limit = {
aroai_country_budget_surplus < 0
gold_reserves > 0
}
value = gold_reserves
divide = {
value = 0
subtract = {
if = {
limit = {
aroai_country_budget_surplus < 0
}
value = aroai_country_budget_surplus
}
else = {
value = aroai_country_budget_surplus_percent
subtract = 0.10
max = -0.05
multiply = aroai_country_fixed_income
}
}
min = 1
}
max = 9000
}
else = {
value = 0
}
}

aroai_weeks_of_credit = {
if = {
limit = {
aroai_country_budget_surplus < 0
aroai_country_current_treasury > 0
}
value = credit
add = aroai_country_current_treasury
divide = {
value = 0
subtract = aroai_country_budget_surplus
min = 1
}
min = 0
}
else = {
value = 1000000
}
}

# Give the country budget surplus
# WTF is he doing ?
# todo test if this make sense
# Range :
aroai_country_budget_surplus = {
if = {
limit = {
Expand Down Expand Up @@ -75,7 +139,7 @@ aroai_total_building_expenses = {
value = var:aroai_total_building_expenses
subtract = {
value = var:aroai_total_building_expenses
floor = yes
floor = yes
}
multiply = 100
}
Expand All @@ -85,6 +149,7 @@ aroai_total_building_expenses = {
}
}

# Income scaled by tax_level, for management stability
aroai_country_fixed_income = {
value = income
if = {
Expand Down Expand Up @@ -192,7 +257,7 @@ aroai_investment_pool_transfer = {
value = var:aroai_investment_pool_transfer
subtract = {
value = var:aroai_investment_pool_transfer
floor = yes
floor = yes
}
multiply = 100
}
Expand Down Expand Up @@ -230,6 +295,8 @@ aroai_investment_pool_potential = {
}
}

# The total expense of the private construction sector
# only used in pool_potential
aroai_construction_expenses_of_private_queue = {
if = {
limit = {
Expand All @@ -256,7 +323,7 @@ aroai_investment_pool_expected = {
value = var:aroai_investment_pool_expected
subtract = {
value = var:aroai_investment_pool_expected
floor = yes
floor = yes
}
multiply = 100
}
Expand Down Expand Up @@ -459,42 +526,39 @@ aroai_country_budget_surplus_for_health_3 = {

aroai_weeks_of_reserves_for_health_3 = 312

aroai_gold_reserves_percent = {
value = gold_reserves
divide = {
value = gold_reserves_limit
min = 1
}
# does NOT assume that we pay for private queue
# How many construction point is needed max if workforce is the bottleneck
aroai_max_wanted_constructions_depense_from_pop = {
value = aroai_max_wanted_constructions_points_from_pop
multiply = aroai_building_construction_sector_expenses_per_point
}

aroai_weeks_of_reserves = {
if = {
limit = {
aroai_country_budget_surplus < 0
gold_reserves > 0
}
value = gold_reserves
divide = {
value = 0
subtract = {
if = {
limit = {
aroai_country_budget_surplus < 0
}
value = aroai_country_budget_surplus
}
else = {
value = aroai_country_budget_surplus_percent
subtract = 0.10
max = -0.05
multiply = aroai_country_fixed_income
}
}
min = 1
}
max = 9000
}
else = {
value = 0
}
}
# does NOT assume that we pay for private queue
# What would be the share of remaining budget if workforce is the bottleneck
aroai_max_wanted_constructions_revenue_share_from_pop = {
value = aroai_max_wanted_constructions_depense_from_pop
divide = aroai_revenue_left_for_construction_military # maybe should i use income ?
}


# SUM MUST be = 1
# Budget is bottleneck
aroai_construction_share_developing = {
value = 0.75
}
# Budget is bottleneck
aroai_military_share_developing = {
value = 0.25
}
# Workforce is bottleneck
aroai_construction_share_developed = {
value = aroai_max_wanted_constructions_revenue_share_from_pop
}
# Workforce is bottleneck
aroai_military_share_developed = {
value = 1
subtract = aroai_max_wanted_constructions_revenue_share_from_pop
}



22 changes: 17 additions & 5 deletions common/script_values/aroai_construction_values.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aroia_total_workforce_next_year = {
aroai_total_workforce_next_year = {
value = total_population

# TODO change this to actual country pop growth and workforce ratio
Expand All @@ -20,9 +20,10 @@



aroia_max_wanted_constructions_points = {
# How much construction point is needed max if workforce is bottleneck
aroai_max_wanted_constructions_points_from_pop = {

value = aroia_total_workforce_next_year
value = aroai_total_workforce_next_year

multiply = construction_cost_high # cost of a factory

Expand All @@ -48,12 +49,23 @@ aroia_max_wanted_constructions_points = {
multiply = 1.3
}

# We take the minimum between the 2 value
aroai_max_wanted_constructions_points = {
value = aroai_max_wanted_constructions_points_from_pop
max = aroai_max_wanted_constructions_points_from_budget
}


aroia_max_wanted_constructions_points_20_percent_more = {
value = aroia_max_wanted_constructions_points
aroai_max_wanted_constructions_points_20_percent_more = {
value = aroai_max_wanted_constructions_points
multiply = 1.2
}

aroai_max_wanted_constructions_points_20_percent_less = {
value = aroai_max_wanted_constructions_points
multiply = 0.8
}

aroai_simultaneous_constructions = {
value = aroai_construction_points_current
divide = aroai_construction_points_per_building
Expand Down
Loading