Massive flood of spawning Criminals

TrippedOnACloud

Warlord
Joined
Jun 28, 2012
Messages
294
Decided I'd start a new thread on this issue to avoid clogging the main SVN bug thread.
Spoiler Quoted from SVN bug thread :

Hooboy. Somewhere in my attempts to abuse the ability to arrest your own criminals, something went horribly wrong. First, I demolished the required buildings to train various criminals until I got to the lowest-cost trainable criminal I could. Starting at early Transhuman/Late Modern, I wound up demolishing a Meth Lab, Mob Storefront, Motorcycle Club, Highwayman's Hideout, and Saloon. Possibly another building as well, but in any case I ended up at Scoundrels (17 str) as my cheapest trainable and arrestable criminal. I proceeded to spend a turn alt-training them in my capital, which wound up being around a dozen or so, then sat them there to become Wanted.

The first few turns went smoothly enough, with 2-3 arrested per turn. Then, suddenly, somewhere around 5-10 new criminals started spawning every turn and immediately attacking units in the city (without leaving it), as well as leaving the city and pillaging the countryside. This included attacking ships in the city, and the successful attacking of any ship instantly resulted in all capturable/defenseless units in the city being destroyed as though the city was conquered. Note that this entire time the Crime level in the city has been between -9000 and -11000 or so. I loaded an autosave from before the craziness in order to evacuate all the Great People from the city, and surrounded the city itself with a ring of Viet Cong (Machinegun UU) to hopefully keep the criminals contained. Since then, they've been continuing to spawn at a rate of 5-10 per turn and sometimes directly attacking other units in the city. It actually looks like they're going after whatever the first unit in the list is, so any ships or aircraft present get attacked first, and if there's no ships then my Modern Armors get attacked.

The spawning units include Assassins (8 str), Cutthroats (12 str), Scoundrels (17 str), Mobster Cars (40 str), Biker Gangs (60 str), and Street Gangs (70 str). All except the Cutthroats can be arrested fairly easily, but the Cutthroats are still getting the city's full defense bonus (over +1100%), and thus are often managing to successfully drive off or even kill my SWAT teams (100 str LE).

None have attempted to break out through the ring of Viet Cong machineguns thus far, and I'll keep going to see if I can end the criminal flood or not. Savegame attached. This save should be from the latest SVN, though the game was started on an older one.
Just an update on the above situation. Things seem to have leveled off at about 20 criminals spawning per turn. In any case, I'm getting 20-30 Military Captives per turn, and I've worked out a promotion set that seems to give fairly consistent survival against the damned Cutthroats and their city defense. Still no attempts by the criminals to break out through the ring of machine guns, but ships built in the city are killed instantly by newly spawning criminals every turn.

Oh, and I'm getting a few of every criminal from Assassins to Street Gangs now. Doesn't seem to favor any particular type over the others, though Cutthroats tend to last longer because of the aforementioned defense issue.

Regarding my massive flood of criminals:
No combat mod options are on. Problems arresting Cutthroats are solely because they get the city's (extremely high) defensive bonus, which does not appear to be happening with any other criminal type.

Maybe a dozen turns after my previous post, the flood of spawning criminals has come to a sudden end. I'm completely mystified by where they came from in the first place, nor do I know why they've stopped. The city's Crime level was around -9000 when it began, roughly -16000 at the end as the result of the police I sent in to arrest the criminals. The majority of the criminals shouldn't have been spawning in the first place if I understand the intent of the mechanic, as their prerequisite buildings had been demolished via Ctrl-A. There's still 4 or 5 lingering survivors that haven't become Wanted yet.

I'm going to give it another dozen turns or so, then see what happens if I train another pile of Scoundrels. If that doesn't cause anything to happen, I'll try rebuilding and redemolishing the criminal buildings, and see if anything interesting occurs. Update: Haven't been able to trigger another massive flood of criminal spawning by training more Scoundrels or rebuilding/destroying the criminal buildings. Possibly was caused by some sort of caching issue, or something, I dunno.

Also, where in the mod's files is the code for the various criminal-related stuff? I'd like to take a look under the hood, and see if I can spot anything off.
Interesting that as you say you removed all the buildings with those spawning effects. I wonder if there's a bug in the removal of buildings somehow. Might be some caching that got that stuck in place perhaps but also too there are some unsanctioned buildings that come into play in the city that can help to spawn if you have extremely high crime. But as you said, the crime was low so that's all the more odd.

