1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Artificial Unintelligence BE Lite

Discussion in 'CivBE - Released Mods' started by Delnar_Ersike, Jan 26, 2015.

  1. Delnar_Ersike

    Delnar_Ersike Chieftain

    Joined:
    Jan 1, 2007
    Messages:
    497
    Location:
    localhost
    Artificial Unintelligence Lite for Beyond Earth
    Latest version: v3, released 2015-08-15

    Workshop Link

    Thanks to the recent Beyond Earth Free Weekend, I was able to access the Beyond Earth SDK and assemble a Beyond Earth port of the lite version of my Civ5 AI mod, Artificial Unintelligence, as well as upload it to the Steam Workshop. The mod contains XML changes exclusively, so it should be maximally compatible with all other mods.

    Individual flavor values for units, buildings, and sponsors/leaders were left unchanged, seeing as their "ideal" values are highly subjective. Plus, a lot of other mods tinker with flavor values, so not relying on flavor value changes helps ensure maximum compatibility.

    For those unfamiliar with the mod, Artificial Unintelligence improves Beyond Earth's Artificial Intelligence (Computer Players). Nothing more, nothing less.

    Although the mod is a bit bare-bones, the improved AI is immediately noticeable: on regular difficulty, it will actually be able to wage proper wars, research techs faster without compromising other areas of its empire, and only ever fall into money deficit issues if it has health issues (sadly, because the AI was not altered from Civ5 to account for the reshuffled happiness sources in Beyond Earth, it will unavoidably have health problems).
    There are still quite a few problematic areas however, such as promotion management, voting, city placement, and unit management; these aspects require access to the game DLL's C++ code, as XML modifications can get you only so far, and Lua injections only let you add features to the game, not change or remove existing ones.
    However, the result is still a much better AI, which, although not without faults, can put up a much better fight without having to rely on bonuses.

    Should any official DLC's or Expansion be released, the mod has been designed to work with or without any and all of them, though it is possible that Firaxis gets their act together and actually fix the AI on the C++ side of things, in which case it's possible that certain modifications will cause problems. The mod should also be compatible with mods that do not alter existing AI strategies, as well as any DLL-based mods in the future.

    Version Changelog:
    Spoiler :
    v3 - 2015-08-15:
    • Fixed various bugs that caused changes to not load.
    • All City, Economic, and Military strategies are checked for every turn
    • Strategies related to whether the AI needs scouts or has enough scouts are checked for on the very first turn
    • Automatic Citizen Management's yield values for Food/Production/Energy/Science/Culture/Faith are now 20/16/5/11/10/9 (from 14/12/8/7/15/5); CivBE doesn't have Faith, but I changed the multiplier nevertheless
    • Plot settling yield multipliers now match automatic citizen management's yield values (from 15/3/3/1/NA/1)

    v2 - 2015-01-18:
    • The AI will now check whether to execute the following city strategies every turn: Need Trade Building (from every 50 turns), High Intrigue (from every 50 turns), Critical Intrigue (from every 50 turns), Spread Miasma (from every 50 turns), Need City Defense (from every 100 turns)

    v1 - 2015-01-16:
    • Initial Release on Beyond Earth Workshop

    List of Civ5 XML Changes Ported Over:
    Spoiler :
    • City strategy "Want Tile Improvers" has a threshold of 33 (from 40)
    • City strategy "Have Training Facility" alters flavors for tile improvement, expansion, growth, and happiness by -1 (from -3)
    • City Strategy "Capital Under Threat" alters Defense flavor by +35 (from +25)
    • Expansion flavor +5 in the AI's original capital
    • Economic strategies "Expand Like Crazy" and "Grow Like Crazy" give +75 Expansion and +75 Growth flavors respectively by (from +10)
    • Economic Strategy "Losing Money" now alters Energy flavor by +40 (from +25), Mobile flavor by -10, Ranged flavor by -10, and Naval flavor by -10
    • Economic Strategy "Losing Money" now checks and can trigger every turn (from 5 turns)
    • Economic Strategy "Early Expansion" now alters Defense flavor by +10
    • Economic strategy for Conquest Grand Strategy alters Air flavor by +10 (from +5), Mobile flavor by +5, and Energy flavor by +5 (to pay for unit upkeep)
    • Increased the effect grand strategies' primary flavor has on the AI choosing said grand strategy to 10 (from 9) for Conquest
    • Increased the influence of Grand Strategies on certain City Specializations: Conquest increases Energy specialization weight by 50, Diplomacy and Culture increases Science specialization weight by 50, Spaceship increases Food specialization (ie. Settler Pump) weight by 50
    • AI Conquest Grand Strategy's flavor effects added or altered: Offense by +3 (from +2), Expansion by +2 (from +1), Military Training by +2 (from +1), Air by +2 (from +1), Nukes by +6 (from +1), Mobile by +2, Defense by +1, Naval by +1, and Water Connection by +3
    • Commerce City Specialization alters Production flavor by +20 (from +10) and Growth flavor by +30 (from +20)
    • Science City Specialization alters Production flavor by +20 (from +10)
    • General Economic City Specialization alters Production flavor by +25 (from +20), Growth flavor by +30 (from +20), and Culture flavor by +20 (from +30)
    • Target energy and science yields per citizen increased by 0.3 and 0.5 respectively for the following city specializations: General Economic (now 0.3/0.5), Military Training (now 0.3/0.5), Military Naval (now 0.3/0.5), Commerce (now 1.3/0.5), and Science (now 0.3/1.5). Target food and production yields per citizen remain unchanged.
    • Modified Multi-Unit Formation settings to 1) allow for more flexibility between ranged and siege units, 2) allow for smaller task forces, 3) allow certain land task forces to also contain a single naval unit, 4) no longer have the AI place melee units into "slots" meant for ranged units, and 5) force fast-moving task forces (eg. Fast Pillagers) to only contain fast-moving units
    • Minimum Personality score now set to 1 (from 0) to fix possible divide-by-zero situations in the DLL code leading to wonky AI behavior
    • The AI will consider rushing items that take over 5 turns to build (from over 15 turns to build)
    • The AI places an extra 15 priority on techs that unlock unique units/buildings/improvements (from extra 5 priority)
    • The AI is a lot less schizophrenic when it comes to grand strategies: it will keep Grand Strategy directions active for at least 20 turns (from 10 turns), and during Grand Strategy rerolls, it will give each Grand Strategy a random extra priority up to +12 (from +50)
    • Grand Strategy rerolls do not force the AI to switch to less desirable options: other players' grand strategies multiply a certain grand strategy's weight by up to 10 (from up to 50) during AI rerolls.
    • Reroll weight modifiers for the Conquest Grand Strategy have been adjusted as follows: being at war gives +20 (from +10), nobody met gives -25 (from -50), and conquered civilizations give +50 each (from +15 each). To compensate for possible overaggression, power ratio for Conquest Grand Strategy weight is multiplied by 125 (from 100).
    • Reroll weight modifier on the Conquest Grand Strategy for having met nobody now activates 40 turns in (from 20), but gives -100 (from -50)
    • Early AI expansion baseline set to 6 cities (from 8).
    • Plot value for strategic resources increased by +80 (from +50, the bonus is now double a luxury resource's plot value bonus)
    • Fierce land dispute increases plot value by +8 (from +6)
    • 250 Energy priority given to buying plots (from 275), but buying requirement is halved when treasury has contains over 500 energy (from 1000 energy)
    • Diplomacy has 50 Energy base priority each (from 150) and Defensive buildings have 250 Energy base priority (from 400), while Upgrades have 200 Energy base priority (from 150)
    • Worker plot evaluation when removing features is multiplied by 6/6/3/4/4 based on food, production, gold, science, and culture yields respectively (from 2/2/1/1/1)
    • Military threat weights for Minor/Major/Severe/Critical are now 1/3/9/27 (from 1/3/6/10)
    • Minimum units the AI desires to defend lands now increases by 1.5 per city (from 1.0 per city), allowing a unit to patrol between two cities to defend against barbarians
    • City specializations are rerolled every 4 turns (from 50)
    • City specialization reroll weight modifiers have been modified as follows: food specialization weights alter by -25 per number of cities (from -50), production weights alter by +1 for building the next wonder (from +0.2), science specialization weight alters by +40 for science flavor (from +20)
    • City categorization thresholds altered: medium is now 6 population (from 5), large is now 15 population (from 12)
    • Negative energy income alters target energy yield per citizen by +0.5 (from +0)
    • Strategies related to whether the AI needs scouts or has enough scouts are checked for on the very first turn
    • Automatic Citizen Management's yield values for Food/Production/Energy/Science/Culture/Faith are now 20/16/5/11/10/9 (from 14/12/8/7/15/5); CivBE doesn't have Faith, but I changed the multiplier nevertheless
    • Plot settling yield multipliers now match automatic citizen management's yield values (from 15/3/3/1/NA/1)
    • AI's now recruit units within 6 tiles for City Attack operations (from 5 tiles), but only 3 tiles for Tactical Pillage operations (from 5 tiles). Up to 6 turns can be spent recruiting units for operations (from up to 5 turns), up to 12 turns in case of operations in enemy territory (from up to 10 turns)
    • Forward Muster commands are considered at 25% danger or less (from 20% or less)
    • When evaluating the AI tactical map, unit strength is multiplied by 20 (from 10); a zone is considered dominant at 40% ownership (from 25% ownership)
    • Tactical move priority randomness range is now 3 (from 6); homeland tactical move priority randomness range is now 5 (from 10)
    • Max turns to move for homeland defense is now 3 (from 4). This doesn't stop the AI from defending its homeland, but instead forces it to use units that don't have to travel as far.
    • Diplomatic weights for Weak/Strong/Fierce land disputes are now 1/3/9 (from 1/3/5)
    • Danger values for diplomatic approaches have been altered as follows: Deceptive is 0.4 (from 0.1), Hostile is 0.8 (from 0.2), Bully is 0.8 (from 0.9)
    • Annexation thresholds set to 0.35 for normal (from 0.5) and 0.7 for aggressive (from 0.75)
    • Diplomatic Opinion modifier based on no/weak/strong/fierce land disputes set to -1/5/25/125 (from -6/10/20/30)
    • Diplomatic Opinion modifier based on no/weak/strong/fierce victory disputes set to -1/5/25/125 (from -6/10/20/30)
    • Diplomatic Opinion modifier based on no/weak/strong/fierce wonder disputes set to 0/5/10/20 (from 0/10/15/20)
    • Diplomatic Opinion modifier based on no/weak/strong/fierce minor civ disputes set to 0/4/16/64 (from 0/10/20/30)
    • Opinion Threshold to possibly declare war if current Grand Strategy is Conquest set to 10 (from 50)
    • War evaluation if not prepared set to -150 (from -100)
    • War evaluation for game threats none/minor/major/severe/critical set to 10/25/75/150/300 (from 0/20/50/100/150)
    • War evaluation based on soft/favorable/average/bad/impossible target set to 200/100/-25/-150/-300 (from 100/50/-25/-100/-200)
    • Thresholds for observations of aggressiveness levels low/medium/high/incredibly set to 5/15/25/35 (from 10/25/50/80)
    • Military and Economic strength ratio multipliers for diplomatic/war evaluation set to 125 and 110 respectively (from 100 each)
    • Barbarian "Capture City" tactical move's priority is now 11 (from 9, placing it above Blockade Resource, Attrition, and Move to Safety for barbarians)
    • "Move to Safety" tactical move's priority is now 20 (from 11, placing it above Pillage Resource, Attrition, and Damage City)
    • "Damage City" tactical move's priority is now 11 (from 15, making it possibly exchangeable with Heal and Low Priority Attrition once randomness factor is taken acount)
    • "Heal" tactical move's priority is now 10 (from 8, placing it above Park on Trade Route and equal to Low Priority Attrition)
    • "Low Priority Attrition" tactical move's priority is now 11 (from 12)
    • "Barbarian Camp" tactical move's priority is now 13 (from 11)
    • Base war preference against City States when running a Conquest Grand Strategy is now 5 (from 8), but 20 when they're also neighbors (from 10)
    • War preference against City States who are neighbors is now 2 (from 1)
    • War preference against City States based on Impossible/Bad/Average/Favorable/Soft target is now 0/10/50/100/150 (from 10/20/40/110/130)
    • "Area is full" threshold is now at 80% tile ownership (from 50%)
    • 19 empty tiles are required for the early expansion strategy now (from 25 tiles)
    • Units executing the following tactical moves can now be recruited into operations: Pillage, Safe Bombard, Bastion, Garrison, Guard Improvement

    List of Beyond Earth-specific XML Changes:
    Spoiler :
    • Fixed Rocktopus not having any available UnitAITypes
    • All affinity units now have the Counter UnitAIType (BE doesn't have counter-type units, but the MultiUnitFormations file it uses still looks for them)
    • Worker improvement evaluation now assigns 1 score per culture generated by the improvement to the score evaluation (from 100)
    • All City, Economic, and Military strategies are checked for every turn. Examples of previous intervals for strategy checks: Need Trade Building (from every 50 turns), High Intrigue (from every 50 turns), Critical Intrigue (from every 50 turns), Spread Miasma (from every 50 turns), Need City Defense (from every 100 turns)

    A complete changelog is also available in the mod's folder (browse to it via My Games\Sid Meier's Beyond Earth\MODS\Artificial Unintelligence BE Lite).

    If you wish to look into Beyond Earth's AI and my improvements, the XML parameter tweaks are each in files named after the original file they came from. Most changes were commented for clarity about 3 months ago, but I have since gained a lot of knowledge about how the Civ5 (and probably BE as well) DLL uses XML values, so feel free to ask questions about any AI-related XML values.
     
  2. Delnar_Ersike

    Delnar_Ersike Chieftain

    Joined:
    Jan 1, 2007
    Messages:
    497
    Location:
    localhost
    Reserved
     
  3. edingess

    edingess Chieftain

    Joined:
    Jul 21, 2009
    Messages:
    215
    Whoooooooo!:D
     
  4. Gorbles

    Gorbles Load Balanced

    Joined:
    Nov 24, 2014
    Messages:
    1,826
    Location:
    UK
    Impressive work, great job! I'd give this a try straightaway if I still wasn't struggling through the vanilla difficulties . . .

    Does this alter in any way the bonuses the AI get per AI tier?
     
  5. Delnar_Ersike

    Delnar_Ersike Chieftain

    Joined:
    Jan 1, 2007
    Messages:
    497
    Location:
    localhost
    AI bonuses are left unaltered, since 1) they are also quite subjective (some people may think a certain bonus is too powerful, while others might think it's nearly useless) and 2) I hate AI bonuses that are actual gameplay boosts instead of knowledge cheats (the AI knowing more about the game than the player), since I view them as a lazy solution for poor AI design; knowledge cheats, on the other hand, often save on computational time, since the AI can just analyze actual gameplay values instead of having to work with guesses that need constant recalculation.
     
  6. Ampharos

    Ampharos Chieftain

    Joined:
    Aug 15, 2014
    Messages:
    28
    Location:
    New Jersey
    I have a question for you.

    You set the AI expansion baseline to 6 from 8. Does this mean how many cities the AI will attempt to build, and, if so, why did you choose this?

    My understanding of the game is that 7-8 is the target amount, even 10 if you micromanage properly and target Health-related affinities and buildings. Beyond Earth seems more about building wide than building tall, so wouldn't this hinder the AI?

    Thanks in advance.

    I'm looking for ways to improve the AI, and your work has helped me a lot in this.
     
  7. lilgamefreek

    lilgamefreek Chieftain

    Joined:
    Oct 30, 2014
    Messages:
    229
    The numerical values are a sliding scale of 1-10 on how aggressively the AI will pursue that particular action/flavor. So it's less how many cities will the AI build and more the likely rate the AI will build. If the AI has a build option (say a colonist) with a flavor_expansion value of 50 and a building (say trade depot) with a flavor_energy value of 50, and the leader's own flavor is expansion 6 and energy 7, than the leader will be more likely to build the trade depot than the colonist (though not always). Civ5 further randomly varied the baseline values of the AI by up to 2 in either direction, so that each time you played against shaka, he wouldn't be a total prick (except he was because his flavor_melee was set to 12).
     
  8. Delnar_Ersike

    Delnar_Ersike Chieftain

    Joined:
    Jan 1, 2007
    Messages:
    497
    Location:
    localhost
    Baseline expansion cities is not a flavor though: it's the default "how many cities do I want" number that is used by the "Early Expand" (or something similar) Economic strategy, which is basically the only way the AI will ever build colonists early on. Therefore the target of 6 only applies to earlygame expansion, which is even more health/happiness-limited in CivBE than in Civ5.
    This baseline number gets modified by all sorts of values: it gets multiplied by the ratio of the civ's individual expansion-to-growth flavor ratio, as well as values that adjust for map size.
    Note, however, that the strategy does not run if the AI civ is unhealthy or if more than 80% of the AI's starting continent's tiles are owned (this was 50% before, which meant it got turned off way too soon).

    Do note that the mod does have a bug-ish due to my ignorance that I cannot fix: I did not know that XML mods need OnModActivated triggers set up, so I do not know how much of the mod's XML changes are actually used. Since I do not own CivBE, I do not have access to its SDK, so I cannot upload changes to the mod. The only reason I got to upload the mod at all was because of the CivBE free weekend that unlocked the CivBE SDK as well.
     
  9. lilgamefreek

    lilgamefreek Chieftain

    Joined:
    Oct 30, 2014
    Messages:
    229
    Oh my bad. I thought he was talking about the expansion flavor! Shows how much I have to learn still!
     
  10. Minor Annoyance

    Minor Annoyance Chieftain

    Joined:
    Jun 27, 2007
    Messages:
    2,247
    Gender:
    Male
    Location:
    Hamilton, Ontario
    Possibly none of the changes are used. Anytime I've forgotten to do the OnModActicated trigger it's like the mod doesn't exist.
     
  11. Delnar_Ersike

    Delnar_Ersike Chieftain

    Joined:
    Jan 1, 2007
    Messages:
    497
    Location:
    localhost
    I took advantage of the 2nd CivBE free weekend in mid-August to upload a version that fixes all known issues with this mod as well as implements a few changes that I have developed since the last time I updated this mod. All changes should now load properly.

    Sorry I only updated this thread just now, but I kind of forgot about it... :p
     

Share This Page