Better DuneBUG AI

right now it seems a better bet to stick with the RevDCM base (which includes BUG/BULL/Better BTS AI anyway).

It is a shame that we haven't been able to overcome the issues with the Better BUG AI/Dune Wars 1.8X project, but perhaps it is better to work from the working base we currently have.

I would be against merging in updated versions of RevDCM wholesale. I would be in favour of merging in the latest Better BTS AI and (perhaps) BUG and BULL if possible as Jester Fool is attempting. Removing redundant Revolutions and RevDCM may also be worthwhile - the code that includes the hard-coded TECH_SCIENTIFIC_METHOD and TECH_LIBERALISM is a good example.

Overall, I think it is more worthwhile to focus on why individual features are not working well/properly and try and improve them. For example, the AI doesn't seem to use Ranged Bombardment as a human would in either DW 1.8 or DW 1.8X versions which is something I'd like to resolve.

IMO, a code base is only acceptable if a Debug dll will run - otherwise Vista specific CTD will not be able to be diagnosed. I'll keep you posted.

Agreed. For someone like me who runs XP the Debug DLL is the only way I can be vaguely confident that the DLL will work under XP. For example, the 1.8.0.1 DLL has quite a large number of changes from 1.8, but since the Debug DLL worked fine I was fairly confident that it would be OK in Vista.
 
although - i kinda like the work deliverator have done here, wish it to become the formal version.
Hi Keldath. My thoughts exactly. It is extremely frustrating that BULL 1.2 just won't compile a Debug dll that will work under Vista (especially since RevDCM 2.72 INCLUDES BULL - WTH?!) Hopefully, the BUG team can help me figure out what is going on with BULL 1.2 (which is pretty cool I might add).
 
RevDCM does not include all of BULL - at least not the ximage part.
I'm not sure what version of BULL is in 2.72 but the Better AI component is still at version 0.84 I believe, only RevDCM 2.8 will include Better BTS AI 1.0, and that will still take quite a while.
 
I have done a clean install of dune-wars-1.8X.exe from post #1 and then added the zip file dune-wars-patch-1-8-X-1.zip from post #65. The patch includes the extra files from DuneWars1.8X_valid_xml_fixes.rar in post #61. I believe this makes my 1.8X installation as up-to-date as possible.

Before getting involved in any debugging, I always run civcheck. It flags a number of problems in gameinfo/civ4diplomacyinfos.xml:
Spoiler :

UndefinedSymbol: ASSUME_NOT_SNUFFED
Used: dune gameinfo/civ4diplomacyinfos.xml at line 74
Used: dune gameinfo/civ4diplomacyinfos.xml at line 4408
UndefinedSymbol: ASSUME_REALLY_SNUFFED
Used: dune gameinfo/civ4diplomacyinfos.xml at line 60
Used: dune gameinfo/civ4diplomacyinfos.xml at line 4394
UndefinedSymbol: ASSUME_SNUFFED
Used: dune gameinfo/civ4diplomacyinfos.xml at line 46
Used: dune gameinfo/civ4diplomacyinfos.xml at line 4380
UndefinedSymbol: RESUME_TALKS
Used: dune gameinfo/civ4diplomacyinfos.xml at line 88
Used: dune gameinfo/civ4diplomacyinfos.xml at line 4422
UndefinedSymbol: RESUME_TALKS_GLADLY
Used: dune gameinfo/civ4diplomacyinfos.xml at line 116
Used: dune gameinfo/civ4diplomacyinfos.xml at line 4450
UndefinedSymbol: RESUME_TALKS_RELUCTANT
Used: dune gameinfo/civ4diplomacyinfos.xml at line 102
Used: dune gameinfo/civ4diplomacyinfos.xml at line 4436
UndefinedSymbol: USER_LETS_TALK
Used: dune gameinfo/civ4diplomacyinfos.xml at line 32
Used: dune gameinfo/civ4diplomacyinfos.xml at line 4366
UndefinedSymbol: USER_STOP_BOTHERING
Used: dune gameinfo/civ4diplomacyinfos.xml at line 18
Used: dune gameinfo/civ4diplomacyinfos.xml at line 4352

