Optimization idea: abstraction

Post your ideas and suggestions how to improve the game.
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: 1991
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.

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: 4361
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: Hand Crank Generator Deluxe, Screenshot Hotkey 2.0, /sudo
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.

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

Re: Optimization idea: abstraction

Post by Klonan »

eradicator wrote:
Wed Mar 11, 2020 2:47 pm
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)
False memory, but close

Its a really complex item, he/we still would like to have it in the game, but other things have taken our focus for the last while

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 »

eradicator wrote:
Wed Mar 11, 2020 2:47 pm
@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.
I'm fine with it having no visual - maybe a greyscale static image of the "insides" (like what you see in the blueprint preview) so players will know what each abstract factory does; this also means it will take up the same space as what it's replacing.

As for difficulty of building ... it's the same as using a blueprint IMHO. You still have to design the thing to produce the products you want. Its efficiency will still be measured via the initial simulation. Also just make it so it cost you the same components to put down as if you placed it by hand in a "native implementation".

With all its restriction, it will probably be slightly less efficient throughput-wise vs using a "native implementation" but it can be an option for megabase building players - where by choosing to use an abstract factory they are deciding to sacrifice throughput for the meta-benefit of higher UPS.

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

Re: Optimization idea: abstraction

Post by Deadlock989 »

So it won't work when there isn't fully compressed unvarying flow, it won't work when there's fluctuating power, and it won't work when you use your meat eyeballs to look at it on the screen, and furthermore it will take extra CPU time to unbundle hundreds of these "optimisations" every time you change zoom level or move around your factory or there's a one inch gap in a belt somewhere because a biter coughed.

When will it actually work to any benefit? With the game running on a headless server with no players attached?

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 3:35 pm
When will it actually work to any benefit? With the game running on a headless server with no players attached?
First of all, I don't think it would need full belts to work. Second, most of bases that start to choke on UPS run at full power all the time and players can easily plop down as much power as they want at that point. Third, these same large bases will only have a fraction of their structure near players. Fourth: the abstraction data can be easily cached. So after the initial processing it would be trivial to restart and stop the simulation. And unless the player changes something relevant to the area, the cache can be kept.

PS: specially for single player, you will always have one player looking at one place at a time. And zoom shouldn't matter if you only abstract things really far from the camera.

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

Re: Optimization idea: abstraction

Post by eradicator »

StephenLynx wrote:
Wed Mar 11, 2020 2:58 pm
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.
Sorry, must have misremembered who said that. But as i (and other people) have stated before: switching in and out of the emulation state for a large amount of entities would be too costly to do it on-the-fly just because somebody looks at it. As the whole concept hinges on it being "one" thing you can't "partially unemulate" it either, so you're stuck with either lag spikes or limiting the allowed size of emulated areas.
______
Klonan wrote:
Wed Mar 11, 2020 3:08 pm
eradicator wrote:
Wed Mar 11, 2020 2:47 pm
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)
False memory, but close

Its a really complex item, he/we still would like to have it in the game, but other things have taken our focus for the last while
All hope is not list then! :D
Author of: Hand Crank Generator Deluxe, Screenshot Hotkey 2.0, /sudo
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 6:14 pm
As the whole concept hinges on it being "one" thing you can't "partially unemulate" it either, so you're stuck with either lag spikes or limiting the allowed size of emulated areas.
______
I have to disagree on that. Once you have a cached model for the area, stoping it's simulation is more or less as costly as a single UPS cycle. The game is already able to run one cycle for all those entities and the items they are handling 60 times per second. Why do you think it's that hard to start and stop the simulation once you know what's supposed to be simulated? Besides, how often you have to start and stop simulations depends on what metric the game uses to do so. It's not hard to apply a similar logic to the one mmos use to show and hide players to each other.

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

Re: Optimization idea: abstraction

Post by Deadlock989 »

I mean, clearly it's a doddle and well worth the time spent on it.

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

Re: Optimization idea: abstraction

Post by eradicator »

