Optimization idea: abstraction

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Optimization idea: abstraction

Post by Deadlock989 »

One big box that feeds in ore and outputs rockets.

Wow, fun.
Image

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Optimization idea: abstraction

Post by darkfrei »

Deadlock989 wrote:
Wed Mar 11, 2020 10:16 am
One big box that feeds in ore and outputs rockets.

Wow, fun.
The mod must check if the internal factory on the inside surface has the true 100% productivity. Without this flag the internal factory cannot be started at all.

Build compact, but effective and there is another type of game success. Yes, it can be fun.

User avatar
leadraven
Filter Inserter
Filter Inserter
Posts: 354
Joined: Fri Jan 18, 2019 7:23 pm
Contact:

Re: Optimization idea: abstraction

Post by leadraven »

Deadlock989 wrote:
Wed Mar 11, 2020 10:16 am
One big box that feeds in ore and outputs rockets.

Wow, fun.
Blueprint your entire factory)

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Optimization idea: abstraction

Post by Deadlock989 »

I'm 100% sure that similar ideas have occurred to the clever people actually working on the game over the last 7 years. As pointed out by eradicator, the colossal amount of checks you would need to perform periodically would blow any so-called "optimisation" savings this could possibly generate completely off the map. This would still be the case if it was in the C++ engine. If it was done in Lua by a mod, you might as well make Factorio into a turn-based game.

But in the highly unlikely event that you managed to finesse things so that it wasn't a monster lag-spike generator and didn't produce a torrent of fudge, in the end it would all be about reducing your factory units to their lowest common denominators. You may as well hand out a post-rocket technology that gives you a special rocket silo that produces purest Win out of raw ores, water, and crude oil - it would "simulate" the same logical conclusion.

Is it an interesting systems analysis problem? Yes, if you like that kind of thing. Would it produce any performance improvement? Hell, no. Would it make a qualitatively better game? Doesn't sound like it.
Image

StephenLynx
Inserter
Inserter
Posts: 31
Joined: Thu May 04, 2017 10:55 pm
Contact:

Re: Optimization idea: abstraction

Post by StephenLynx »

leadraven wrote:
Wed Mar 11, 2020 10:07 am
It all sounds like a generic compound crafting machine. Simply make mega-assembler. But for what?
And I don't see any reason to implement it except for the entertainment of developers, but I'm sure they have other thigs to do.
Optimization. Imagine reducing UPS usage by 90%. Suddenly megafactories don't require an extremely potent rig.
Deadlock989 wrote:
Wed Mar 11, 2020 10:16 am
One big box that feeds in ore and outputs rockets.

Wow, fun.
Completely missing the point. Is not about removing complexity, is about taking shortcuts to process it.

About the issues with discovery of endpoints, the game doesn't have to scan everything all the time. Not talking about all the people that derailed into a mod, but still about an optimization: the game can perform initial checks on inserter placement. If it takes or places stuff into a track, that's a starting point. Now check where all that stuff goes and stops until something that will not be optimized is found, like a combiner, or the end is found. Then cache that information so the area is abstracted again when the player is not looking and check it again if the optimized area is changed.

Deadlock989 wrote:
Wed Mar 11, 2020 11:38 am
I'm 100% sure that similar ideas have occurred to the clever people actually working on the game over the last 7 years.
Do you remember when someone remembered them that threads existed and could be used to optimize fluid simulation? Because I do.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Optimization idea: abstraction

Post by Deadlock989 »

StephenLynx wrote:
Wed Mar 11, 2020 11:41 am
Do you remember when someone remembered them that threads existed and could be used to optimize fluid simulation? Because I do.
No, I don't. Source please.
Image

Nemo4809
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Thu Jan 16, 2020 10:49 am
Contact:

Re: Optimization idea: abstraction

Post by Nemo4809 »

Deadlock989 wrote:
Wed Mar 11, 2020 11:38 am
I'm 100% sure that similar ideas have occurred to the clever people actually working on the game over the last 7 years.
This excuse of yours is getting kind of old. The developers maybe be smart, at least IMO, but they aren't all-knowing gods.

These are the same guys than didn't realise the obvious optimization of offsetting the start of a buffer, a very old trick, and instead wasted precious memory bandwidth copying a texture over and over every single frame.
As pointed out by eradicator, the colossal amount of checks you would need to perform periodically would blow any so-called "optimisation" savings this could possibly generate completely off the map.
He also said,
Conclusion: As darkfrei says: the most realistic solution is a factorissimo style blackbox.
So some form of it can be done. (I believe the variant I proposed falls into that category - and it will have very little impact to game balance.)

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Optimization idea: abstraction

Post by Deadlock989 »

Nemo4809 wrote:
Wed Mar 11, 2020 12:29 pm
So some form of it can be done. (I believe the variant I proposed falls into that category - and it will have very little impact to game balance.)
I look forward to test-driving your flawless implementation of it. That will certainly not be "old".
Image

Nemo4809
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Thu Jan 16, 2020 10:49 am
Contact:

Re: Optimization idea: abstraction

Post by Nemo4809 »

Deadlock989 wrote:
Wed Mar 11, 2020 12:36 pm
Nemo4809 wrote:
Wed Mar 11, 2020 12:29 pm
So some form of it can be done. (I believe the variant I proposed falls into that category - and it will have very little impact to game balance.)
I look forward to seeing your flawless implementation of it.
I don't know if it can be done with the modding API as it currently exist - and I'm too lazy to find out.

But it can definitely be done by the developers.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Optimization idea: abstraction

Post by Deadlock989 »

Nemo4809 wrote:
Wed Mar 11, 2020 12:37 pm
I don't know if it can be done with the modding API as it currently exist - and I'm too lazy to find out.

But it can definitely be done by the developers.
Translation: I don't know what I'm talking about.
Image

Nemo4809
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Thu Jan 16, 2020 10:49 am
Contact:

Re: Optimization idea: abstraction

Post by Nemo4809 »

Deadlock989 wrote:
Wed Mar 11, 2020 12:38 pm
Nemo4809 wrote:
Wed Mar 11, 2020 12:37 pm
I don't know if it can be done with the modding API as it currently exist - and I'm too lazy to find out.

But it can definitely be done by the developers.
Translation: I don't know what I'm talking about.
If you are talking about yourself, yes I agree.

PS: In before thread lock. It's inevitable at this point with people like you trying to antagonize everyone else at every turn while adding nothing to the discussion other than "no, it can't be done because I said so.". No attempt to refute the arguments proposed. Just ad hominem attacks.

StephenLynx
Inserter
Inserter
Posts: 31
Joined: Thu May 04, 2017 10:55 pm
Contact:

Re: Optimization idea: abstraction

Post by StephenLynx »

Deadlock989 wrote:
Wed Mar 11, 2020 12:38 pm
Translation: I don't know what I'm talking about.
I know it will sound bad, but how much experience with programming do you have outside factorio modding? Your github seems empty.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Optimization idea: abstraction

Post by Deadlock989 »

Nemo4809 wrote:
Wed Mar 11, 2020 12:41 pm
If you are talking about yourself, yes I agree.
Straight from the kindergarten playground repertoire.

To summarise, you don't know if the game is capable of it, but a spitballed idea you had on the toilet will, if researched and implemented correctly by a team of professionals who know the game inside out but had a mysterious blind spot all along exactly where your penetrating insight lies, result in a massive performance increase for free.

Sure.
Image

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Optimization idea: abstraction

Post by Deadlock989 »

StephenLynx wrote:
Wed Mar 11, 2020 12:42 pm
I know it will sound bad, but how much experience with programming do you have outside factorio modding? Your github seems empty.
What, you want my CV now? Go fish.
Image

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Optimization idea: abstraction

Post by Klonan »

Maybe another dev will correct me if they feel otherwise,
But this is something we are not really interested in doing

accuracy and granularity of the simulation is part of what makes Factorio such a great game to me,
Everything is 'real', nothing is just 'a number decrement here, increment over here'.

Secondly, I just don't think it would work, you'd end up having to simulate everything anyway,
If power drops down a little bit, and a beacon gets turned off, you need to recalcualte the throughput speed?
What if there is circuit control or logistic control in there?

Well I can see hundreds of cases where the 'nice cheap abstraction' needs to be broken and recalculated and packaged up again.

StephenLynx
Inserter
Inserter
Posts: 31
Joined: Thu May 04, 2017 10:55 pm
Contact:

Re: Optimization idea: abstraction

Post by StephenLynx »

