Rampant

by Veden

Improves the enemies tactics by using potential fields (pheromones) allowing probing of defenses, retreats, reinforcements, counterattacking, breaching, raids, rallying death cry, and player hunting. Uses blockable biter projectiles. Adds new Enemies which can be disabled in mod settings. Difficulty setting in mod options menu.

Content
1 year, 2 months ago
0.13 - 1.1
124K
Enemies

b Crash occurring at a consistent time

The version of Rampant
0.18.17

What is your map evolution
0.2718

Was Rampant added at the start of a game
Yes

A brief description of what you are experiencing
A crash (or well, the game hangs for a seemingly infinite time, no crash properly occurs. No response to any input, and alt f4 doesn't work, only ending the process via task manager seems to have worked), happens consistently at 12:30:07 currently, although has happened occasionally before, but unsure if rampant was culprit on previous occurrences - an autosave just occurred before this one allowing for some experimentation.

Via disabling a mod with almost no effects, 1 tank 100 fish, Rampant re-initializes chunks and no crash occurs when this happens, however by commenting out "prepWorld(true, natives.activeSurface)" on line 665 of control.lua and thus disabling the re-initialization, the crash does happen. Theoretically, rampant could still be innocent, but I find it quite improbable.

A brief description of want you are expecting
It not to hang? No matter my actions leading up to 12:30:07 from 12:30:00 it seems to consistently crash

Are you using custom world generation, if so what mods?
No, unless a mod changes something minor that I am unaware of.

Add a save if you can't easily describe the specific issue you are having.
https://drive.google.com/file/d/1l5YAz5TKn0DNPbPhd_NOmX8ccuaX2DUc/view?usp=sharing
https://drive.google.com/file/d/1GBuNQa1ir2OVVyjdbzhr40sQI1GwlLZE/view?usp=sharing

I'll try doing some debugging myself, but not really sure how rampant works, and don't really feel like reverse engineering it right now. If I figure something else out, I'll let you know.

4 years ago
(updated 4 years ago)

Ok, further testing narrowed down the thing causing it to onGroupFinishedGathering, not sure why that's causing it though... I'll play around a bit more, maybe I'll figure something out.

Found this out by commenting out various hooks, and of course it was the second last one that actually causes the crash...

Edit: happens on tick 2700450, found via crashing(accidently, because I'm terrible with LUA) and printing tick when onGroupFinishedGathering fires.

Edit 2: It seems "group.set_command(cmd)" on line 178 of the settleMove function in SquadAttack.lua causes the crash, no idea why though. Still trying to figure it out, but it's been 4 hours now, so thinking I'll be taking a break. My guess is the location their targeting is in water or something, causing it to hang.

4 years ago
(updated 4 years ago)

I am an idiot, and clicked quotation instead of edit for this post, so ignore this unless I find a delete button.

Ok, new hypothesis that I'm semi-certain of, seems that in the case of my crash the group had 0 members (some minor testing shows that other groups have more than that, generally between 1 and 9), which I'm assuming the game treats as some sort of error and hangs. I'll create a mini mod myself testing this in a new world without any other mods, and if that's the case guess maybe it's moreso a bug report for factorio itself not having a handle for such instances.

ps seems my zero member hypothesis might be wrong? further testing still needed but I got another case of a 0 member group being found. Temporarily disabled the command that causes crashes when #group.members=0, so unsure if that's the cause.

Ok, tested with my own mod and it seems that when there are 0 members, a crash occurs. Reported it to factorio devs, although guess it's not really a bug... Having some error display instead of it just hanging would be nice, though, so hopefully they can add that. https://forums.factorio.com/viewtopic.php?f=7&t=88435

Still, the bug remains of why sometimes a group has 0 members. I'm not sure if I feel like continuing this bug hunting of mine, but if I do and end up finding anything I'll post an update again. But for now, that's all.

Ok, more testing and I think this is partially a vanilla bug, and partially your mod handling groups weirdly. on_unit_group_finished_gathering provides a group with 0 members in it, which should normally be culled off, resulting in this crash. I'd think the on_event should have a check for when the group has 0 members to not trigger if that's the case, but think something with your mod is causing groups with 0 members to stay around for too long which is also part of the problem, if that makes any sense. Guess the simple solution for now is to disable the event for when there are 0 members.

Still though, that sometimes a group has 0 members is still a bug, so if that could be fixed it'd be nice. Probably doesn't cause a crash though, so not gonna touch it.

4 years ago

Part of the problem is that getting unit group size is an extremely expensive operation.
Having the check in finished_gathering seems reasonable, I would want to profile the function to see the performance impact.

4 years ago

Thank you though for putting in the time to debug this problem.

New response