• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Pancakelord

Lord of Pancakes
44 Badges
Apr 7, 2018
3.375
12.292
  • Cities: Skylines - Green Cities
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Ancient Relics
  • Cities: Skylines - Mass Transit
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Imperator: Rome
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Cities: Skylines Industries
  • Imperator: Rome Deluxe Edition
  • Magicka: Wizard Wars Founder Wizard
  • Stellaris: Nemesis
  • Europa Universalis IV
  • Stellaris: Necroids
  • Sword of the Stars
  • Crusader Kings III
  • War of the Roses
  • Cities: Skylines
  • Stellaris: Federations
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris: Lithoids
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris - Path to Destruction bundle
  • Stellaris: Megacorp
  • Stellaris: Synthetic Dawn
  • Crusader Kings II
  • Stellaris
  • Cities: Skylines Deluxe Edition
  • Sword of the Stars II
  • March of the Eagles
  • Darkest Hour
Has anyone attempted something like this yet?

It seems the AI cant handle the concept of "proportionality". If it has 20 Alloy jobs and 20 CG jobs, it will try and fill all of 1 and then all of the other (or completely tank its mineral supply).
It does not appear to have the capacity to "split" its workforce, or not enough anyway, to have pops 10 in 1 job-type and 10 in the other if you only had 20/40 pops in the above example.

The priority/favourite system is wholly inadequite, not letting us set tiers of jobs, and I dont think the AI can even disable jobs. So what about plan B - What if the AI could actually turn its jobs off?

I've set up 2 decisions, 1 will increase #Alloy jobs whilst decreasing #CG jobs - the other does the opposite.
1619634058845.png


example
1
1619634324619.png
4/4 A/CG split
2
1619634371891.png
5/3
3
1619634438886.png
and after refresh(manually turn off/on 1 job)
1619634522297.png


And it works the other way too, removing those modifiers, one-by-one, first, then adding alloy jobs up until no artisans are left to deduct.

I am still trying to figure out how to force an update (have to manually turn 1 job off/on for the game to shuffle pops around - currently using
check_planet_employment = yes but might have to script in for it to directly scope to an artisan/metallurgist and fire that pop instead, if it exists. to guarantee this.)

May also want to setup a 31 day cooldown for the AI (so that it always moves 1 job per month either way, if in deficit, to not have too large income swings).

I've also read that it might be "cleaner" to bury these modifiers in the planet capital building (so they appear in it's tooltip instead), rather than in the planet scope itself, that way the top bit above the city GFX wont be cluttered with factory icons on AI worlds - but that's a minor issue.

WIP SCRIPTS:
Static modifier I use:
Code:
add_fou_minus_art = {
    job_foundry_add = 1
    job_artisan_add = -1

}

add_art_minus_fou = {
    job_artisan_add = 1
    job_foundry_add = -1
}

Decision scripts
  • still considering best AI logic, and whether to use enactment time [planet linked] or country flags [empire wide check] for monthly delay on re-executing this decision - country flags dont seem to work quite right with how i have them set up below, probably wrong scope, need to dbl check,
  • or only letting it test this if there are at least X industrial districts.
  • Also considering the maths behind batched commands - testing income deficit (e.g. for CG), testing the "average output" of an artisan, dividing one by the other, taking the real number and using that as a counter for how many times in one month this can be run by an AI, effectively letting it bias jobs much faster than just once a month.
  • Am still testing this manually, but eventually I'll add a "for AI only" flag, to hide it from players (that can use disabling jobs instead).
