OptimaUPS Mod

This is the place to request new mods or give ideas about what could be done.
Post Reply
blazespinnaker
Filter Inserter
Filter Inserter
Posts: 446
Joined: Wed Sep 16, 2020 12:45 pm
Contact:

OptimaUPS Mod

Post by blazespinnaker »

Ok, not sure about the name, but it's based on the discussions here

viewtopic.php?f=6&t=91587&p=530292#p530292
viewtopic.php?f=6&t=82060
viewtopic.php?f=5&t=88414

The idea being that factorio redundantly processes a lot of duped factories and if you start bumping up against UPS issues, you can squeeze out a few more KSPM via some factory hacking but that's it.

A mod which reduces redundant processing would allow for a much larger and more sophisticated train network while still being able to tweak your core factories. At some point of course, you will hit the limits, but the mod should extend things out quite a bit.

I have done a forked proof of concept using factorissimo for my base and it was fairly easy to implement. I use simple estimation techniques of input/output based on the parent factory. It works sufficiently for my personal purposes in reducing UPS consumption which I'm running into rather heavily.

It also has an intriguing and very useful side benefit of being able to make updates to core factory designs without having to redundantly replicate them everywhere.

However, if there is broader interest, I would create a new mod for this, as factorissimo isn't really about this problem (so I've been told) and I don't believe the mod owner wishes to be forked.

The new mod would be MIT licensed and anyone can fork or even take over ownership if they are particularly interested and can do a better job. It should, imho, just be about optimizing UPS.

The mod would also ideally work for nuclear factories, so you don't have to resort to fields of solar panels. No guarantees there just yet.

Ssilk has a suggestion regarding a deterministic approach that doesn't require estimation of inputs and outputs I discuss here - viewtopic.php?p=530292#p530292

It's an interesting idea and I just wanted to see if folks would want something like this, or even just the mod itself. It basically involves syncing up all factories (parent and child clones) that start from total empty state.

The implications of the idea is that as long as a synced child has enough supply to match the input of the parent, it can continue to produce whatever the parent is producing. If children get desynced by not having enough supply, they have to wait for a full wipe of the parent to rejoin production. Adding new children factories requires a full wipe of parent/children factories.

Broadly speaking, this would be fairly easy to implement, though I don't know if it can be done with the level of determinism he's hoping to achieve and still be UPS efficient.

My thought is just to support cargo / fluid wagons. Basically, a train stop would be adjacent to the factory and that would be your input. Similarly, a train stop would be adjacent for output.

Factories could be of arbitrary size. Even interior train systems could be allowed as long as they don't go outside of the factory. I was thinking about requiring a 'factory floor' to be installed before a child factory is allowed, but those sort of extra game features are subjective and this really is just meant to be about optimizing UPS.

Another thought is that you have to pre-print down a copy of the parent factory and the mod does a match of all the entities to see if it qualifies as a child. It would list any mismatches. This is the preferred approach in my eyes.

Changing parent factory entities would force a full reset and would have inventory implications respective to the full set of parent/child factories. Eg, if you remove an assembler, you get assemblers into your inventory from all factories. If you add one, you need to have enough for all factories. How this turns out in practice will depend on the APIs and what they can do here.

It may require an external surface to avoid logistics networks from being abused, though honestly, exploits like that aren't really a huge concern. It's more about accidental input that the player is unaware of that is a concern. /editor is always a console command away for those determined to subvert default game play.

Mining operations, pumpjacks and labs would probably not be done inside of these factories. Not totally sure about labs. The other two can theoretically be done, but not sure how fun that would be.

I'm not really concerned about biters but willing to take input on that. Biters have been eradicated from my core map due to artillery on islands with logistics and a very long artillery range.

I will try to see if I can dupe the tiles used for the parent factory, they'd just be cosmetic in the child factories. Not sure if that's possible though, so art is something to think about here.

Like I said above, I have this working as a POC already for my own use, but interested in doing the above if other folks would seriously use this.

In particular, looking for detailed feedback on implications to game play, especially from those familiar with the factorio lua apis. Certain things I know how to do and are quite simple, others not so much.

Some specific lua questions for experienced mod developers:

- how best to track changes a user makes to a parent factory in real time.
- I am assuming the selection-tool-item will provide anything required for the mod, though I have yet to play with that. I may end up using some aspect of blueprints here if customized / tailored blueprint like functionality is not possible.
- Factorrisimo uses belts, chests and pipes, but I'm assuming something analogous exists for cargo / fluid wagons and you can manipulate as required. If not, chests and pipes should be fine. F2 has some useful ideas around UPS efficiency here to borrow from.
- How to re-use factorio tiles but only for cosmetic purposes
- thoughts on monitoring input/output in a UPS efficient manner, for factories and power suppliers.

Surfaces, inventory management, chest manipulation I'm familiar with from the above POC.

Ideally, the syncing talked about above and measuring input / output costs would be done in a highly efficient UPS manner. Logically speaking, tight loops around measuring input/output would have to be avoided. I'm less concerned about absolute correctness than I am about optimizing UPS, however there are multiplayer implications when it comes to absolute correctness.

At megabase scale where UPS is an issue, these type of details seem less important than being able to extend the game significantly.

TBH, just using simple estimation techniques in my POC above results in about 0.1% error rates (if that) compared to deterministic production. The determinism is not that super relevant to me, but others have said its relevant to them as this is what is cool about Factorio, so I am considering the factory syncing approach which should theoretically be exact, at least from this syncing perspective.

I've read there are deterministic aspects that multiplayer relies on. If multiplayer mode can't be done without full determinism and if full determinism can't be done without seriously harming UPS, than I'd argue in favor of not supporting MP.

However, I am assuming there must be ways of syncing up clients other than having a fully deterministic play loop. I haven't really tackled MP just yet and input appreciated.

I haven't thought through all the issues, and there's really only so many minutes in the day you can devote to factorio.

Please chime in with your two cents if you know more about something I've missed above. Bonus points for elegant, fun ideas that are easy to implement.
OptimaUPS Mod, pm for info.

blazespinnaker
Filter Inserter
Filter Inserter
Posts: 446
Joined: Wed Sep 16, 2020 12:45 pm
Contact:

Re: OptimaUPS Mod

Post by blazespinnaker »

Alternatively, if there is limited interest, I will try to convince the factorissimo mod owner to let me just share my factorissimo changes via github. This should help deal with concerns about forking and confusing the ecosystem.
OptimaUPS Mod, pm for info.

erickeeper
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Jul 20, 2020 7:18 pm
Contact:

Re: OptimaUPS Mod

Post by erickeeper »

I've considered doing the same thing. I have personally opted to design a subfactory, test it, then (sloppily) mod in a single entity that replicates the behavior.
If your mod had already existed, I would have absolutely used it.

blazespinnaker
Filter Inserter
Filter Inserter
Posts: 446
Joined: Wed Sep 16, 2020 12:45 pm
Contact:

Re: OptimaUPS Mod

Post by blazespinnaker »

Apparently extending UPS via simulation is a controversial concept in Factorio :) To keep the general peace and avoid any potential and unnecessarily contentious discussions, please direct PM me any interest you have rather than posting here publicly. I am happy to share ideas and code I've forked from Factorissimo2 in this manner. F2 is licensed MIT according to the mod portal.

https://mods.factorio.com/mod/Factorissimo2

Cheers
OptimaUPS Mod, pm for info.

Xorimuth
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: OptimaUPS Mod

Post by Xorimuth »

blazespinnaker wrote:
Mon Jan 11, 2021 3:44 pm
Apparently extending UPS via simulation is a controversial concept in Factorio :) To keep the general peace and avoid any potential and unnecessarily contentious discussions, please direct PM me any interest you have rather than posting here publicly. I am happy to share ideas and code I've forked from Factorissimo2 in this manner. F2 is licensed MIT according to the mod portal.

https://mods.factorio.com/mod/Factorissimo2

Cheers
I think that the controversy is 2-fold:

(1) People thinking that it shouldn't be in the base game.
(2) People thinking that it isn't possible to create a mod that improves UPS in this manner.

IMO neither of these are unreasonable... but if you have created a mod that does this then I'd encourage you to share it. (1) does not apply (we are now talking about a mod) and (2) is not relevant if you have in fact managed to make something that improves UPS and is easy enough to use. Even if you haven't managed to get it to work well enough yet, I'm sure that no one would object to seeing your progress and you may get some helpful ideas.

blazespinnaker
Filter Inserter
Filter Inserter
Posts: 446
Joined: Wed Sep 16, 2020 12:45 pm
Contact:

Re: OptimaUPS Mod

Post by blazespinnaker »

Fair enough. As I mentioned, please PM me directly if interested. Folks are welcome to use this thread to discuss further, I ain't a mod, but I won't be replying.

And of course, don't take that as a lack of my interest in this feature area.
OptimaUPS Mod, pm for info.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2333
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: OptimaUPS Mod

Post by Jap2.0 »

Xorimuth wrote:
Mon Jan 11, 2021 4:24 pm
I think that the controversy is 2-fold:

(1) People thinking that it shouldn't be in the base game.
(2) People thinking that it isn't possible to create a mod that improves UPS in this manner.
(3) People worrying that it will simplify mechanics.
There are 10 types of people: those who get this joke and those who don't.

BicycleEater
Inserter
Inserter
Posts: 45
Joined: Sun Jul 26, 2020 4:05 pm
Contact:

Re: OptimaUPS Mod

Post by BicycleEater »

Jap2.0 wrote:
Tue Jan 12, 2021 8:17 pm
Xorimuth wrote:
Mon Jan 11, 2021 4:24 pm
I think that the controversy is 2-fold:

(1) People thinking that it shouldn't be in the base game.
(2) People thinking that it isn't possible to create a mod that improves UPS in this manner.
(3) People worrying that it will simplify mechanics.
(4) People worrying that it will be really hard to implement, unreliable and buggy/exploit heavy.

A mod could only do this if the mod didn't care about cheat-ability.

Post Reply

Return to “Ideas and Requests For Mods”