# Merging Better AI with BUG 3.5

Discussion in 'Civ4 - Better AI' started by Dresden, Oct 23, 2008.

1. ### DresdenEmperor

Joined:
Jul 10, 2008
Messages:
1,081
As Cybah has noted, this is a very quick and easy process. But just in case anyone needs some guidance, here is what you need to do to merge Better AI with BUG (version 3.5). These instructions assume BUG is already installed and Better AI has been downloaded and unzipped.

If you installed BUG 3.5 as a standalone Mod and want to install Better AI to the same place:
Spoiler :
Note: <BUG Mod folder> refers to wherever BUG was installed.
1. Copy the two Python files AIAutoPlay.py and ChangePlayer.py from Better AI to <BUG Mod folder>/Assets/Python/Contrib/. The remaining Better AI Python files are unnecessary with BUG and can be safely ignored.
2. Copy CvGameCoreDLL.dll from Better AI to <BUG Mod folder>/Assets/.
3. Copy all Better AI XML files to their proper locations in <BUG Mod folder>/Assets/XML/.
4. Create a new text file called BetterAI.xml in <BUG Mod folder>/Assets/Config/. This text file should contain the following:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<mod id="BetterAI"
name="BetterAI"
url="http://forums.civfanatics.com/forumdisplay.php?f=245">

<events module="AIAutoPlay" />
<events module="ChangePlayer" />
</mod>

5. Backup the current <BUG Mod folder>/Assets/Config/init.xml file to someplace safe outside of <BUG Mod folder>/Assets/.
6. Now open the <BUG Mod folder>/Assets/Config/init.xml file with a text editor such as notepad and add the following line at the end of the Mods Section:
Code:
	<load mod="BetterAI"/>
That part of the file should now something look like this, with the added line highlighted in blue.
Code:
	<load mod="Unit Naming"/>

<!-- Options Screens -->

7. You're done. Better AI has now been merged with your BUG Mod.
When you launch a BUG Mod game, the Better AI changes will be in effect too.

If you installed BUG 3.5 to CustomAssets and want to install Better AI in place of the standard DLL:
Spoiler :
1. Copy the two Python files AIAutoPlay.py and ChangePlayer.py from Better AI to CustomAssets/Python/Contrib/. The remaining Better AI Python files are unnecessary with BUG and can be safely ignored.
2. Backup the current <BTS folder>/Assets/CvGameCoreDLL.dll file to someplace safe.
3. Copy CvGameCoreDLL.dll from Better AI to <BTS folder>/Assets/.
4. Copy all Better AI XML files to their proper locations in CustomAssets/XML/.
5. Create a new text file called BetterAI.xml in CustomAssets/Config/. This text file should contain the following:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<mod id="BetterAI"
name="BetterAI"
url="http://forums.civfanatics.com/forumdisplay.php?f=245">

<events module="AIAutoPlay" />
<events module="ChangePlayer" />
</mod>

6. Backup the current CustomAssets/Config/init.xml file to someplace safe.
7. Now open the CustomAssets/Config/init.xml file with a text editor such as notepad and add the following line at the end of the Mods Section:
Code:
	<load mod="BetterAI"/>
That part of the file should now something look like this, with the added line highlighted in blue.
Code:
	<load mod="Unit Naming"/>

<!-- Options Screens -->

8. You're done. Better AI has now been merged with your BUG Mod.
When you launch a standard game, the Better AI changes will be in effect too.

If you installed BUG 3.5 to CustomAssets and want to install Better AI as a standalone Mod:
Spoiler :
Note: <Better AI Mod folder> refers to wherever Better AI is to be installed.
1. Install the Better AI Mod as you normally would.
2. Copy the two Python files AIAutoPlay.py and ChangePlayer.py from Better AI to CustomAssets/Python/Contrib/.
3. Now move the entire Python folder from <Better AI Mod folder>/Assets/ to a backup location where it will not be accessed. A good choice is the root of Better AI Mod folder.
4. Create a new text file called BetterAI.xml in CustomAssets/Config/. This text file should contain the following:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<mod id="BetterAI"
name="BetterAI"
url="http://forums.civfanatics.com/forumdisplay.php?f=245">

<events module="AIAutoPlay" />
<events module="ChangePlayer" />
</mod>

5. Backup the current CustomAssets/Config/init.xml file to someplace safe.
6. Now open the CustomAssets/Config/init.xml file with a text editor such as notepad and add the following line at the end of the Mods Section:
Code:
	<load mod="BetterAI"/>
That part of the file should now something look like this, with the added line highlighted in blue.
Code:
	<load mod="Unit Naming"/>

<!-- Options Screens -->

