Results 1 to 13 of 13

Thread: Lower AI population growth

  1. #1
    Santana86's Avatar Libertus
    Join Date
    Mar 2011
    Location
    Norway, Tromsø
    Posts
    89

    Icon1 Lower AI population growth

    Hey guys, I was wondering if someone here could help me with a script or code that lowers the population growth of the AI by 1.5%?

    I have played TATW for 3 years now and I love the fact that settlements really take some investment to upgrade. I always play on VH and on this difficulty the AI gets a 2% bonus to population growth, that seems hardcoded into the difficulty. It has always annoyed me that the AI grows their settlements faster than you, even though you have perfected your governors.

    Therefore, I'm looking for a way to reduce population growth by 1.5%, but only for the ai factions.

    My first thought was to simply add this line to the 'core buildings' of my EDB, where the AI have all their other bonuses:
    Code:
    population_growth_bonus bonus -3 requires event_counter is_the_ai 1
    However, this did not work. Does anyone here have an idea about how I can implement this negative p.growth to the AI?

  2. #2

    Default Re: Lower AI population growth

    Hello. It seems to me that in the “export_descr_buildings.txt” doesn’t accept the negative bonus. You should check the "campaign_script.txt" looking for the commands "add_population" and adjust the ups and downs of population which makes the script.

    I think it's better to check first what kind of scripts have, before adding a new script.

  3. #3
    KEA's Avatar Senator
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    1,104

    Default Re: Lower AI population growth

    Quote Originally Posted by Miguel_80 View Post
    Hello. It seems to me that in the “export_descr_buildings.txt” doesn’t accept the negative bonus.
    Yes, negative boni can only nullify positive boni from other buildings.

  4. #4
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    47,561
    Blog Entries
    24

    Default Re: Lower AI population growth

    Originally Posted by KEA
    Yes, negative boni can only nullify positive boni from other buildings.



    Best way would be to have two lines in the core building entries:

    Code:
    population_growth_bonus bonus 3
    population_growth_bonus bonus -3 requires event_counter is_the_ai 1
    This way every faction gets 3 boni but the AI factions get a total of zero. Else give the local faction a positive bonus:

    Code:
    population_growth_bonus bonus 3 requires not event_counter is_the_ai 1
    The net effect is the same, but the second case i sneater.



  5. #5
    Santana86's Avatar Libertus
    Join Date
    Mar 2011
    Location
    Norway, Tromsø
    Posts
    89

    Default Re: Lower AI population growth

    Quote Originally Posted by Gigantus View Post
    Originally Posted by KEA
    Yes, negative boni can only nullify positive boni from other buildings.



    Best way would be to have two lines in the core building entries:

    Code:
    population_growth_bonus bonus 3
    population_growth_bonus bonus -3 requires event_counter is_the_ai 1
    This way every faction gets 3 boni but the AI factions get a total of zero. Else give the local faction a positive bonus:

    Code:
    population_growth_bonus bonus 3 requires not event_counter is_the_ai 1
    The net effect is the same, but the second case is neater.
    Thanks for your tip, Gigantus.

    However, I would prefer that neither the player or AI got any growth bonuses, just to make sure only a handful of cities/castles are upgraded all the way by late game. (With carefully grown governors)

    Would it be possible to add a 3-level squalor bonus instead for the AI? And if so, how would you code it in the EDB?

  6. #6
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    47,561
    Blog Entries
    24

    Default Re: Lower AI population growth

    1. Adjust conversion figures upward in descr_settlement_mechanics - make sure to add the same number to a set.

    Code:
       <population_levels>
            <!--city -->
            <level
                name = "village"
                base = "500"
                upgrade = "1000"
                min = "500"
                max = "1500"/>
            <level
                name = "town"
                base = "1000"
                upgrade = "3000"
                min = "500"
                max = "5000"/>
            <level
                name = "large_town"
                base = "3000"
                upgrade = "8000"
                min = "500"
                max = "12000"/>
            <level
                name = "city"
                base = "8000"
                upgrade = "15000"
                min = "500"
                max = "25000"/>
            <level
                name = "large_city"
                base = "15000"
                upgrade = "121000"
                min = "500"
                max = "120000"/>
            <level
                name = "huge_city"
                base = "121000"
                min = "500"
                max = "122000"/>
            <!--castle -->
            <level
                name = "moot_and_bailey"
                base = "500"
                upgrade = "1000"
                min = "500"
                max = "1500"/>
            <level
                name = "wooden_castle"
                base = "1000"
                upgrade = "2500"
                min = "500"
                max = "5000"/>
            <level
                name = "castle"
                base = "2500"
                upgrade = "7500"
                min = "500"
                max = "12000"/>
            <level
                name = "fortress"
                base = "7500"
                upgrade = "15000"
                min = "500"
                max = "25000"/>
            <level
                name = "citadel"
                base = "15000"
                min = "500"
                max = "50000"/>
        </population_levels>
    2. Reduce fertility numbers in descr_regions, delete map.rwm after that change:

    Code:
    Koenigreich_Boehmen
        legion: LBoehmen
        Prag
        spain
        German_Rebels
        219 39 204
        binnenost, kanal, horde_target
        5
        6
        religions { catholic 10 islam 0 orthodox 70 pagan 10 heretic 10 heide 0 }



  7. #7
    KEA's Avatar Senator
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    1,104

    Default Re: Lower AI population growth

    Quote Originally Posted by Santana86 View Post
    (With carefully grown governors)
    You could give governors of larger cities a (hidden) squalor malus.

  8. #8
    Santana86's Avatar Libertus
    Join Date
    Mar 2011
    Location
    Norway, Tromsø
    Posts
    89

    Default Re: Lower AI population growth

    Thanks again for your reply, though as mentioned in the first post I'm playing ThirdAgeTW, so these tips don't really apply. I'm looking for a way to nerf only the AI growth when playing on Very Hard.

    Quote Originally Posted by Gigantus View Post
    1. Adjust conversion figures upward in descr_settlement_mechanics - make sure to add the same number to a set.
    The upgrade requirements are already insanely high, to upgrade from city->large city you need a population of 26000. In addition, you only get 0.5% growth for every 7 points of chivalry, and all squalor-reducing traits have been nerfed or removed. Which basically means that you need a near-perfect governor in order to upgrade to a large city or fortress. (Takes me around 150 turns to upgrade a wooden castle into a fortress)

    Quote Originally Posted by Gigantus View Post
    2. Reduce fertility numbers in descr_regions, delete map.rwm after that change:
    The base farming in all regions are already set to 0 or 1 in TATW.

    I find that the growth rate is perfect as it is for the player. It takes at least 100+ turns to reach the highest settlement level with a good governor. However, when playing on Very Hard, the AI gets a 2% growth bonus hardcoded into the difficulty. This means that come late game, all their settlements have reached max level long ago. It is this bonus I want nerfed or countered somehow, without it affecting the player.

  9. #9
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    47,561
    Blog Entries
    24

    Default Re: Lower AI population growth

    However, when playing on Very Hard, the AI gets a 2% growth bonus hardcoded into the difficulty.
    That would require a small monitor in the script which fires an event. The event can then be used in the EDB to give an equivalent negative growth bonus for the AI.

    Train of thought:

    Script
    - test for playing level (CampaignDifficulty = very_hard)
    - and test for AI player
    - fire event

    EDB
    - negative growth requirement = event_counter [name] 1


    Result:

    Code:
    monitor_event FactionTurnStart not FactionIsLocal
            and CampaignDifficulty = very_hard
            set_event_counter AI_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and CampaignDifficulty = very_hard
            set_event_counter AI_growth 0
    end_monitor
    Code:
    population_growth_bonus bonus -2 requires factions { all, } and event_counter AI_growth 1
    Last edited by Gigantus; June 02, 2013 at 11:46 PM.



  10. #10

    Default Re: Lower AI population growth

    Quote Originally Posted by Gigantus View Post
    That would require a small monitor in the script which fires an event. The event can then be used in the EDB to give an equivalent negative growth bonus for the AI.
    Where would I put that script?

  11. #11
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    47,561
    Blog Entries
    24

    Default Re: Lower AI population growth

    The script (monitors) goes into the campaign_script file, put it right under the script line entry.

    The growth bonus entry goes into the EDB (export_descr_buildings) file in the capability sections of the core_building levels (castle and city).



  12. #12

    Default Re: Lower AI population growth

    Quote Originally Posted by Gigantus View Post
    That would require a small monitor in the script which fires an event. The event can then be used in the EDB to give an equivalent negative growth bonus for the AI.

    Train of thought:

    Script
    - test for playing level (CampaignDifficulty = very_hard)
    - and test for AI player
    - fire event

    EDB
    - negative growth requirement = event_counter [name] 1


    Result:

    Code:
    monitor_event FactionTurnStart not FactionIsLocal
            and CampaignDifficulty = very_hard
            set_event_counter AI_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and CampaignDifficulty = very_hard
            set_event_counter AI_growth 0
    end_monitor
    Code:
    population_growth_bonus bonus -2 requires factions { all, } and event_counter AI_growth 1

    Thats not working.... after several tests that i made every time that "faction is local" the counter "AI_growth" resets for the AI too and he gets the bonus...
    the only way i found to remove the special bonus for the ai is that

    into the campaign_script file,
    Code:
      ;;;;;;;;;;; Growth script ;;;;;;;;;;;;;;;;;
    
    declare_counter AI_growth
    declare_counter byzantium_growth
    declare_counter egypt_growth
    declare_counter france_growth
    declare_counter papal_growth
    declare_counter sicily_growth
    declare_counter turks_growth
    declare_counter damascus_growth
    declare_counter venice_growth
    declare_counter russia_growth
    declare_counter moors_growth
    declare_counter mongols_growth
    declare_counter timurids_growth
    declare_counter tuareg_growth
    declare_counter azumi_growth
    declare_counter cilicia_growth
    declare_counter hungary_growth
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled byzantium    
            set_event_counter byzantium_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled byzantium    
            set_event_counter byzantium_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled egypt    
            set_event_counter egypt_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled egypt    
            set_event_counter egypt_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled france    
            set_event_counter france_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled france    
            set_event_counter france_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled papal_states    
            set_event_counter papal_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled papal_states    
            set_event_counter papal_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled sicily    
            set_event_counter sicily_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled sicily    
            set_event_counter sicily_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled turks    
            set_event_counter turks_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled turks
            set_event_counter turks_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled damascus    
            set_event_counter damascus_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled damascus    
            set_event_counter damascus_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled venice    
            set_event_counter venice_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled venice    
            set_event_counter venice_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled russia    
            set_event_counter russia_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled russia    
            set_event_counter russia_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled venice    
            set_event_counter moors_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled moors    
            set_event_counter moors_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled moors    
            set_event_counter moors_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled mongols    
            set_event_counter mongols_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled mongols    
            set_event_counter mongols_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled mongols    
            set_event_counter mongols_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled timurids    
            set_event_counter timurids_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled timurids    
            set_event_counter timurids_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled tuareg    
            set_event_counter tuareg_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled tuareg    
            set_event_counter tuareg_growth 1
    end_monitor
    
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled azumi    
            set_event_counter azumi_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled azumi    
            set_event_counter azumi_growth 1
    end_monitor
    
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled cilicia    
            set_event_counter cilicia_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled cilicia    
            set_event_counter cilicia_growth 1
    end_monitor
    
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_IsFactionAIControlled hungary    
            set_event_counter hungary_growth 1
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            and I_IsFactionAIControlled hungary    
            set_event_counter hungary_growth 1
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
            set_event_counter AI_growth 2
    end_monitor
    
    monitor_event FactionTurnStart not FactionIsLocal
            set_event_counter AI_growth 2
    end_monitor
    into the export_descr_buildings for every capability sections of the core_building levels

    Code:
            castle castle requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } 
            {
                convert_to 1
                capability
                {                
                    wall_level 2
                    tower_level 1
                    gate_strength 1
                    gate_defences 2
                    law_bonus bonus 3
                    recruitment_slots 3 requires factions { northern_european, aztecs, middle_eastern, eastern_european, greek, southern_european, } 
                    free_upkeep bonus 4
                    population_growth_bonus bonus -4 requires factions { byzantium, } and event_counter byzantium_growth 1  
                    population_growth_bonus bonus -4 requires factions { egypt, } and event_counter egypt_growth 1  
                    population_growth_bonus bonus -4 requires factions {  france, } and event_counter  france_growth 1  
                    population_growth_bonus bonus -4 requires factions { papal_states, } and event_counter papal_growth 1 
                    population_growth_bonus bonus -4 requires factions { sicily, } and event_counter sicily_growth 1                 
                    population_growth_bonus bonus -4 requires factions { turks, } and event_counter turks_growth 1     
                    population_growth_bonus bonus -4 requires factions { damascus, } and event_counter damascus_growth 1  
                    population_growth_bonus bonus -4 requires factions { venice, } and event_counter venice_growth 1  
                    population_growth_bonus bonus -4 requires factions { russia, } and event_counter russia_growth 1  
                    population_growth_bonus bonus -4 requires factions { moors, } and event_counter moors_growth 1  
                    population_growth_bonus bonus -4 requires factions { mongols, } and event_counter mongols_growth 1  
                    population_growth_bonus bonus -4 requires factions { timurids, } and event_counter timurids_growth 1  
                    population_growth_bonus bonus -4 requires factions { tuareg, } and event_counter tuareg_growth 1  
                    population_growth_bonus bonus -4 requires factions { azumi, } and event_counter azumi_growth 1  
                    population_growth_bonus bonus -4 requires factions { cilicia, } and event_counter cilicia_growth 1  
                    population_growth_bonus bonus -4 requires factions { hungary, } and event_counter hungary_growth 1 
                    population_growth_bonus bonus -4 requires factions { all, } and event_counter AI_growth 2

  13. #13
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    47,561
    Blog Entries
    24

    Default Re: Lower AI population growth

    Thats not working.... after several tests that i made every time that "faction is local" the counter "AI_growth" resets for the AI too and he gets the bonus.
    Unlikely - the moment a AI faction's turn starts the event counter gets set to 1 (first monitor)
    The moment the player's turn starts the counter gets set to zero (second monitor)

    You have effectively tried doing exactly the same, just way more complicated, but have run foul of the EDB event_counter rule - 'event_counter' only works with 1 in the EDB. Plus you should simply terminate the monitors after running them the first time.

    Here is an abbreviated version of your approach:
    Code:
    monitor_event FactionTurnStart TrueCondition
        if I_IsFactionAIControlled england            ; check if faction is AI controlled
            set_event_counter england_growth 1        ; set counter to 1
        end_if
            if I_IsFactionAIControlled france
            set_event_counter france_growth 1
        end_if
        
        ; repeat for all factions
        
        terminate_monitor
    end_monitor
    
    --- EDB capability -----
    
    population_growth_bonus bonus -4 requires factions { byzantium, } and event_counter england_growth 1
    population_growth_bonus bonus -4 requires factions { byzantium, } and event_counter france_growth 1
    
    ; repeat for all factions
    This means the only faction that does not get the penalty of -4 (minus four) growth bonus will be the player's faction.

    Note: you do not need to declare event_counters. You actually declared regular counters with the same name as the event_counters which might lead to issues.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •