Oarcinae / FactorioScenarioMultiplayerSpawn

A custom scenario for Factorio which provides each player a unique starting spawn point in a multiplayer game.
MIT License
49 stars 30 forks source link

Construction robot self destruction #134

Closed bplein closed 1 month ago

bplein commented 3 years ago

I am seeing construction robots self destruct if they are very busy traveling over long distances.

I have grepped through this code and haven't seen anything specific to robots.

I have a few other mods in place, but none of them mention robots in their code either.

Is there a way to turn on some LUA that would log entity destruction and maybe point to the code line and file that did it?

lewisandrew commented 3 years ago

I encountered this also and mentioned it in the Discord server, but didn't look into it too far. I'm currently seeing similar bizarre behavior where long electric poles are getting deleted/destroyed out of the blue. I'm going to turn off regrowth setting (chunk deletion) and see if that fixes the issue image

lewisandrew commented 3 years ago

Turning that setting off didn't fix this related issue. I don't have bots traveling very far distances over water much anymore, but I think this maybe the same root cause image

bplein commented 3 years ago

I've had construction bots in my personal roboport self destruct too, but I can't swear if they were in or outside my direct "vision", i.e. mass deconstruct of a forest, I run in and run away and next thing you know, bots are dying.

Then again, I've had individual small groups of bots fly across a great map distance to catch up with me if I took a train and forgot to wait for them.

For bots, it only seems to occur if there's a lot of them flying in one area.

Oarcinae commented 3 years ago

Yeah this is definitely an odd one... We discussed on discord but I have no idea what I could be doing in my scenario. This might be worth reporting on the official factorio forum for help. This might be something obscure where my chunk deletion caused robot pathing to fail and subsequently to self destruct or some weird unknown side effect like that... I don't have time to look into this myself and haven't been touching the scenario or the game for quite awhile now, please let me know if you find something that I can do to help fix this.

bplein commented 3 years ago

I've reported it there and basically they want me to test removing every mod one at a time.

I actually find it sort of cool.

Tired bots trudge on. But if you overexcite a bunch of them to the point of exhaustion, they expire and die.

Sort of like working animals and humans.

Not a big deal actually. But if you had some way to log items destroyed by your map reclamation or some other hints at LUA I could add to log things, id be happy to try it.

Cheers.

lewisandrew commented 3 years ago

I commented out all the regrowth related code being called outside of the regrowth_map.lua. Couple hours of playing and I haven't seen the issue again yet. Will update again in the future if I see it happen

vfinn commented 2 years ago

Any update on this ? I'm working on a mod that removes the player - merging "Brave New World" with Oarc. This means you MUST use bots, you start with 100 construction, and 50 logistic. Since power is the first thing to get the bots need to work pretty hard at the start, and it is likely you will run out of power. I've had 88 of the starting 100 construction bots self destruct going on low power to remove trees on the perimeter. The base is increased from normal 32 CHUNK_SIZE to 48. This will be the thing that keeps me from proceeding with this Factorio bots dieing .

vfinn commented 2 years ago

I noticed this in config: -- Cleans up unused chunks periodically. Helps keep map size down. ENABLE_REGROWTH = true

I'll set this to false and see what happens... I played for four hours on Brave New Oarc, all bots remain. I may selectively destroy chunks. Possibly clean up manually after people log off, to speed up the map.

I also found a race condition where chunks were not deleted, on next tick, since the tick was set, next tick occurred that would have triggered destruction of a tagged area, but it didn't until I added +1 to the current tick, tagging it in the next loop to perform the clean up. I test this by resetting a player. I can post specifics to this, once I get on the other PC.

vfinn commented 1 year ago

A fix for this was submitted today into vfinn/FactorioScenarioMultiplayerSpawn branch. If anyone would like to test merge: oarc_utils.lua and regrowth_map.lua into your game save or mod for a new game. Run the bots across a large span away from main base to build - say a long wall, or defenses. When the bots run out of energy they should just slow to 20% speed. If a regrowth occurred while they are travelling long distance they would previously explode in groups. This fix keeps them from exploding.

JustGoFly

William0216 commented 5 months ago

A fix for this was submitted today into vfinn/FactorioScenarioMultiplayerSpawn branch. If anyone would like to test merge: oarc_utils.lua and regrowth_map.lua into your game save or mod for a new game. Run the bots across a large span away from main base to build - say a long wall, or defenses. When the bots run out of energy they should just slow to 20% speed. If a regrowth occurred while they are travelling long distance they would previously explode in groups. This fix keeps them from exploding.

JustGoFly

If you've confirmed this fixes it you should probably make a pull request so @Oarcinae sees it. Would be awesome to see this old bug finally squashed.

vfinn commented 5 months ago

Oarcinae did merge this into FactorioScenarioMultiplayerSpawn last year

Oarc code

JustGoFly

Oarcinae commented 1 month ago

Going to close this since it seems to have been fixed :) Thanks JustGoFly!