Code:
#######################################
#### ADD ARTISAN MINUS FOUNDRY JOB ####
#######################################
decision_add_art_minus_fou = {
    owned_planets_only = yes
    sound = event_administrative_work
    icon = decision_resources

    # FREE
    resources = { category = decisions cost = { } }

    potential = { owner = { is_gestalt = no } }

    # DO WE HAVE FOUNDRY JOBS TO REMOVE?
    allow = {
        OR = {
            has_modifier = "add_fou_minus_art"                    # Can subtract +foundry modifier
            num_assigned_jobs = { job = "foundry" value >= 1 }    # Only look at filled artisan jobs, AI will waste time on empty ones
            #has_available_jobs = "foundry"                        # ^
        }
        NOT = { owner = { has_country_flag = has_used_bias_decision } }     # This is to force the AI to incrementally bias jobs, one at a time per month, so it doesnt cause huge siwngs.
    }

    # IF FOUNDRY MODIFIER EXISTS, KILL IT, OTHERWISE ADD CG MODIFIER
    effect = {
        # If the +foundry modifier exists, kill it first.
        if = { limit = { has_modifier = "add_fou_minus_art" }
            remove_modifier = "add_fou_minus_art"
            owner = { set_timed_country_flag = has_used_bias_decision days = 31 }            # Guarantee month roll-over / re-calc
            check_planet_employment = yes
        }
        #If no +foundry modifier exists add +artisan modifier.
        else = { #limit = { NOT = { has_modifier = "add_fou_minus_art" } }
            add_modifier = { modifier = "add_art_minus_fou" clear_on_owner_change = yes }     # Clear on owner change wipes these out - useful if a Non-CG nation siezes the world.
            owner = { set_timed_country_flag = has_used_bias_decision days = 31 }            # Guarantee month roll-over / re-calc
            check_planet_employment = yes
        }
    }

    ai_weight = {
        weight = 0
        modifier = {
            add = 1000
            has_monthly_income = { resource = consumer_goods  value < 0 } # If CGs < 0 use this
        }
    }

}

#######################################
#### ADD FOUNDRY MINUS ARTISAN JOB ####
#######################################
decision_add_fou_minus_art = {
    owned_planets_only = yes
    sound = event_administrative_work
    icon = decision_resources

    # FREE
    resources = { category = decisions cost = { } }

    potential = { owner = { is_gestalt = no } }

    # DO WE HAVE ARTISAN JOBS TO REMOVE?
    allow = {
        OR = {
            has_modifier = "add_art_minus_fou"                    # Can subtract +artisan modifier
            num_assigned_jobs = { job = "artisan" value >= 1 }    # Only look at filled artisan jobs, AI will waste time on empty ones
            #has_available_jobs = "artisan"                        # ^
        }
        NOT = { owner = { has_country_flag = has_used_bias_decision } }     # This is to force the AI to incrementally bias jobs, one at a time per month, so it doesnt cause huge siwngs.
    }

    # IF CG MODIFIER EXISTS, KILL IT, OTHERWISE ADD FOUNDRY MODIFIER
    effect = {
        # If the +artisan modifier exists, kill it first.
        if = { limit = { has_modifier = "add_art_minus_fou" }
            remove_modifier = "add_art_minus_fou"
            owner = { set_timed_country_flag = has_used_bias_decision days = 31 }            # Guarantee month roll-over / re-calc
            check_planet_employment = yes
        }
        #If no +artisan modifier exists add +foundry modifier.
        else = { #limit = { NOT = { has_modifier = "add_art_minus_fou" } }
            add_modifier = { modifier = "add_fou_minus_art" clear_on_owner_change = yes }     # Clear on owner change wipes these out - useful if a Non-CG nation siezes the world.
            owner = { set_timed_country_flag = has_used_bias_decision days = 31 }            # Guarantee month roll-over / re-calc
            check_planet_employment = yes
        }
    }

    ai_weight = {
        weight = 0
        modifier = {
            add = 1000
            has_monthly_income = { resource = alloys value =< 10 }    # if alloys <10 use this.
        }
    }

}
 
Last edited:
  • 3
  • 2Like
  • 1
Reactions:
Lets just rid ourselves of consumer goods. Gestalts don't need them so we already have the example energy cost. All empires use amenities so we absorb their purpose into that. then the bonus is we can better balance the empire types economically. we need to remove the means for the AI to tank its economy and we do that by simplifying it
That's obviously not going to happen, with how many mechanics and jobs are now tied to CGs, directly or indirectly, so it's not helping the situation.

The problem isn't cgs it's the lack of fuzzy logic needed to evaluate jobs on a partial basis, exacerbated by low pop growth/over-abundant districts.

The most efficient ais have always been ones that I modded to instant-grow all pops as empty jobs appear, reductively, this would bypass the many weaknesses in job allocation and trait evaluation scripts (this was a mod I created back in 2.6 to bypass daily job checks - if all pops grow in 1 day you suppress almost all job checks - that issue has since been patched).
 
  • 1
Reactions: