Autobuild

by therax

Autobuild allows your character to automatically build, deconstruct, and upgrade nearby ghosts. A more efficient alternative to mods like Bluebuild.

Utilities
4 months ago
0.17 - 1.1
18.0K

b Catastrophic Load and Save times and crashes.

5 years ago

Autobuild 0.1.2
Factorio 0.17.24

With this mod, a small savefile that takes me 2 seconds to load into takes 56 seconds instead. The bar fills up normally but then the game freezes and stays on 100% for 54 extra seconds. That's 28 times longer!!

On a larger savefile that takes 15 seconds to load up without Autobuild it instead takes 70 seconds with the mod installed!

And these extended load times also affect saving which means 2 seconds of autosave every 5 minutes instead becomes a minute of autosave every 5 minutes.

Another problem is that the mod crashes when you die while autobuilding is enabled and in other circumstances...
https://www80.zippyshare.com/i/LMQAzheF/459661/ousu%28190330-204651-58%29.jpg
https://www80.zippyshare.com/i/FyBTfBiO/7902/ousu%28190330-220451-45%29.jpg

5 years ago

Thanks for the report! I can work around the problem with Junk Train, and fix the issue with deconstruction while waiting for respawn.

Can you post a sample of saves that are taking so long to load and save? Autobuild stores records of ghosts and entities to be deconstructed in the save, but it should not be that much data, unless you have millions of ghosts on your map.

5 years ago

I'm having problems with my Creative Mod maps where I have instant blueprinting enabled. My guess is that Autobuild sees the ghosts being placed but not that CM builds the entities. So every time I place a blueprint or paste I increase the data storage used by Autobuild and deconstruction removes entities, not ghosts (since ghosts are removed when instantly blueprinted), so deconstructing doesn't reduce the storage either. And since I constantly place and remove Brobdingnagian blueprints for my megabase. I could definitly reach millions of ghosts "in" Autobuilds storage afters tens of hours on a map without any actual ghosts visible on the Nauvis if my hunch is correct.

I can post a save tomorrow if you still need it then.

5 years ago

That sounds like a reasonable diagnosis.

CM is generally bad at raising the proper events when it acts with one of its cheats, like instant blueprinting or instant deconstruction. In fact, instant deconstruction likely makes the problem worse because both Autobuild and CM will get the event that an entity was marked for deconstruction, and Autobuild will make a record of that, and CM will instantly destroy the entity but not raise an event. So either way Autobuild storage just continually increases.

Mooncat hasn't been around since 0.15, so I'm not expecting it likely that Creative Mod will get any updates to make it play better with other mods in these sorts of cases.

Autobuild does clean up its storage, removing entities that no longer exist because something like CM has silently destroyed them, but only when actually trying to do automatic construction or deconstruction, i.e. when it's enabled and the player is stationary for a while. I'm guessing that when you're experimenting in CM you don't have the Autobuild toggle active, and/or aren't lingering with the character near where all the instant (de)construction is happening. I could actively sweep even when the Autobuild toggle is disabled, but that has UPS costs. :(

It might make more sense to just mark Autobuild as incompatible with CM, but it means you'd have to change your set of active mods when going back and forth from your creative mode maps and actual gameplay where you want to utilize Autobuild.

5 years ago

We could
(1) Patch creative mod ourselves and submit the fix to the current maintainer.

(2) Sweep faster and while the player is moving. Increase sweep speed (entities checked per sweep tick) progressivly whenever something is removed from the cache and lower it whenever a ghost checks out. If you check 1 ghost per tick constantly the UPS hit is minimal. If something is removed, increase ghosts checked/ticked by 1 each time and lower by 1 (or maybe another number for decrements?) each time the ghost if found on Nauvis. This means that as long as Instant Blueprints aren't used the sweeping process can go on all the time without affecting performance. When Instant Blueprints are used there will be a large amount of invalid ghosts cached and the sweeping will speed up temporarily so it can invalidate the relevant cached ghosts really quickly and then go back to normal operation. Instant Blueprints tank your UPS temporarily anyways, and this sweeping process would be still be a bit spread out over time so it would hit your UPS less than IB anyways.

The current sweeping rate and limitation to when you stand still just isn't enough when you instantly blueprint and deconstruct tens of thousands of entities often.

(3) A command on the command line that sweeps through the entire cache and another command that disables autobuild (and the cache) for that save (so I don't have to disable the mod just to switch to my creative world). I don't need autobuild on saves where I use instant blueprints anyways.

(4) Autobuild could destroy the cache when you (or all online players in multiplayer if cache is shared) disable autobuild and progressivly rebuild the ghost cache with increasing distances when it is enabled again. UPS wouldn't be affected that much if the cache rebuilding rate is limited. Whenever you enable autobuild, move or change reach value (last to only when enabled) you trigger the progressive cache rebuild in case it completed for a specific reach and position.
This would mean that it takes a while before anything is autobuilt when you have recently enabled AB, have a very far reach and stand far away from nearest ghost. The reach would have to be kilometers and not just screen covering for this to noticable though. Since you currently sweep the cache this is maybe not a great idea but I've already written it down...

5 years ago

I did some experimenting with a variant of 2) that used a fixed sweep rate, which almost entirely resolved the problem with Instant (de)construction. Unfortunately the approach I used to make it UPS-efficient put even more data into the save, and made load/save times times with actual maps with 100k ghosts unacceptable (e.g. paving a base in concrete).

I'm working on a new approach now that doesn't save anything in the save at all, but builds up the cache entirely in memory. It seems pretty promising so far.

5 years ago

Can you give v0.2.0 a try? This is a pretty substantial rewrite so I expect there will probably be bugs.

5 years ago

I haven't tried your mod, but reading this report reminded me that Nexela had this problem with Creative Mode Auto Build and Destroy when NanoBots was enabled. You might find something that could point you in a good direction to fix it by taking a look at that or you could try catching him on discord and asking. Perhaps just checking at the end of the mod load to see if Creative Mode is installed and Instant Build/Destroy is enabled.

5 years ago

I had no internet connection when I had some spare time to install the update. But problems with the old method grew slowly for like 30h. Since the cache is in RAM instead of save now I guess I would have to have a long running session instead to check for a similar type of issues so it will take some time. I'll report back if I find issues though.
Thanks for working on it :)

5 years ago

Nothing is put into the cache unless you have Autobuild turned on, so there should be no impact in a Creative Mod map where you’re not using Autobuild.

New response