There are also some minor issues in the python which probably don't matter:
Spoiler :


UndefinedSymbol: CIVILIZATION_AMERICA
Used: dune contrib/randomnameutils.py at line 30
UndefinedSymbol: CIVILIZATION_ARABIA
Used: dune contrib/randomnameutils.py at line 36
UndefinedSymbol: CIVILIZATION_AZTEC
Used: dune contrib/randomnameutils.py at line 42
UndefinedSymbol: CIVILIZATION_CARTHAGE
Used: dune contrib/randomnameutils.py at line 48
UndefinedSymbol: CIVILIZATION_CELT
Used: dune contrib/randomnameutils.py at line 54
UndefinedSymbol: CIVILIZATION_CHINA
Used: dune contrib/randomnameutils.py at line 60
UndefinedSymbol: CIVILIZATION_EGYPT
Used: dune contrib/randomnameutils.py at line 66
UndefinedSymbol: CIVILIZATION_ENGLAND
Used: dune contrib/randomnameutils.py at line 72
UndefinedSymbol: CIVILIZATION_FRANCE
Used: dune contrib/randomnameutils.py at line 78
UndefinedSymbol: CIVILIZATION_GERMANY
Used: dune contrib/randomnameutils.py at line 84
UndefinedSymbol: CIVILIZATION_GREECE
Used: dune contrib/randomnameutils.py at line 90
UndefinedSymbol: CIVILIZATION_INCA
Used: dune contrib/randomnameutils.py at line 96
UndefinedSymbol: CIVILIZATION_INDIA
Used: dune contrib/randomnameutils.py at line 102
UndefinedSymbol: CIVILIZATION_JAPAN
Used: dune contrib/randomnameutils.py at line 108
UndefinedSymbol: CIVILIZATION_KOREA
Used: dune contrib/randomnameutils.py at line 114
UndefinedSymbol: CIVILIZATION_MALI
Used: dune contrib/randomnameutils.py at line 120
UndefinedSymbol: CIVILIZATION_MINOR
Used: dune contrib/randomnameutils.py at line 174
UndefinedSymbol: CIVILIZATION_MONGOL
Used: dune contrib/randomnameutils.py at line 126
UndefinedSymbol: CIVILIZATION_OTTOMAN
Used: dune contrib/randomnameutils.py at line 132
UndefinedSymbol: CIVILIZATION_PERSIA
Used: dune contrib/randomnameutils.py at line 138
UndefinedSymbol: CIVILIZATION_ROME
Used: dune contrib/randomnameutils.py at line 144
UndefinedSymbol: CIVILIZATION_RUSSIA
Used: dune contrib/randomnameutils.py at line 150
UndefinedSymbol: CIVILIZATION_SPAIN
Used: dune contrib/randomnameutils.py at line 156
UndefinedSymbol: CIVILIZATION_VIKING
Used: dune contrib/randomnameutils.py at line 162
UndefinedSymbol: CIVILIZATION_ZULU
Used: dune contrib/randomnameutils.py at line 168

UndefinedSymbol: TECH_ARCHERY
Used: dune buffy/buffy.py at line 119
UndefinedSymbol: TECH_POLYTHEISM
Used: dune buffy/buffy.py at line 104
UndefinedSymbol: TECH_PRIESTHOOD
Used: dune buffy/buffy.py at line 102
UndefinedSymbol: TECH_THEOLOGY
Used: dune inquisition.py at line 482
UndefinedSymbol: UNITCLASS_ARCHER
Used: dune buffy/buffy.py at line 134
 
I am a little stuck trying to investigate the MEMORY_MANIPULATED_US problem in 1.8X. I showed some steps to show annexation which work correctly in pure 1.8.

However, after installing 1.8X and 1-8-X-1, the RM unit does not seem to even accept promotions. I have never seen this behavior. I use WB to place a RM. It does not start with the expected promotions of Suspensor Travel or Diplomat. So I use the edit-unit dialog in WB to add the promotions. They still do not appear. I can add the Diplomat promotion and other promotions to other units, regardless of whether they are legal for the unit. However, I cannot add any promotions to the RM using WB. Very strange; I cannot think of any way that could even happen.

Has anybody tried city annexation with 1.8X?

EDIT: in fact no espionage unit can get any promotion. So there is no way city annexation or any other custom spy mission can be working. In vanilla, spies cannot get promotions. Something was changed in the super spies modcomp to enable this, and that part must be missing.

Minor nit: I occasionally get a python popup that there is no symbol "EVENTTRIGGER_PARTISANS" defined. I have run into this before. The vanilla file BTS/assets/python/CvEventManager.py uses this symbol. Since DW 1.8X does not provide any customized version of this file, the BTS version is used. But since we have customized assets/xml/events/civ4eventtriggerinfos.xml, the symbol is not defined.

Please do add the "pure" DW 1.8 version of CvEventManager.py. Using "diff", you will see that I had commented out the partisan section of this file.
 
civ4diplomacyinfos.xml

Edit: The RevDCM lines should be removed to fix this.

EDIT: in fact no espionage unit can get any promotion. So there is no way city annexation or any other custom spy mission can be working. In vanilla, spies cannot get promotions. Something was changed in the super spies modcomp to enable this, and that part must be missing.

This is controlled in the SDK in the CvUnit functions canAcquirePromotion and isPromotionValid. These are identical between 1.8 and 1.8X with TSheep's SuperSpies amendment in place so I'm not sure where the problem is.
 
The Spies issue appears to be because SS_ENABLED is set to 0 in GlobalDefinesAlt.xml.

I set this to 1 then started the mod and the Suspensor Travel and other Spy promos can be added. I switched it back to zero and I couldn't add any spy promos as you described.

The weird thing is that SS_ENABLED is set to zero in DW 1.8, but apparently that code base takes no notice for some reason.

Also, you'll need to compile a DLL from the latest source I posted here if you want to be finding new issues rather than previously fixed ones.
 
I have built a release sdk from your sources.

I had some trouble with CxImage. Your rar only contains half the files and the directory structure is wrong, but I resurrected the remaining files from my previous build directory. Your files are only the contents of the "general" directory. The adjacent jpeg directory is missing. Also, when I link, CxImage::CreateFromBITMAP is used in CvGame::takeJPEGScreenShot but never defined, so I hacked out the reference.

Thanks for the tip about SS_ENABLED. I changed that to 1; while I was at it, I also changed the bribery and assassination flags to 1. Now I can follow the steps for annexation. I get a crash when I perform the first annexation. So, something is definitely wrong. Now I will try a debug executable.
 
I'm used the CxImage version that is bundled with Better BUG AI - perhaps I didn't upload it properly.

Good luck with the debugging.
 
If we can resolve the memory type issues with 1.8X then it might well be worth merging in WOC Lite by Johny Smith. This would avoid a lot of painful gamefont work fixing up all the bonus resource gamefonts. The other components I could live without. I was scared off from merging in the TGA Index/bigger gamefont stuff previously because it looked like I would need to get into editing the Makefile - perhaps WOC Lite is more merge friendly?
 
I am a little scared of WOC lite. It is an excellent idea but one thing they did is to reorganize the modular loading code. Maybe it worked and people misunderstand how to use it, but it is a pretty large change and it is hard to be sure everything is correct. I don't believe any of the authors are still around. As far as I know, nobody has split out the gamefont "simplification" code (TGAIndex, etc) separately. That might be a worthwhile project.

In other news, my main PC got a nasty virus yesterday and I had to reformat. Nothing is lost, but everything needs to be re-installed. I have a business trip next week and I am not sure I will be able to re-install the Visual Studio stuff. So I do not think I will be able to solve the MEMORY_MANIPULATED_US problem quickly. I did get a debug executable from your sources and I got the game to start; but my system is non-STEAM and XP, so it is the "easy case".

