Civic AI Weights problem... heeelp

vincentz

Programmer
Joined
Feb 4, 2009
Messages
3,614
Location
Denmark
I messed up. Im not sure exactly where i did, but I know when I did, which was between my 0.98 and 0.99 gamecore.dll. The AI weights are going through the roof.
Problem is I have no idea what causes it, so I plea to the ones who have been blessed by the code gods. Maybe someone can do a winmerge check between the two files and skim for any obvious bug that can cause something like this :
sODHYhz.png


(will upload the difference files between the two versions asap)...
 
There is no way to figure this out based on the info available on the forum. I'm downloading 0.98 and 0.99 from moddb, but time will tell if/when I get around to diff the downloads.

I recommend using git for storing the mod code while it's being developed. This essentially makes a "release" each time you commit a change, which mean whenever something like this happens, you can ask git to go back to earlier versions to pinpoint which one causes a bug like this one. Once it's located, git can provide a log entry as well as a diff for what changed in that single change. Some projects use svn, which would do the job just fine as well. The major difference is that git has a local copy of everything and will not need the server to see old versions, which makes moving through history a lot faster. It does use more disk space to store everything locally though.
 
I wanted to upload the source gode for The 0.98 and 0.99, but was interrupted by my kids, and thought I could do later, but been busy ever since and sitting at my mother's house atm with no access.
I will (hopefully) upload it on sunday afternoon. The changes are not THAT numerous, but I fail to see any of it makes changes to AI civics, so maybe (hopefully) someone could winmerge and spot it.
The problem is I didn't spot the bug until way into my 1.0 gamecore.
The good part is that I can use the 0.98 dll on my 1.0 assets without the bug, so in pretty sure it's somewhere in the sdk the problem is.
 
Obviously, the problem is in CvPlayerAI::AI_civicValue.

I see that you have replaced
Code:
iTempValue += ((kCivic.getSpecialistCommerceChange(iJ, iI) * getTotalPopulation()) / 15);
by
Code:
iValue += ((kCivic.getSpecialistCommerceChange(iJ, iI) * getTotalPopulation()) / 15);
(somewhere around line 9370).

I will not pretend that I understand the code but perhaps you could revert that change for a try? If you have a good reason to stick to it, then somebody with a better knowledge of C++ can verify that specific function.

PS/Edit: like that, it's true that the iTempValue does not seem to make sense as it is zeroed afterwards. It looks like something is missing.
 
thanks :D

I wish I could try it out, but after migrating to a SSD, my builds just fills up with this for every file :
fatal error C1083: Cannot open precompiled header file: 'Release\CvGameCoreDLL.pch': No such file or directory
Driveletters and everything are the same, and everything else is working flawlessly?!?


Nvm that. I had moved Civ to the SSD C:\ drive, and even though it was also still on the D:\ drive and the registry was still pointing there, the compiler worked if I changed the makefile's civ destination to C:

Btw, it worked :D :goodjob:
Values are now back to normal. I thought I installed the specialist enhancement much earlier.
 
Not related to the AI weight issue, but still something I feel like I should point out.

Nvm that. I had moved Civ to the SSD C:\ drive, and even though it was also still on the D:\ drive and the registry was still pointing there, the compiler worked if I changed the makefile's civ destination to C:
I think it's a good idea to keep all the temp compile files on the D drive. The files are so small that they are likely stored in the RAM cache, which mean it doesn't matter which drive you use and the CPU speed is the limiting factor anyway. However most if not all files are overwritten each time you compile meaning you make lots of write cycles. Doesn't really matter on a mechanical harddisk, but not ideal on an SSD. Not sure how much it matters though.

If you use Makefile 2 (the one in my signature), you can add the following line to Makefile.settings.
Code:
TEMP_FILE_DIR="D:\civ_temp"
Just make sure you write the correct path and it will store the temp files there. This allows you to have the files on the SSD and the temp files on the mechanical disk if that is what you want. MSVC++ still writes the project settings and cache over and at the disk with the source files.
 
Back
Top Bottom