Deadlock989 wrote:
Wed Mar 11, 2020 12:43 pm
What, you want my CV now? Go fish.
No, I just think you might have a hard time thinking outside the box if you never did regular programming. Modding apis are a framework for doing one thing in a specific context. General programming is just you, memory and instructions. Maybe this is why you are such a negative nancy.
Klonan wrote:
Wed Mar 11, 2020 12:46 pm
If power drops down a little bit, and a beacon gets turned off, you need to recalcualte the throughput speed?
What if there is circuit control or logistic control in there?
I suggested earlier that you can decide when to stop simulating, so you focus on the most common cases. Energy is one of those situations where people just don't keep running large factories constantly underpowered. And you can always choose how often to switch modes, so you are not switching every other second, in the case of power fluctuating between full powered and underpowered.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Optimization idea: abstraction

Post by Deadlock989 »

I think Factorissimo 2 handles the concept pretty well already. The only issue with it is the terrible performance it has, because of all the polling it has to do.

If the engine could handle containers that exist on more than one surface at once, "Ender-chest" styley - ditto storage tanks, ditto electric interfaces - then that issue could be toast. There was talk from a dev about doing it but I don't imagine it's a high priority when the push to 1.0 is on and there's no vanilla use case.
No, I just think you might have a hard time thinking outside the box if you never did regular programming
Sure, whatever, stalker.
Image

Nemo4809
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Thu Jan 16, 2020 10:49 am
Contact:

Re: Optimization idea: abstraction

Post by Nemo4809 »

Klonan wrote:
Wed Mar 11, 2020 12:46 pm
Maybe another dev will correct me if they feel otherwise,
But this is something we are not really interested in doing
That's fine.
accuracy and granularity of the simulation is part of what makes Factorio such a great game to me,
Everything is 'real', nothing is just 'a number decrement here, increment over here'.

Secondly, I just don't think it would work, you'd end up having to simulate everything anyway,
If power drops down a little bit, and a beacon gets turned off, you need to recalcualte the throughput speed?
What if there is circuit control or logistic control in there?

Well I can see hundreds of cases where the 'nice cheap abstraction' needs to be broken and recalculated and packaged up again.
Just error on the side of inefficiency IMHO. Insufficient power? Just stop the abstract factory dead in it's tracks.

The only interaction with the abstract factory (from the outside world) should be the material inputs and outputs - i.e ban roboports, combinators, and of course, rails within the abstract factory - nothing else goes in or comes out.

If you restrict the material input conditions, e.g. you calculate it the characteristics (amount of ticks required and output) of the abstraction for exactly 100 iron/150 copper plates available as input, you don't have to do the simulation more than once if the abstract factory operates like an assembler and only starts work when 100 iron/150 copper plates is delivered to it and only starts the next batch after the required number of ticks (based on simulation) has passed.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Optimization idea: abstraction

Post by eradicator »

Deadlock989 wrote:
Wed Mar 11, 2020 12:56 pm
If the engine could handle containers that exist on more than one surface at once, "Ender-chest" styley
I have a very faint memory of @Rseding mentioning he actually did that once and decided it was too overpowered to release to the public. (faint == possibly false)
_____
@Nemo4809
@StephenLynx

I think you're (willingly?) ignoring the visual aspect. Currently all the animations of belts, inserters, etc represent the exact state of the factory. So if you want to "abstract" then the exact state doesn't exist anymore and thus can not be visualized. It's a classical "keep the cake or eat it" problem.

So even if you give the player the ability to create strictly defined closed systems that stop all work when anything goes wrong, then you're basically talking about a very large but singular assembling machine in all aspects except for how difficult it is to build. Thus the blackbox would actually be pitch black.
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.

StephenLynx
Inserter
Inserter
Posts: 31
Joined: Thu May 04, 2017 10:55 pm
Contact:

Re: Optimization idea: abstraction

Post by StephenLynx »

eradicator wrote:
Wed Mar 11, 2020 2:47 pm
I think you're (willingly?) ignoring the visual aspect. Currently all the animations of belts, inserters, etc represent the exact state of the factory. So if you want to "abstract" then the exact state doesn't exist anymore and thus can not be visualized. It's a classical "keep the cake or eat it" problem.
I am not. I have stated before that when you have to show the abstracted area, the game should stop abstracting and organize the buffered items inside the area.

Post Reply

Return to “Ideas and Suggestions”