In the small investigation I did, I annexed a city and got an assert in CvPlayerAI::AI_changeMemoryCount() from the line:

FAssert(AI_getMemoryCount(eIndex1, eIndex2) >= 0);

However, when this assert comes, the eIndex1 and eIndex2 have already been validated and I confirmed with a print statement that they are in the correct range. There is no comment for this assert but it seems to trigger upon any negative reaction. This seems silly. Reactions can be either positive or negative, and the point of this reaction is to be negative. So this assert seems misguided, and without any documentation I do not see a reason to check this.

The crash must be occurring after this point, but I was not able to get any further.
 
There is no comment for this assert but it seems to trigger upon any negative reaction. This seems silly. Reactions can be either positive or negative, and the point of this reaction is to be negative.

Perhaps it is not so silly. I do not see any reason for a crash, but I investigated further and I believe my original code is wrong. I traced all the code related to using MemoryType and nothing ever uses a negative count. In fact, a negative count does seem wrong because it will never decay. Then I tried to figure out how some of the MemoryTypes have a positive diplomatic effect and some have a negative. For example, MEMORY_VOTED_AGAINST_US is negative but MEMORY_VOTED_FOR_US is positive. The key is in the xml: <iMemoryAttitudePercent> can be positive or negative.

I will not have a chance to try, and I do not see why this code should work in DW 1.8 and fail in DW 1.8.X. But, a code change seems in order. Please search the small number of places where MEMORY_MANIPULATED_US is used in the sdk, and make the memory count change +1 instead of -1. Then in the leaderhead file, change the value of each <iMemoryAttitudePercent> for MEMORY_MANIPULATED_US from 100 to -100.
 
This seems like a good change to make.

Would AI_changeMemoryCount be called on start up? The Steam/Vista DebugDLL start-up crash that happens during the loading of CIV4LeaderheadInfos.xml is the hurdle I think we need to get over.
 
I don't see any reason negative counts should cause a crash, and I am sure that the MANIPULATED_US code is *not* called at startup. However, does getting rid of the undefined diplomacy values found by civchecker get you past this startup crash?

EDIT: just checking this elementary point, but after you change cvenums.h you must remove *all* your .obj files and recompile from scratch. Otherwise, arrays will be the wrong size and this type of crash may occur.
 
However, does getting rid of the undefined diplomacy values found by civchecker get you past this startup crash?

Already tried it and it didn't make a difference sadly.

EDIT: just checking this elementary point, but after you change cvenums.h you must remove *all* your .obj files and recompile from scratch. Otherwise, arrays will be the wrong size and this type of crash may occur.

Doing a clean build like this is generally the first thing I try after any crash.

It still seems like something is missing around the additional MEMORY enums, but I've got no idea what.
 
Fuyu set me straight - changing the compiler option to /MD didn't produce a real debug dll. Back to the drawing board. Epic fail (damn).
 

Attachments

This looks like a good breakthrough JF. Well done. I won't have time to put together a new patch until later in the week, but when I do I'll take these changes together with the issues david has identified.

MapFinder sounds like it is not much use to us anyway so removing it seems like the way to go.
 
hey deliverator,

i now understand why it is that the ai doesnt use dales code, like bombardment,

you see, in revdcm, the guys fixed this issue with many fixes,
mostly under the file cvunitai.cpp. they wrote many section of codes about ranged bombardment ai.

they also added a code for naval bombardment , by adding lines of code, im working hard on extracting the needed parts from revdcm 2.72, mostly for my own use, but if you want, once im finished (if i finish..) i will be happy to merge it into the current 1.8x.1.

kel.
 
The AI doesn't seem to do 2-tile Ranged Bombardment in either Dune Wars 1.8 based on RevDCM or Dune Wars 1.8x based on Better BUG AI with the original Dales Combat Mod code. So either way it needs further investigation and debugging.
 
Back
Top Bottom