I'm not certain, but what might have been causing the units to switch AIs was the immediate combat that was occurring.
Having written a very basic AI for these criminals, I have to admit there were a few functions called that I didn't write but was using as 'AI building blocks'. However, I would be deeply surprised if any of them make it likely to switch AI due to entering combat.
As you mentioned the possibility of ambushes, it might have been something along the lines of "Criminal spawns, immediately ambushes and kills a ship, then uses leftover movement to go pillage something".
I'm wondering now if Assassination target rules may make it possible for these units to 'assassinate' the ships and civilians you are talking about. It very well may and if that's the case then one of the big problems here is that the land domain vs sea domain rules are still not allowing a real conflict to ensue when its possible and that's a bug that the naval review has needed resolved for a while (and has long been a problem for hovering units that can fly over the ocean and conflict with boats - the bug has been that the conflict results in an auto-win like a chess attack rather than an actual combat. So this lingering lack of correction from Vanilla rules still haunts us and all the more as I open up greater conflict potential.)
Why they then go and pillage? I MIGHT have given them some coding to try to take advantage of pillageable targets in range where they can return to the city after doing so... I will have to review that AI again.
This is further supported by the fact that there were several unescorted workers that should have been in movement range of the city via railroad, but weren't attacked.
Perhaps.
It's also possible that the units are being forced out of the city when they successfully attack, rather than actually moving out, and the pillaging AI only kicked in once they were already outside.
That may be true... I might have done something to get them to consider their options when they were NOT inside a city, motivating them to get to another city and do some stuff along the way perhaps. Again, will take some review. I threw together some building block ai function calls and called it good. They're main mission - get to a city and cause it trouble if they aren't already in one. If they are, stay there. There's much more to be done to make them better.
Also of note, I believe the only ones that went wandering were Assassins and Scoundrels. I don't recall seeing any of the other types leaving the city.
hmm... that makes me think that maybe those units aren't accepting the spawned criminal AI and are instead taking on their default, which would very much have them acting much more obnoxious to the countryside.
I actually understated the number of criminals that were spawning. It was really more along the lines of 20-30 criminals spawning and being killed per turn for several turns at the peak, with at least another dozen or so left in the city because they weren't yet Wanted. I think the total number of criminals was in the 40+ range for several consecutive turns, and the "shutoff" was sudden rather than a gradual tapering off. One turn, at least a dozen new criminals spawned, the next and subsequent turns, zero.
Very interesting indeed. You ARE working on the LATEST SVN right? A recent change should theoretically limited the amount that could spawn significantly and I'm thinking this is a display of completely ignoring that. Or there's an element to the math that I'm overlooking.
It may be worth bringing up that my laptop's hard drive is starting to fail and badly needs replacement, but I've been putting it off . I've been experiencing occasional periodic massive spikes in seek time, with my entire system locking up for 1-2 seconds, presumably the result of the page file or something else getting stored in a bad sector of the HDD. It's possible that the original cause was the result of a hardware-related issue on my end.
Such would usually lead to a crash before odd behavior.
That said, based on your description of the spawning code, it sounds like what happened was for some reason the game thought the crime level in the city was sky-high for a period of time.
Absolutely, but how, then, does it report a negative number when that number is pulled from the same data source that the ruleset is looking at?
When I go back and take a look at the saves I'll check and see if there are Crime buildings or not. If there are, then the code is probably working fine but something borked up the property value. If there aren't, the issue probably lies in the code somehow.
Interesting test. Yes, look at the special buildings tab to ensure you aren't showing buildings that only come into play due to high crime and see if it jives with the crime level displayed on the properties tab.
Another thing I think I'll try is seeing what happens if I take a save from when the criminals were still spawning en masse and force a recalc.
Haven't managed to reproduce the issue, though I haven't made any attempts to set up a dedicated test or anything, just tried training another pile of Scoundrels, then tried rebuilding and redemolishing a few of the criminal buildings.
The actual autosaves are long gone but I should have a slew of normal saves around that time. I'm not sure if I have one from right before it started or as it started, but I definitely have a few from while they were still spawning and being arrested. I'll take a look and post them later.
Meh... no worries then. The save you provided should be enough.
I agree, I'm just mentioning it as a possible easily-made and easily-reversed tweak as a stopgap until diseases are more of an issue. If I'm interpreting the files correctly, it could be something as simple as changing iAIWeight to an appropriately small/large/zero value (not sure how it works) and slapping a comment in as a reminder of the original value. If the disease updates are going to be fairly soon, there's no point, but if it's likely to be some months before they're implemented, telling the AI to ignore it for now may result in a slightly more competitive AI.
True, that could be done but I'd fear forgetting it had been done.
The point of the Great Farmer is that they can place resources on invalid terrain, so no terrain checks are done. A domain check may be possible but not directly as there isn't one.
Not sure what you mean. You can't ask for the domain of the plot the unit stands on as a prequalification to being able to perform the mission? Such would be trivial in the C++. pUnit->plot()->getDomainType(). I know there's a spot somewhere where canDoMission (or whatever its called in this case) has some definitions because it keeps the unit from planting a resource where another resource already exists.
We would need to ask for the nearest land plot and if it is the plot the unit is on then it is land otherwise it isn't. That is possible in python.
This seems a much more complicated coding than 'what is the domain of the plot the unit is on?'
1.I'll answer your question with a question; Why should a barb city/settlement have more culture influence than a regular Civ?
As long as their city eventually does grow to 8 tiles For this Option, then this is an advantage they should not have imhpo.
That's a pretty good point in my book.
Barbarians are not a city/settlement. That is the problem. I really wish we could go back to the BtS standard barbarians where they had a completely separate AI and weren't just another nation.
edit In fact I would prefer if they did not have cities ever.
Barbarian cities are indeed settlements, but they are settlements of anarchists who refuse to live under any form of governance and live on the outskirts of society, often joined in the common goal to live as freely as possible. The 'united' appearance of barbs in the game is purely due to the fact that we cannot have thousands of little splinter societies as players. The tech level of barbs is to be considered the level of knowledge that generally ALL people are fluent in and utilize in day to day life, regardless of leadership or lack thereof. Barbs are not to be seen as one unified nation, but simply as the population of folks who refuse to have any nation at all.
If barbs were to conflict with other barbs now and then it could be beneficial to the setting. Otherwise, they are slackers who refuse to deal with the demands of a competitive society and seek to take more than give and hold back the swelling tide of expanding authority in the world. Hillbillies and clans and all manner of folk who claim allegiance to none.
And they do have a completely separate AI, just as they originally did. The BBAI stuff may have made the unit AI's a bit more cohesive in their overall teamwork with other units because Barb AI was not kept tremendously separated from some unit AIs as they may have been.
It's in the CIV4PropertyInfos.xml;
Code:
<Type>PROPERTY_CRIME</Type>
<Description>TXT_KEY_PROPERTY_CRIME</Description>
<Strategy>TXT_KEY_PROPERTY_CRIME_STRATEGY</Strategy>
<ValueDisplayText>TXT_KEY_PROPERTY_CRIME_DISPLAY</ValueDisplayText>
<ChangeDisplayText>TXT_KEY_PROPERTY_CRIME_CHANGE</ChangeDisplayText>
<ChangeAllCitiesDisplayText>TXT_KEY_PROPERTY_CRIME_CHANGE_ALL_CITIES</ChangeAllCitiesDisplayText>
<PrereqMinDisplayText>TXT_KEY_PROPERTY_CRIME_PREREQ_MIN</PrereqMinDisplayText>
<PrereqMaxDisplayText>TXT_KEY_PROPERTY_CRIME_PREREQ_MAX</PrereqMaxDisplayText>
<bSourceDrain>1</bSourceDrain>
<iAIWeight>-150</iAIWeight>
<iTargetLevel>0</iTargetLevel>
<AIScaleType>AISCALE_CITY</AIScaleType>
[color=red]<iOperationalRangeMin>0</iOperationalRangeMin>
<iOperationalRangeMax>1000</iOperationalRangeMax>[/color]
BUT, each individual Crime also only has a Positive range and that Min/Max is 0 to 100,000.
Example:
Code:
<PropertyBuilding>
<BuildingType>BUILDING_CRIME_GRAFFITI</BuildingType>
<iMinValue>20</iMinValue>
<iMaxValue>100000</iMaxValue>
</PropertyBuilding>
AFAIK, there has never been any definition made for negative range. Unless it's in the dll files.
JosEPh
Nice thinking and you did spark some considerations, namely that there may be a hardcoded limit in the code that, when hit, makes the code think the property value is the opposite to what the amount actually is. That point may be somewhere around 9k to -9k. Might be in AIAndy's coding somewhere. But the operational range you first mention, for the property as a whole, is purely an AI consideration that Koshling originally used for his AI. I've advanced the AI past the use of this tag in most cases though there may still be a few spots that do use it.
The second is interesting but should only be capable of removing a building when the property levels exceed 100k and should never enable a property autobuilding to manifest in a city when the city is outside of the minimum to maximum ranges.
Started a new thread for the criminal spawn flood issue, with a save attached.
Ok. Keep in mind this is a good thread for this since the multiple issues being found here each need to eventually be addressed and by being in this thread will be noticed as an issue to resolve. Discovering them elsewhere will mean I need to register the bug here still and sometimes I forget and that's how some bugs never get addressed.
However, while looking at the old saves, I noticed something odd that may or may not be related, and possibly previously led to an odd occurrence that disappeared on loading of an autosave. If you take a look at the Production history chart in the statistics, you'll notice a VERY massive spike in England's production. This occurred at some point in the Prehistoric, and I believe it only lasted for one turn. Way back in the early Prehistoric I recall getting the "England is the first to discover Sedentary Lifestyle" announcement followed by something like five religions being founded simultaneously. Checking WB showed all five being founded by England. I assumed something went wrong somewhere, but loading of an autosave did not result in a repeat so I basically ignored it and moved on.
I've seen something like this before. No bead on what causes this yet.
Now, I think what might have happened then is that production spike hit, and the AI happened to be producing Research and thus suddenly got a ridiculously large chunk of

that allowed it to research several dozen techs in one go. On reloading something presumably caused the AI to change production to something that went unnoticed.
Now, I have no idea what might have caused that in the first place, and it's been far too long to try and track down the cause of that spike to begin with, but I wonder if that event could have had some kind of lasting effect that is now making itself apparent? Presumably an int overflow occurred at the time, after all.
I strongly doubt an int overflow since the game is at a much simpler time then and there's no basis to suspect such an overflow. I dont' suspect an overflow in your properties either because at a point, it comes back to sanity. Usually once madness is introduced by an overflow it's all bad from there and never recovers any sense of normalcy.