Better BUG AI

Fimbulvetr

Emperor
Joined
Nov 5, 2009
Messages
1,267
Location
Austria
Better BUG AI is what I call my merged mod consisting only of Better BTS AI + BULL + BUG

This combination of jdog5000's AI improvement mod Better BTS AI and EmperorFool&co.'s interface improvement mod BTS Unaltered Gameplay is the most advanced/refined/bestest mod (afaik;)) that does not change game rules (or at least tries to, for the most part) - which is where it differs from the PIG mod.


If there are bug fixes or AI improvement components (or even just ideas, as long as they are specific enough) that are not (yet) part of Better BTS AI,
which I should consider adding, then please let me know, all suggestions are welcome. As are simple bug reports, though they probably belong to Better BTS AI or BUG subforums directly.
I will not touch any python code, ever, so requesting/suggesting python changes here is useless, you'll need to bug the BUG team for that.

Last Update: 2010-09-26 (browse SVN)


Download: (3.75MB)
@ Mediafire (folder with the most up-to-date packages)
@ Sourceforge (bullai files section, might not always have the most recent compiles)
---
Installation: Run the installer.
(Extracting the contents with 7zip works too if you know what you're doing.)
* If you want, get the images for Events With Images and extract to Better BUG AI\Assets\Art\EventImages\ .
---
--
-
Combining this mod with BAT 2.3:
1. Install BAT
2. Copy Better BUG AI's Assets over to BAT, overwrite.
3. Extract the merged files from this zip to BAT, overwrite.
- [ thread in BUG Project subforum ]
-------------------------------------------------------------
For Blue Marble look here.



Components:
Better BTS AI 1.02a r597
* AI Logging
BULL 1.3 r219
* Fractional Trade Routes
* New Sentry Actions
* City Governours Build Workers
BUG 4.5 r2245

-------------------------------------------------------------
my own changes:
  • CityAI:
    • The AI no longer considers unhealthy buildings that would make the city shrink, and also factors in future unheathiness from power when evaluating buildings that would recieve a bonus from power.
    • Happy/Health valuation for buildings and improvements are sightly changed.
    • The AI should build a bit more workers.
    • Worker AI: hopefully there is now less improvement oscillation between forest preserve and lumbermills, and less hamlets/villages/towns get turned to workshops.
    • Considering currently constructed building and checking Health level against happy level for the BULL feature 'Health Effects from Removing Features'.
  • PlayerAI:
    • Using a sightly different valuation of siege units for UNITAI_ATTACK_CITY.
    • Chance of nuclear plants to blow up and global warming chance scale to gamespeed.
  • other:
    • Minimum total production modifiers is still 0% here (UP/BetterAI changed it to -50%).
    • Features with AppearanceProbability of 10000 will be replaced after destruction of city, even if not riverside.
    • xml changes:
      • GlobalsDefinesAlt.xml: Global Warming implementation still sucks, noone wrote any huge and all-new Global Warming/Nuclear Winter mod that satisfies me, but I still reenabled Global Warming from nukes - because nuclear warfare needs to have some drawbacks. You can still turn it off yourself of course.
      • CIV4UnitInfos.xml: changed iPower for Catapult(5->6), Cannon(12->14), Artillery(18->19) and MobileArtillery(26->28) because they seem to better account for the actual military strength of these units. (Does not affect AI unit building behaviour).
      • CIV4UnitInfos.xml: SAM Infantry is now available as an upgrade to the Grenadier (previously Infantry) - to avoid massive upgrading of riflemen to SAM when the AI hits Rocketery before Assembly line.
        Spoiler :

        It's a game rule change, I know, but I couldn't think of any other way to react to what was reported in the 1 game 4 suicides thread.

SVN:
BULLAI @ scourceforge
Spoiler :
first Better BUG AI: http://forums.civfanatics.com/showthread.php?p=8657114#post8657114

2010-02-13 version was revision 15
2010-02-17 version was revision 23
2010-02-18 version was revision 25
2010-02-19 version was revision 31
2010-02-20 version was revision 35
2010-02-25 version was revision 39
2010-03-05 version was revision 42
2010-03-06 version was revision 44
2010-03-09 version was revision 47
2010-03-26 version was revision 55
2010-03-29 version was revision 62
2010-03-31 version was revision 63
2010-04-11 version was revision 64
2010-04-12 version was revision 65
2010-04-23 version was revision 69
2010-05-03 version was revision 70
2010-05-05 version was revision 71
2010-05-13 version was revision 72
2010-05-16 version was revision 74
2010-05-17 version was revision 80
2010-05-20 version was revision 83
2010-05-26 version was revision 87
2010-06-10 version was revision 96
2010-06-16 version was revision 97
2010-07-01 version was revision 98
2010-07-08 version was revision 99
2010-07-25 version esd revision 101

2010-09-26 version is revision 117

.
 

Attachments

  • SAM_Infantry-new_upgrade_path.jpg
    SAM_Infantry-new_upgrade_path.jpg
    33.8 KB · Views: 38,211
  • Better_BUG_AI-logo1.jpg
    Better_BUG_AI-logo1.jpg
    11.6 KB · Views: 33,901
Last edited by a moderator:
TODO:

  • Comment properly (with walls of ********************s)
  • Find, evaluate and then incorporate fixes from
    • the Unofficial Patch thread or Better AI subforum
      • more gamespeed scaling (done: Nuclear Plants blowing up, Global Warming, Production decay (EF))
      • leave floodplains, remove fallout on settling a city without special casing either floodplains are removed on settling, and replaced when the city is razed
      • for settling on water tiles always use canFoundCitiesOnWater callback if it is enabled (done, thx jdog&EF)
      • No "You traded with our Worst Enemy" Diplo hit from civs you didn't meet yet (done, thx Sephi)
      • allow bombardment of enemy forts on unowned land
      • Show own war plans (done)
      • fix AI_doEnemyUnitData() (done)
    • other mod(component)s
      • MongooseSDK (by LunarMongoose)
        • BarbarianPassiveTechFix (done)
        • considering GreatPersonFix (missing fix to not break savegames)
        • building value from free promotion(s?) (Afforess)
        • building value from unit prereq (Afforess)
        • Legends of Revolution - Push GG to join Legendary Units
        • ? Workers can still connect resources even if destroying pre-existing improvements is not allowed (Afforess)
  • Improve AI decision making for
    • what buildings to build
      • don't shrink cities (done)
      • allow shrinking if lost pop is not important (done)
      • consider AP and state religion bonus yield/commerce (done)
    • what units to build
      • make Warriors buildable for early game city defense (done)
    • what improments to build
    • where to settle (how? ideas: increase iGreed when alone on a continent, reduce value of tiles that are already inside the range of another city, maybe make settler movement possible when player has no city yet (turn 0))
  • create an installer (done, thx phungus)
  • Change credits page to reflect that this is not just BUG

fix HappinessWeight for civics
change CONQUEST4 conditions

UnitAI:
? Are units that can't defend retreating to doomed cities?

status explanation:
* gray: already became a part of Better AI or BULL
* done: it is already in a release
* committed: it is in the SVN but not released in a rar yet
* written: it's part of the code on my computer but I didn't commit to SVN yet
 
I came to this forum looking for Better AI + Bug then having the hassle of finding and re-learning how to merge them, then this came along! =) thank you.
 