7. You're done. Better AI has now been merged with your BUG Mod.
If you launch a Better AI game, you should have a fully functional BUG Mod too. If you launch a normal game, the Better AI Python is still present but won't cause any problems; just don't bring up the AutoPlay or ChangePlayer popups because they probably aren't going to work.

2. ### jdog5000Revolutionary

Joined:
Nov 25, 2003
Messages:
2,601
Location:
California
Thanks Dresden, I'm sure this will help a lot of people.

3. ### GatlingGunWarlord

Joined:
Feb 3, 2008
Messages:
273
Location:
Northwest USA
I think I need some help...

I tried merging BUG 3.5 (installed as a mod) and BetterAI 0.37; however, I'm not getting a score display... in fact, the BUG mod keys aren't working either... I'm not sure what is wrong...

I'm attaching a zip archive of my BUG mod 3.5 folder that I merged with BetterAI and a save game that I'm having the problem with.

FYI, I've got Vista Home Premium... Thanks in advance for any assistance...

EDIT:
I found the problem... this was a bug in BUG mod 3.5... the solution was in this post:
http://forums.civfanatics.com/showpost.php?p=7373877&postcount=1079

4. ### KtuluWarlord

Joined:
Dec 10, 2002
Messages:
140
Location:
Ok, I tried this and I end up with no units being displayed (they are still there and I can move them, found cities etc.) and the city information(name, food/build progress) is also not displayed.

Any ideas on what I may have done wrong? Pretty sure I followed the directions properly.

Edit: Uggg, I've removed both mods completely and still have this problem in new games and saved games

5. ### DresdenEmperor

Joined:
Jul 10, 2008
Messages:
1,081
Make sure you have all the logging options turned on (=1) in your Civilization IV.ini file. Then start/load a game where you see this problem. In your My Games/Beyond the Sword directory there should be a Logs folder. Inside that, there should be a file called PythonErr.log which you can post here either inside a spoiler tag or as an attachment (might need to rename it or zip it to attach.)

6. ### GatlingGunWarlord

Joined:
Feb 3, 2008
Messages:
273
Location:
Northwest USA
That sounds a lot like the problem I saw before the patch to Bug MOD 3.5 (see link above), although I couldn't explain why you are still having problems after removing BUG mod.

7. ### KtuluWarlord

Joined:
Dec 10, 2002
Messages:
140
Location:
I can't get the game to start properly with logging turned on. The "splash screen" stops right after "initializing python" and nothing happens even if I leave it for an hour (There is also no cpu use by civ). There is nothing in the python error log.

When I start the game without the logging on I get this PythonErr2.log file:
Spoiler :
sys.path = ['..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\email', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\encodings', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\build', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\py', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\colourchooser', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\editor', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\floatcanvas', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\masked', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\mixins', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\ogl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\af', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ca', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\cs', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\da', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\de', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\el', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\es', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\eu', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fi', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fr', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hi', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hu', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\id', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\it', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ja', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\lv', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nb', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pt_BR', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ru', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sv', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\tr', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\uk', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_CN', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_TW', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\af\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ca\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\cs\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\da\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\de\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\el\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\es\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\eu\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fi\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fr\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hi\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hu\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\id\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\it\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ja\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\lv\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nb\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pt_BR\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ru\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sv\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\tr\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\uk\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_CN\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_TW\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\py\\tests', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools\\XRCed', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools\\XRCed\\src-images', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM']

sys.modules = {'zipimport': <module 'zipimport' (built-in)>, 'signal': <module 'signal' (built-in)>, '__builtin__': <module '__builtin__' (built-in)>, 'sys': <module 'sys' (built-in)>, '__main__': <module '__main__' (built-in)>, 'exceptions': <module 'exceptions' (built-in)>, 'CvPythonExtensions': <module 'CvPythonExtensions' (built-in)>}

sys.builtin_module_names = ('CvPythonExtensions', '__builtin__', '__main__', '_bisect', '_codecs', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_csv', '_heapq', '_hotshot', '_locale', '_multibytecodec', '_random', '_sre', '_subprocess', '_symtable', '_weakref', '_winreg', 'array', 'audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'collections', 'datetime', 'errno', 'exceptions', 'gc', 'imageop', 'imp', 'itertools', 'marshal', 'math', 'md5', 'mmap', 'msvcrt', 'nt', 'operator', 'parser', 'regex', 'rgbimg', 'sha', 'signal', 'strop', 'struct', 'sys', 'thread', 'time', 'xxsubtype', 'zipimport')
init-ing world builder screen
PY:OnInit

Here's a screenshot of the problem:

8. ### KtuluWarlord

