[SOLVED] Request Update Modular Buildings Mod to 1.1 - Save UPS!

Looking for a mod? Have a review on a mod you'd like to share?
Magick93
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 10, 2021 9:45 am
Contact:

[SOLVED] Request Update Modular Buildings Mod to 1.1 - Save UPS!

Post by Magick93 »

Hello I would like to request an update to the Modular Buildings mod by staplergun to Factorio 1.1

https://mods.factorio.com/mod/modular-buildings

In the discussion tab we have been asking for updates since v0.17 and OP didn't answer / abandonned mod support.

Its an awesome mod that "joins" steam turbines and steam motors into single entities, saving UPS on entity count.

Would also benefit from adding "triples" of steam turbines/steam motors.

Cheers!
Last edited by Magick93 on Sat Jun 12, 2021 1:27 am, edited 1 time in total.
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 535
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: REQUEST: Update Modular Buildings Mod to 1.1

Post by Silari »

I really have to wonder if this kind of thing even makes much of a difference anymore, with the improvements made to the fluid calculations since 0.16.

So I decided to test it. Only things that had to be changed was removing the quickbar flag from the items, and removing the raise_event call and instead having create_entity raise the event.

My 1K SPM megabase running on 8 independent 8 reactor nuclear setups vs the same map after replacing most of the turbines with a double variant.
Performed 1000 updates in 5222.623 ms avg: 5.223 ms, min: 4.746 ms, max: 9.740 ms
Performed 1000 updates in 5221.348 ms avg: 5.221 ms, min: 4.788 ms, max: 9.530 ms
Performed 1000 updates in 5234.663 ms avg: 5.235 ms, min: 4.736 ms, max: 9.643 ms
Performed 1000 updates in 5237.893 ms avg: 5.238 ms, min: 4.738 ms, max: 9.793 ms
Performed 1000 updates in 5309.147 ms avg: 5.309 ms, min: 4.799 ms, max: 9.646 ms

AVG: 5.2452 ms

Performed 1000 updates in 4821.617 ms avg: 4.822 ms, min: 4.295 ms, max: 6.319 ms
Performed 1000 updates in 4751.798 ms avg: 4.752 ms, min: 4.277 ms, max: 6.227 ms
Performed 1000 updates in 4829.142 ms avg: 4.829 ms, min: 4.303 ms, max: 6.172 ms
Performed 1000 updates in 4890.245 ms avg: 4.890 ms, min: 4.407 ms, max: 6.108 ms
Performed 1000 updates in 4777.319 ms avg: 4.777 ms, min: 4.312 ms, max: 6.034 ms

AVG: 4.814
A little under 10% faster. Not bad, especially for a design not intended to make use of the double/quads.

Still some issues to fix with the mod though. For one the newly built turbines don't have any fluid connections - i think since they're placed then the old ones deleted, the connections aren't being set properly.
Also, you can't build quad turbines since it doesn't recheck after making the second double turbine - I think due to it not being able to catch the build event.


which is a lot of words to say https://mods.factorio.com/mod/modular-buildings-redux exists now. No plans on adding anything to it but it's there.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: REQUEST: Update Modular Buildings Mod to 1.1

Post by eradicator »

Silari wrote: Fri Jun 11, 2021 2:12 am which is a lot of words to say https://mods.factorio.com/mod/modular-buildings-redux exists now. No plans on adding anything to it but it's there.
Wouldn't hurt to include a real link in the description, so people can read the description of the original mod.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Magick93
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 10, 2021 9:45 am
Contact:

Re: REQUEST: Update Modular Buildings Mod to 1.1

Post by Magick93 »

Big ThankYou Silari, you're the best!

Image

Testing and Working!

Image

Reduced steam engine count from 120 to only 40 entities (20 doubles and 20 quads)!.


There is a known bug that crashes when joining quad buildings if they are currently working, have to combine buildings while iddle and then it's ok. :)

edit: Would benefit further with support for triples steam turbines mainly. Thx again
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 535
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: REQUEST: Update Modular Buildings Mod to 1.1

Post by Silari »

Shouldn't be any issues with joining them when not idle. I tested that when working on the connection issue - I was replacing turbines in my megabases nuclear setups without any problems. Maybe I missed something with engines, didn't test those as much.

Blueprinting is wacky since the double/quad buildings can't be placed since you can't get the item version of them without cheating. I THINK there's a way to tell robots what items to use to complete ghosts, so they'd just need to provide 2/4 of the base building. Would need to look into it.



EDIT: Ok strange, for some reason in certain situations it looks like the create_entity call is failing and returning nil. I have no idea why - doesn't seem to be if they're working or not, as I'm getting the crash even if they're out of range of power. And making them in the exact same positions but in a different order works perfectly fine. Maybe something wonky is going on with collision boxes - I prolly need to redo their prototype anyway to catch anything that's changed back when these were made.
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 535
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: REQUEST: Update Modular Buildings Mod to 1.1

Post by Silari »

Ok crash should be fixed. Seemed to be due to the timing of the build event we fired when making an entity, which could end with our newly made entity being destroyed, before we set the fluidbox on it.

Also I fixed blueprinting so robots will make double/quad versions using the appropriate number of the single building. This means the pipette also works and will select engines/turbines. This 'required' removing the items/recipes the mod adds, but those weren't actually being used by anything anyway.

And the mod description is now more than just a copy/paste of the summary.
Magick93
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 10, 2021 9:45 am
Contact:

Re: REQUEST: Update Modular Buildings Mod to 1.1

Post by Magick93 »

Amazing mod!

I can report UPS savings from 8% up to 15% on different power layouts. Quad buildings are the best for optimization. :mrgreen:

Entering my debug menu (F4) and enabling show-time-usage, I wrote down my UPS data to run some test before and after updating my steam engines to modular buildings.

I get small savings on Fluid manager count, marginal savings on Electric network count, but the bigger savings are on Entity update count.

The mod simplifies a bit the power poles layout challenge since you can easily connect a quad turbine with a power pole, but I'm not missing it, for great UPS savings.

Factorio is a very optimized game and this mod feels like squeezing some more optimizations. I wonder what other buildings could benefit from modular setups, without breaking the game too much? Or maybe a full dynamic approach to allow selecting multiple buildings and turning all into a single entity box, maybe that for another experimental mod..

Thankyou again Silaris, final request is to match collision rectangles of the combined entities to the single's one.
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 535
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: [SOLVED] Request Update Modular Buildings Mod to 1.1 - Save UPS!

Post by Silari »

Beyond needing less power poles, I'd imagine you can also get higher fluid throughput from chained turbines, since there's half as many fluid boxes to go through. Might not work out that way though, since they have a larger fluid box and that can slow down flow since it's based on percentage of fullness IIRC.

As for issues:
  • Collision boxes are SLIGHTLY short on the long sides, don't think it'll really affect anything in-game though.
  • Icons also need to be fixed, they're still set to the old size so they look off in the energy statistics.
  • Remnants are also wrong, since it's a normal turbine sized one shoved in the middle.
  • Health is the same as the base, should probably be doubled/quadrupled. Mining time is MUCH longer than doubled/quadrupled.
If I get some free time I'll fix em, but none of them are very urgent (maybe the icons kinda).

New 1.1.2 update solves 3/4.
Post Reply

Return to “Questions, reviews and ratings”