Merging Chests

by Atria

Enables merging of multiple chests into one entity. Supports merging of arbitrary number of chests (configurable in mod settings).

Content
21 days ago
0.13 - 2.0
117K
Storage

i Huge performance increase with a few minor changes...

5 years ago

The load times were bugging me, but I could not decide on a set of sizes I wanted to restrict myself to.
So, I did what any sensible person would so and resorted to stupid, ugly hacks. :D

First, I added a bunch of optional dependencies. I added optional dependencies for all of Angel's mods, all of Bob's mods and the ShinyGFX/Icons series of mods. (Mods with many dependencies get loaded later and ShinyIcons was already pretty late in my load order.)

Second, I renamed data-updates.lua to data-final-fixes.lua.

These two changes together resulted in WideChests being loaded absolutely last in my load order and made all other mods load a bunch faster (less entities to parse).

You can use the second change without any impact since your mod has no interdependencies. The first change is really really ugly, but it works as long as you depend on a bunch of mods that almost everyone has installed.

5 years ago

I'm not sure how would changing load order decrease load time. The number of loaded entities is still the same. Unless other mods are going through all entities already present, then it would make a difference. First hack is out of the question, since everybody have different mod list. The second hack might work, but it may break other mods that are in same load stage (like SqueakThrough which modifies hitbox of all entities). I'll test around and let you know.

5 years ago
(updated 5 years ago)

that are in same load stage (like SqueakThrough which modifies hitbox of all entities)

Good point, I never had merged chests close enough to test this.

Unless other mods are going through all entities already present, then it would make a difference.

That's basically what's happening... if you observe load times in a terminal, every mod being loaded after WideChests takes significantly longer to load. - It's still an ugly hack though.

5 years ago

Mods are loaded in natural sort order so WideChests mod should be loaded almost at the end anyway. Unless some mod specifically depends on it. I had a talk with the developers and they don't recommend pushing creation of entities to later stages of data load. Could you give me the mod loading part of factorio log? For my current modlist the WideChests are loaded 5th from bottom (only mods in data-final-fixes are loaded after it).

5 years ago
(updated 5 years ago)