This is almost sounding like the chance is based not on the static crime level but the adjustment amount... that would be interesting. I'll have to run some tracking with your save on that segment.



There's an interesting hint in this I think... at the moment I don't really have spawning criminals being given a very detailed AI. It seems quite odd to me that they are acting this aggressive. Maybe I did SOME things to enhance that at some point a bit ago but this is still strange on a number of levels.

A separate bug that's part of the movement stuff I'm working on now. New and improved data to consider though. Ugh... Not sure I've looked at trying to catch this side of things yet.


This is what makes me think it might be looking at the adjustment rate and not the actual crime value, which is what I was trying to isolate originally. That could explain why others reported seeing criminals spawning when they didn't have positive crime amounts. But I DID check that code again afterwards and it was doing everything it was expected to do so this is really confusing.

It's also possible that you hit an integer limit somewhere, causing your values to go completely haywire. You're talking about pretty high numbers there but not the millions it takes generally to hit int overflows. So that's less suspect.


I'd like that autosave too...


hmm... ambush works this way. But ambush should not be functioning inside a city.


The defensive bonus is due to cutthroats being ruffians and thus having the ability to get defensive bonuses in general. I do still need to ensure that any unit that can blend into cities like they do cannot get city defense bonuses.


This sounds more like what they should be doing if they are spawned criminals, yes. They shouldn't be moving about the countryside to find targets but they should be pretty much staying put and assassinating if they can do so effectively.
I'm not certain, but what might have been causing the units to switch AIs was the immediate combat that was occurring. 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". 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. 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. 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.

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.

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.

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. 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.

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.
After going back to the old saves, I find I made a few mistakes in values I quoted for crime and in specific units involved, but none of which significantly affect anything. In any case, all Crime values are and were significantly negative throughout.

Attached is a save from immediately before the issue begins. In the capital, demolish via Ctrl-A the Mob Storefront, Pawn Shop, Motorcycle Club, Saloon, Highwayman's Hideout, and Meth Lab, then end turn. The current construction queue should finish. The following turn, just queue up a repeating batch of Scoundrels and end turn again. Next turn, you should have a pile of 20-something Scoundrels built, end turn again. I didn't bother moving any units, and other cities that finished their construction queues were set to produce Espionage. Now, 20-something assorted criminals should spawn, with some immediately attacking the units in the city. In my test one attacked and died to a Police APC, and a second attacked and withdrew from another Police APC. All sea and air units in the capital, along with subdued animals and Great People, should disappear as if captured, and one Cutthroat pillaged the nearby Stone Quarry and wandered off to the southeast.

I'm fairly certain the pillager is the same criminal that attacked and withdrew from the Police APC, and it seems highly likely that he's also the one that's causing the disappearance/destruction of the sea, air, and noncombatant units in the Capital. I think the other pillagers I mentioned may be similar cases, in that they attacked and withdrew from some unit in the city upon spawning before setting off to pillage. Note that the nearby stacks of Steampunk Workers and assorted Subdued Animals go untouched.

A forced recalc via Ctrl-Shift-T didn't appear to change anything. At no point were any Crime (X) buildings visible in city, nor did the total crime value become positive.

It is quite possible that the spawning is somehow being based on the change in the Crime value, or perhaps the change in the rate of change of Crime, rather than the total amount. After all, a single-turn production of over two dozen Scoundrels is a significant change in the rate of Crime, and subsequent turns the spawning Criminals would produce a sufficient change on their own to continue the cycle. In this scenario, ending the cycle would be due to single-turn production of sufficient Police to negate the change. I don't recall ever moving police forces into the city from outside of it, and for most of the initial period of spawning I was producing assorted other things in the city. I'm not certain, but I believe the end of the spawning cycle occurred after I put a full turn's production towards Police APCs.

However, even disregarding the Crime values, many of the criminals spawning should not have been able to due to lack of the related building. I was getting Street Gangs (Meth Lab), Biker Gangs (Motorcycle Club), Robbers (Pawn Shop), Mobster Cars (Mob Storefront), Scoundrels (Conspirator's Hideout, present in city), Cutthroats (I forget), and Assassins (Assassin's Den, present in city).
 

Attachments

  • Theodora AD-0350.zip
    4 MB · Views: 63
Top Bottom