Joined:
Dec 10, 2002
Messages:
140
Location:
OK, while digging around in the install folder I found the following in the themeparselog.txt

Spoiler :
[Nov 12, 2008 - 14:08:05] Messages while processing 'Resource/Civ4.thm'

Error : Decl - ('Civ4Theme_Common.thm', Ln:401, Col:13) Assignment source propertyId 'SF_CtrlTheme_Civ4_Control_Font_Size3_Italic' not found
Error : Decl - ('Civ4Theme_Common.thm', Ln:402, Col:13) Assignment source propertyId 'SF_CtrlTheme_Civ4_Control_Font_Size3_BoldItalic' not found
Error : Decl - ('Civ4Theme_Common.thm', Ln:408, Col:13) Assignment source propertyId 'SF_CtrlTheme_Civ4_Control_Font_Size1_Bold' not found
Error : Decl - ('Civ4Theme_Window.thm', Ln:3048, Col:9) Assignment source propertyId 'SF_CtrlTheme_Civ4_Control_Font_Size1_Bold' not found
Error : Syntax - ('Civ4Theme_HUD.thm', Ln:887, Col:13) Unexpected '.' in the identifier assignment statement
Error : Syntax - ('Civ4Theme_HUD.thm', Ln:927, Col:13) Unexpected '.' in the identifier assignment statement

Any chance these are related to my problem?

9. ### KtuluWarlord

Joined:
Dec 10, 2002
Messages:
140
Location:
I've now tried deleting the entire beyond the sword folder in "my games" and still have the same problem. Looks like I'm going to have to resort to re-installing the game.

10. ### DresdenEmperor

Joined:
Jul 10, 2008
Messages:
1,081
themeparselog would be unrelated since neither BUG nor BetterAI touch the theme files. Very odd that you still have problems after removing the My Games BTS folder. In that case, it does sound like something in the main game directory is causing the problem so a reinstall is probably wise.

11. ### KtuluWarlord

Joined:
Dec 10, 2002
Messages:
140
Location:
Re-Installing fixed the issue. Thanks

12. ### JujuLautreDeity

Joined:
Apr 9, 2007
Messages:
3,112
Location:
Kansai, Japan
Can you explain to me how that is possible? I thought that when you load a mod, everything in the customAssets folder is ignored

13. ### DresdenEmperor

Joined:
Jul 10, 2008
Messages:
1,081
A mod can choose to either use custom assets or ignore them based on a setting in its INI file; the default is to allow them which has actually caused me problems with the built-in BTS mods when having BUG active in my CustomAssets. The Mod's files have higher precedence, though, which is why in the instructions some of the Better AI Python files are essentially disabled by being moved to a backup location.

14. ### JujuLautreDeity

Joined:
Apr 9, 2007
Messages:
3,112
Location:
Kansai, Japan
Perfectly clear, thanks a lot

I am still dreaming of a world where I could play RFC with BUG, but there are so many files in conflict... Oh well, I will continue the current way

15. ### PieceOfMindDrill IV DefenderRetired Moderator

Joined:
Jan 15, 2006
Messages:
9,319
Location:
Australia
Hi Dresden,

Is it pretty much the same process for the BAT mod?

It's probably a dumb question...

16. ### DresdenEmperor

Joined:
Jul 10, 2008
Messages:
1,081
It shouldn't be much different for BAT since BAT only changes graphics and the BUG version it includes is exactly the same as the standalone. Although, to be honest, I've never actually tried BAT myself.

17. ### PieceOfMindDrill IV DefenderRetired Moderator

Joined:
Jan 15, 2006
Messages:
9,319
Location:
Australia
Well I tried following the same procedure and it appeared to work, and is working so far. So it probably was a dumb question.

18. ### PieceOfMindDrill IV DefenderRetired Moderator

Joined:
Jan 15, 2006
Messages:
9,319
Location:
Australia
Oops. Seems I spoke to soon. I get a crash pretty much every time after I start a game and create the first city.

19. ### DresdenEmperor

Joined:
Jul 10, 2008
Messages:
1,081
Anything in the error log? Also which of the installation methods did you use?

20. ### PieceOfMindDrill IV DefenderRetired Moderator

Joined:
Jan 15, 2006
Messages:
9,319
Location:
Australia
Actually I think I fixed it. I was copying the text at the in your post above without looking at it properly. It has version 0.40 in it, yet I'm using better AI v0.41. I changed that and it looks ok for now. I'll get back to you if there are any problems.

A quick question though. Is there a way to disable the new terrain from BAT? I like all the other features but my poor eyes can't distinguish between plains and grassland properly.

Thanks

EDIT. I just saw a new version has been posted so I'll try it with 0.45 now.