Here's my load order for the data-updates phase:
35.113 Loading mod aai-vehicles-chaingunner 0.4.1 (data-updates.lua)
35.553 Loading mod aai-vehicles-hauler 0.4.2 (data-updates.lua)
35.987 Loading mod aai-vehicles-miner 0.4.7 (data-updates.lua)
36.422 Loading mod aai-vehicles-warden 0.3.2 (data-updates.lua)
36.855 Loading mod ammo-loader 0.17.46 (data-updates.lua)
37.296 Loading mod angelsaddons-cab 0.1.3 (data-updates.lua)
37.734 Loading mod angelsaddons-petrotrain 0.4.0 (data-updates.lua)
38.171 Loading mod angelsaddons-smeltingtrain 0.2.0 (data-updates.lua)
38.619 Loading mod beautiful_bridge_railway 0.17.3 (data-updates.lua)
39.052 Loading mod bobinserters 0.17.5 (data-updates.lua)
39.486 Loading mod boblibrary 0.17.4 (data-updates.lua)
39.980 Loading mod CanalBuilder17 0.0.1 (data-updates.lua)
40.456 Loading mod deadlock-beltboxes-loaders 2.2.0 (data-updates.lua)
40.932 Loading mod DeadlockCrating 1.5.0 (data-updates.lua)
41.408 Loading mod Enhanced_Map_Colors 1.4.9 (data-updates.lua)
41.892 Loading mod Noxys_Waterfill 0.1.3 (data-updates.lua)
42.374 Loading mod textplates 0.4.6 (data-updates.lua)
42.844 Loading mod WideChests 2.2.2 (data-updates.lua)
43.857 Loading mod alien-biomes 0.4.15 (data-updates.lua)
44.587 Loading mod bobequipment 0.17.2 (data-updates.lua)
45.254 Loading mod bobores 0.17.4 (data-updates.lua)
45.960 Loading mod bobtech 0.17.3 (data-updates.lua)
46.634 Loading mod Nanobots 3.0.10 (data-updates.lua)
47.324 Loading mod aai-programmable-vehicles 0.5.28 (data-updates.lua)
48.014 Loading mod bobplates 0.17.9 (data-updates.lua)
48.704 Loading mod Dectorio 0.9.14 (data-updates.lua)
49.399 Loading mod AsphaltRoads 1.1.7 (data-updates.lua)
50.101 Loading mod bobassembly 0.17.4 (data-updates.lua)
50.812 Loading mod bobelectronics 0.17.5 (data-updates.lua)
51.511 Loading mod bobgreenhouse 0.17.0 (data-updates.lua)
52.210 Loading mod boblogistics 0.17.11 (data-updates.lua)
52.912 Loading mod bobmining 0.17.3 (data-updates.lua)
53.616 Loading mod bobpower 0.17.7 (data-updates.lua)
54.322 Loading mod bobrevamp 0.17.4 (data-updates.lua)
55.026 Loading mod bobwarfare 0.17.10 (data-updates.lua)
55.734 Loading mod Hovercrafts 0.17.13 (data-updates.lua)
56.430 Loading mod angelsrefining 0.10.13 (data-updates.lua)
57.145 Loading mod beautiful_bridge_railway_bob_fix_updated 0.1.5 (data-updates.lua)
57.807 Loading mod BiggerCargo 0.17.1 (data-updates.lua)
58.472 Loading mod bobmodules 0.17.4 (data-updates.lua)
59.145 Loading mod bobsflowcontrol-updated 1.0.5 (data-updates.lua)
59.832 Loading mod bobvehicleequipment 0.17.5 (data-updates.lua)
60.525 Loading mod deadlock-integrations 2.0.11 (data-updates.lua)
61.186 Loading mod JinksFixes 0.2.0 (data-updates.lua)
61.862 Loading mod miniloader 1.8.0 (data-updates.lua)
62.535 Loading mod Orbital Ion Cannon 1.7.2 (data-updates.lua)
63.214 Loading mod vtk-armor-plating 0.6.0 (data-updates.lua)
63.900 Loading mod Aircraft 1.6.6 (data-updates.lua)
64.572 Loading mod angelsaddons-oresilos 0.5.1 (data-updates.lua)
65.262 Loading mod angelsaddons-warehouses 0.4.1 (data-updates.lua)
65.941 Loading mod angelspetrochem 0.8.6 (data-updates.lua)
66.663 Loading mod PickerTweaks 2.1.0 (data-updates.lua)
67.344 Loading mod PickerVehicles 1.0.4 (data-updates.lua)
68.029 Loading mod angelssmelting 0.5.7 (data-updates.lua)
68.731 Loading mod betterCargoPlanes 1.0.8 (data-updates.lua)
69.422 Loading mod ShinyBobGFX 0.17.9 (data-updates.lua)
70.120 Loading mod ShinyBob_Techs_Update 0.17.2 (data-updates.lua)
70.814 Loading mod vtk-deep-core-mining 1.17.5 (data-updates.lua)
71.509 Loading mod angelsbioprocessing 0.6.2 (data-updates.lua)
72.197 Loading mod ShinyAngelGFX 0.17.1 (data-updates.lua)
72.895 Loading mod angelsindustries 0.2.0 (data-updates.lua)

As you can see, WideChests is loaded as one of the first 20 mods. This start is from after I've limited the number of chests severely via whitelist. Before that, each mot after it (about 130) took roughgly 1 or two seconds to load... a whole game start was expanded from 154 seconds to 1248 seconds.

5 years ago

Thank you for log, now I understand. I thought the game loads mods in natural order and if it encounters a mod with dependencies not currently loaded, it loads it and then continue with depth 1. But the game actually first loads all the mods without dependencies, in natural order. And then it repeatly loads mods with dependencies already loaded in previous steps until everything is loaded.

I'm not sure how address this. Adding dummy dependencies is out of the question and I wouldn't like to move my mod to data-final-fixed. I'll think about it and get back to you once I'm back from work.

5 years ago
(updated 5 years ago)

I was already going to try to add support for Bob's chests. So I'll try implement optional dependency on boblogistics which will help you a little with the load time. Full solutions to your problem seem to be too hacky so I won't create any special case for it. The whitelist of available chests can be expanded anytime you need new chest without it affecting current saves (as long as you only ADD to it).

Or just continue to use your modified version of the mod.

5 years ago

I don't really want to maintain a local fork for such a stupid idea, and you're right, moving it to final-fixes breaks (at least) squeak through, probably others, so I'd have to live with all finals being loaded after WideChests in any case. I managed to find an acceptable whitelist for the time being... guess that'll have to be enough unless the devs implement smarter loading of mods.

In any case, thank you for your time even looking at this.

New response