StephenLynx wrote:
Wed Mar 11, 2020 11:00 pm
eradicator wrote:
Wed Mar 11, 2020 6:14 pm
As the whole concept hinges on it being "one" thing you can't "partially unemulate" it either, so you're stuck with either lag spikes or limiting the allowed size of emulated areas.
______
I have to disagree on that. Once you have a cached model for the area, stoping it's simulation is more or less as costly as a single UPS cycle. The game is already able to run one cycle for all those entities and the items they are handling 60 times per second. Why do you think it's that hard to start and stop the simulation once you know what's supposed to be simulated? Besides, how often you have to start and stop simulations depends on what metric the game uses to do so. It's not hard to apply a similar logic to the one mmos use to show and hide players to each other.
I don't get the MMO comparison. There's nothing emulated there, the server does not abridge any calculations, it merely doesn't show you all the results. In factorio "unemulating" would require you to calculate the state of all machines from 0 instead of iteratively like it is done in a normal game, which is more expensive (very simplistic: i=i+1 vs i=n*m where n and m also have to be calculated first).
Author of: Hand Crank Generator Deluxe, Screenshot Hotkey 2.0, /sudo
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:
Thu Mar 12, 2020 9:48 am
I don't get the MMO comparison.
You completely missed the point. MMOs have to choose when to hide and show other players. It would be impossible to tell every player in the world where every other player is. So they have a method of loading and unloading players around you as you move. Change loading players by abstracting areas.

PS: no, it wouldn't have to simulate literally everything when it would stop simulating. It could infer the state from where the abstraction currently is. How many materials are bufferd? How many produced items are buffered? And so on. By knowing how fast the area produces item and how long it takes for items to start coming out from the area, it would be perfectly possible to quickly arrange items inside the abstracted area in a place that wouldn't affect production at all.

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

Re: Optimization idea: abstraction

Post by eradicator »

StephenLynx wrote:
Thu Mar 12, 2020 12:34 pm
eradicator wrote:
Thu Mar 12, 2020 9:48 am
I don't get the MMO comparison.
You completely missed the point. MMOs have to choose when to hide and show other players.
No you did. Hiding a bit of graphics that has no effect on anything isn't difficult. The client doesn't do any game-state relevant calculations. And hiding players on the client doesn't stop them from being calculated on the server. Anyway, the old rule still stands: if you thinks it's oh-so-easy to do write a mod to demonstrate. Or post other evidence. You're "because i say so" attitude doesn't make for an interesting discussion beyond this.
Author of: Hand Crank Generator Deluxe, Screenshot Hotkey 2.0, /sudo
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:
Thu Mar 12, 2020 1:58 pm
No you did.
If you can't see where you were wrong even after I explained it, there is no way to argue with you. Your text comprehension is severely lacking. The FIRST part of the issue is figuring what must be put in which state. The SECOND part of the issue is what to do when it switch states. MMOs have to do the same thing for the FIRST part or the issue, but not the SECOND part of the issue. Do you understand that now? Do I have to draw it for you?

Also, point out where I said it was trivial. I opened saying that it would be challenging. My whole point is that it's POSSIBLE.

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

Re: Optimization idea: abstraction

Post by Klonan »

StephenLynx wrote:
Thu Mar 12, 2020 2:04 pm
My whole point is that it's POSSIBLE.
Well yea, its programming, anything is possible.

But its not practical.

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

Re: Optimization idea: abstraction

Post by eradicator »

StephenLynx wrote:
Thu Mar 12, 2020 2:04 pm
If you can't see where you were wrong even after I explained it, there is no way to argue with you. Your text comprehension is severely lacking.
Funny. I feel exactly the same about you.
Author of: Hand Crank Generator Deluxe, Screenshot Hotkey 2.0, /sudo
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

netmand
Filter Inserter
Filter Inserter
Posts: 262
Joined: Wed Feb 22, 2017 1:20 am
Contact:

Re: Optimization idea: abstraction

Post by netmand »

Abstraction. I guess this popped up on the Programmer's word of the day calendar...
What's next? machine learning?

Do you really mean you want them to abstract the game more? No Thanks. There's a cadre of players that will rebel if the game is made any simpler.

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

Re: Optimization idea: abstraction

Post by StephenLynx »

netmand wrote:
Thu Mar 12, 2020 3:50 pm
There's a cadre of players that will rebel if the game is made any simpler.
You should read the thread. I opened by saying this wouldn't change anything at all as far as features or mechanics go.

Post Reply

Return to “Ideas and Suggestions”

Who is online

Users browsing this forum: No registered users