New version: 2010-02-19 (Mediafire only for now)
BUG updated to r2156
BarbarianPassiveTechFix from MongooseSDK
No diplo hits from trading with someone's Worst Enemy if you haven't met that someone yet by Sephi
other SDK changes noone will care about: FloodplainsFix and handling of canFoundCitiesOnWater callback are updated, Global Warning and Nuclear Winter chances now scale by gamespeed, Global Warming Defence (from Forests, Jungle) doesn't help you against Nuclear Winters anymore. (Note that the Global Warming Mod is off in the dlls I compile so there will be no NW unless you compile yourself)
 
Very tiny update:
Yesterday the PerfectWorld2 mapscript was broken. I fixed not only that but also finished figuring out why the starting postition sweetening didn't work the way I wanted and changed it all to my liking.
+2 more BUG revisions.

This one should be good, no more daily releases for a while, I promise :p

edit: I broke the mapscript again!
 
CIV4UnitInfos.xml: SAM Infantry is now available as an upgrade to the Grenadier (previously Infantry) - to avoid massive upgrading of riflemen to SAM when the AI hits Rocketery before Assembly line.
So it was you who made that change. lol, last time I was merging some code I couldn't figure out where I'd seen that or when I'd made that change for PIG. I kinda understood the reasoning behind it though, and I agree with the change overall.

I am hoping there are no issues with AIs now having too few sam infantry? :lol: I am not sure if it was a problem before for AIs upgrading infantry to SAM infantry (I think they cost 5:hammers: more so it's a cheap upgrade).

On the change to preventing "shrinkage", what happens if you hit an AI with espionage mission Poison Water and maybe bomb some health resources? Is the AI going to abandon all factories and power plants etc? Sometimes it may not be the best move to avoid shrinkage at all costs. Another example would be if AI civs have a "golden age" of health, growing cities to very large sizes. Afterwards, you hit them with some health problems (maybe you force them to leave Environmentalism civic), bomb some resources, and then espionage kill their factories etc. and watch them desperately try to keep some large unsustainable cities. Maybe beyond size 20 or so the AI should care less about trying to prevent shrinkage at all costs?

Just some thoughts...
 
It was a necessary change, I couldn't even think of an AI logic change that would eliminate that problem, let alone code it. So it has to be this -_-

Too few SAM Infantry? Not very likely lol
If the AI gets Rocketery before Assembly line it can't upgrade rifles anymore, but it will start building SAM Infantry as defenders, almost exclusively.
The AI never upgrades Infantry to SAM I think, it checks if the upgrade actually has a positive effect after all (if multiple positive options are available, it chooses the best*)


Unhealth from espionage is ignored for the shrink check, don't worry. If you manage to take away resources then yes, the AI will react to that, even without my new code. That code is only a hack which adresses the stock AI's inability to correctly recognize this kind of negative effect of buildings by disabling active shrinking completely.
It is still a hack though, not a real evaluation of pros and contras.
However, I have already written new code for correcter handling of unhealth/unhappy building sideeffects, I'm just not sure how well it would work in practice (completely untested). You are right in general, it is theoretically possible that for a city with neither happy cap nor food problems running lots of specialists, that a building that causes shrinking could still be benificial, very good point.
That would work already, even without better unhealth evaluation, all you need to do is find my anti-shrink code and replace
Code:
int iAllowedShrinkRate = 0;
with
Code:
iAllowedShrinkRate = visiblePopulation()*GC.getFOOD_CONSUMPTION_P[I]ER_PO[/I]PULATION();
 
revision 36: the AI will no longer avoid shrinking at all costs at all times: Angry Citicens, weak specialists and population working bad tiles are expendable.

So few lines, yet it took me so long :crazyeye:
 
If I have BAT installed (to 2.1.1a), can I merge Better BUG AI into it (because I don't know which files should be overwritten and which should not!)?

Thanks!
 
I don't think Better BUG AI overwrites anything the BAT Mod needs with something that isn't at least equivalent.
I can give no 100% guarantees but simply taking everything from my mod and overwriting everything there in the process worked at least for me, as far as I can tell.
I do have BAT in a Mod folder though, so overwriting was a matter of one single drag&drop and click. Not sure if CustomAssets installs needs some special treatments, like finding out where to put the gamesetupcheck folder but I'm sure the BUG team could help you with that.
 
Thank you, Fuyu.

BAT automatically writes to the My Games folder instead of the Program Files\Firaxis folder. That's easy enough for me, but the thing that confuses me is their install program also created a seperate BUG Mod folder which has the Info UserSettings and GameSetUp Check folders. For your mod, it's all in the same folder. Wierd. :crazyeye:

I'll have to go bug the BUG team. :lol:
 
Actually no you don't. If you already have a UserSettings folder and a GameSetUp Check folder, all you need to do is copy my Better BUG AI's Assets over your Mod's Assets folder in MyGames and overwrite. I didn't know it was that simple :p
 
Hi Fuyu,

Thanks for your response.

When I tried what you suggested, the same thing happens that happened when I tried to merge the mods on my own:

The row of icons at the bottom of the main map screen (Switch View Mode, etc.) disappear, and in diplomacy with another civ, all the text (to choose how you wish to respond) is missing!

:confused:

Do you know what could be causing this?

Thanks,

CK
 
This modpack is great, I'm very happy with it. However, after installing the latest version, all of my diplomacy text is missing. That is, the "flavor" text which displays when you meet/talk to another leader, as well as all the menu options for interaction with the leader, to open trading, declare war, etc. The area beneath the leaderhead is just blank.

I haven't had this problem with earlier versions of this mod, although I haven't updated with each and every release, so it's not definite that the bug was introduced in the very latest version. It was sometime recently though.

Is anyone else seeing this behavior? Any idea what could be causing it?
 
Yes, I do. BUG python stuff changed, some python files are now gone. So if you just overwrite, some old python files will remain - and break Diplomacy. See this post by EmperorFool for more info
You need to delete either your whole assets folder or at least the python part, and replace it with the updated one.
 
Top Bottom