Friday Facts #270 - HR Substation & Save/Load overview

Regular reports on Factorio development.
User avatar
mexmer
Filter Inserter
Filter Inserter
Posts: 870
Joined: Wed Aug 03, 2016 2:00 pm
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by mexmer »

posila wrote: ↑Mon Nov 26, 2018 8:17 pm
ske wrote: ↑Sun Nov 25, 2018 7:41 pm:o I hope I didn't give you any new ideas. I mean I think it could probably be done. What the operating system is doing during COW is not much more than a simple memory copy. If you do that manually you should be more efficient. You'd just have to use an allocator for everything relevant for the game state and then just copy all memory areas allocated by that allocator. That's a few memory areas. Sure you'd need to fix the pointers but that could be done by some lookup-tables or a simple offset if you only have one container. Sure, you'd need to apply that offset to all internal pointers but that could be covered by using templates that optimize away such an offset for the normal operation. After copying you'd only need to serialize the whole package and discard it.
Yes, it could be done, in unreasonable amount of time :). I mean, we are not lacking ideas, we are lacking time dilation device; or time travel device to send kovarex message to 2012 about how big EnergyCraft will get and what things he should plan for better ... and that he should really make it 3D (like Starcraft 2, not first-person) :D
firs person factorio? when
posila
Factorio Staff
Factorio Staff
Posts: 5351
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by posila »

mexmer wrote: ↑Mon Nov 26, 2018 8:36 pmfirs person factorio? when
Soon. Sign up for closed alpha access: https://www.satisfactorygame.com/ (or play now? https://store.steampowered.com/app/2542 ... t_Evolved/)
User avatar
mexmer
Filter Inserter
Filter Inserter
Posts: 870
Joined: Wed Aug 03, 2016 2:00 pm
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by mexmer »

posila wrote: ↑Mon Nov 26, 2018 8:40 pm
mexmer wrote: ↑Mon Nov 26, 2018 8:36 pmfirs person factorio? when
Soon. Sign up for closed alpha access: https://www.satisfactorygame.com/ (or play now? https://store.steampowered.com/app/2542 ... t_Evolved/)
if you can make it before HL3 is out, it will be nice :mrgreen:
User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 884
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by Oktokolo »

posila wrote: ↑Mon Nov 26, 2018 8:17 pm I mean, we are not lacking ideas, we are lacking time dilation device; or time travel device to send kovarex message to 2012 about how big EnergyCraft will get and what things he should plan for better ... and that he should really make it 3D (like Starcraft 2, not first-person) :D
He should also make belts single-lane, play openTTD before implementing trains and never include tools or bots. :P
User avatar
featherwinglove
Filter Inserter
Filter Inserter
Posts: 579
Joined: Sat Jun 25, 2016 6:14 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by featherwinglove »

"HR Substation" ...sounds like your running out of stuff to HR, since I and nobody I've played with or watched on Youtube/Twitch gives the slightest crap about them.

Suggestion: Get the spitters to hit the nearest power entity when they see a laser turret. Then I might start giving a hoot about substations. Another suggestion: Implement a loss factor on the power grid on the basis of the number of power entities (power poles and such). Then I might start giving a hoot about substations (as well as power poles, since I almost always play with Bob's and like three or four greenhouse mods.) Related suggestion: Voltage research to reduce the power entity loss factor as the build is likely to scale much faster than the quality of the power entities, even with Bob's Power implementing sooper dooper yoober substations.

Only real problem I have with the save/load system is my hard drive. Factorio is so stable that I've had it open for days at a time, and sometimes I sit back down after a crap or a day at work and unpause, and suddenly it freezes completely for like ten seconds, leaving me finally wondering if I've had it crash without it being my fault. No, it's just the hard drive had spun down and yeah I should get an SSD some day. (But I'm old school enough to have played space shooters on i386/MB hardware and have the patience to play Crysis on my waffle maker.)
ske
Filter Inserter
Filter Inserter
Posts: 412
Joined: Sat Oct 17, 2015 8:00 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by ske »

posila wrote: ↑Mon Nov 26, 2018 8:40 pm
mexmer wrote: ↑Mon Nov 26, 2018 8:36 pmfirs person factorio? when
Soon. Sign up for closed alpha access: https://www.satisfactorygame.com/ (or play now? https://store.steampowered.com/app/2542 ... t_Evolved/)
Pretty cool games but totally different from factorio in my opinion. You can't compete with them and you don't have to because they are so different that it's more of a separate category like lawn-mowers or make-up.

One thing I was thinking about recently while playing Cities Skylines is that the rendering of factorio could have been made in 3D. I mean that the game, controls and perspective would have been almost exactly the same except that it's rendered in 3D. The approach to graphics would be a bit different with less detail but better lighting but overall it would have been the same game. I don't have strong feelings in regards to the 2D or 3D interface.
Oktokolo wrote: ↑Tue Nov 27, 2018 1:00 am He should also make belts single-lane, play openTTD before implementing trains and never include tools or bots. :P
I could totally see single-lane belts be better. Double-triple-quadruple lane belts and crate-belts would be upgrades then. I guess for now we're stuck with what we have.

The train system in factorio works so beautifully. Except for line management, there OpenTTD is vastly better. But look at how smooth the trains move. I would play a few games where I'd only connect existing factories by train. The only real gripe I'm having with the train system is the lack of tunnels/bridges. It's not a big problem in the normal games but it's something you'd really want in a train map.

Do train maps with pre-built factories exist?
ske
Filter Inserter
Filter Inserter
Posts: 412
Joined: Sat Oct 17, 2015 8:00 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by ske »

featherwinglove wrote: ↑Tue Nov 27, 2018 9:51 pmImplement a loss factor on the power grid on the basis of the number of power entities (power poles and such).
This has been suggested and rejected multiple times. In my opinion it is a good idea and should be implemented. The argument for rejection was that it hurts the UPS and they'd rather turn the fluid system into the global electrical system than to make changes to the electricity distribution. In my opinion the substation should connect near low voltage and far high voltage parts of the electrical networks instead of just being a power pole on steroids. From what I've read it's not likely that such changes would come any time soon.
mrvn
Smart Inserter
Smart Inserter
Posts: 5865
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by mrvn »

weaknespase wrote: ↑Mon Nov 26, 2018 4:53 pm Nonblocking saving? Yeah, forking won't work most probably, due to the mechanics of how forking works. The process that modifies dataset will get all the usual goodness - page faults, copying of memory, thousands of page allocations, randomized page table and a lot of extra cache misses - all the usual causes of generic performance hits. Guess which process that would be.

Copying entire serializable data in one go (without gathering it over entire memory) between game updates may be one of the most performant ways to solve this problem, but would require tricky memory allocation.

On the other note, Factorio has pretty nice deterministic game mechanics, is it utilized anywhere besides saves? For example, to defer (or join several into one) updates on anything that is outside of (everyone's) screen, for example?
On the other hand as shown by the save game size major parts of the save game are static data. So large parts of the save game would neither page fault nor copy anything.

And for the rest so what if the game is slower? At least you could still play while it saves.

OK. Saving in factorio is quite fast so it's not that annoying. I've recently played Anno 1404 and when autosave hits you can nearly go and make coffee.
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by ratchetfreak »

mrvn wrote: ↑Thu Nov 29, 2018 11:07 am

On the other hand as shown by the save game size major parts of the save game are static data. So large parts of the save game would neither page fault nor copy anything.

And for the rest so what if the game is slower? At least you could still play while it saves.

OK. Saving in factorio is quite fast so it's not that annoying. I've recently played Anno 1404 and when autosave hits you can nearly go and make coffee.
Pages are allocated in 4kB blocks (or more depending on your kernel). Even a single byte being changed in a 4kB block means pagefault, copying that block, updating the mmu.

Factorio is memory latency bound which is a result of it needing to touch a lot of different places randomly.This means the first few frames after the fork or until the save process is complete are going to be lag hell.It at the same time you run out of ram and swapping gets involved you may as well head to the bathroom.
User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 884
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by Oktokolo »

ratchetfreak wrote: ↑Thu Nov 29, 2018 2:11 pm at the same time you run out of ram and swapping gets involved you may as well head to the bathroom.
Would obviously be an option for people who have enough RAM. 8GiB or more system RAM are quite mainstream now and should prevent swapping for most player's bases.
obuw
Long Handed Inserter
Long Handed Inserter
Posts: 72
Joined: Tue May 06, 2014 7:49 pm
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by obuw »

I'm glad that you are taking the time to look at save file optimization. Save file size may not be a big deal for singleplayer, but it can lead to tedious amounts of waiting in multiplayer since the file needs to be sent every time someone joins. (Or every time the host runs into a biter nest, dies, and then decides to reload the game from the latest autosave :evil: )

I made a suggestion about this a while ago: *please* consider making it so the autosave is done on each client. So when they rejoin the game, they can use the latest existing autosave they have, and only receive the information about events that took place since then. It would tremendously improve the load times in multiplayer.
Obuw's Warfare - Combat improvements
ske
Filter Inserter
Filter Inserter
Posts: 412
Joined: Sat Oct 17, 2015 8:00 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by ske »

obuw wrote: ↑Fri Nov 30, 2018 12:57 pm I made a suggestion about this a while ago: *please* consider making it so the autosave is done on each client. So when they rejoin the game, they can use the latest existing autosave they have, and only receive the information about events that took place since then. It would tremendously improve the load times in multiplayer.
If your UPS gets close to 60/s the time it'll take to apply the delta will go towards infinity. Even with 120 UPS catching up will take half as long as the time since the last save has been. E.g. if the last save has been 10 minutes ago it will take 5 minutes to catch up to the state when you started joining. But then the game will have progressed by the same time you took to catch up and you have to catch up that amount. And then again that remaining amount. This cycle repeats infinitely. Is joining even possible then? Only a philosopher who owns a turtle can answer that.
User avatar
featherwinglove
Filter Inserter
Filter Inserter
Posts: 579
Joined: Sat Jun 25, 2016 6:14 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by featherwinglove »

ske wrote: ↑Wed Nov 28, 2018 11:43 am
featherwinglove wrote: ↑Tue Nov 27, 2018 9:51 pmImplement a loss factor on the power grid on the basis of the number of power entities (power poles and such).
This has been suggested and rejected multiple times. In my opinion it is a good idea and should be implemented. The argument for rejection was that it hurts the UPS and they'd rather turn the fluid system into the global electrical system than to make changes to the electricity distribution.
Not exactly: it's the proposals to handle electricity more in the manner of a fluid which have been rejected on UPS grounds. This proposal would only evaluate the loss factor when the count of power entity changes, or possibly less often, like every 30 seconds or so. The rest of the functionality (i.e. counting the number of power entities) is already built into the electrical system view, although not for the entities that I'm referring to.
ske
Filter Inserter
Filter Inserter
Posts: 412
Joined: Sat Oct 17, 2015 8:00 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by ske »

featherwinglove wrote: ↑Sat Dec 01, 2018 8:18 am
ske wrote: ↑Wed Nov 28, 2018 11:43 am
featherwinglove wrote: ↑Tue Nov 27, 2018 9:51 pmImplement a loss factor on the power grid on the basis of the number of power entities (power poles and such).
This has been suggested and rejected multiple times. In my opinion it is a good idea and should be implemented. The argument for rejection was that it hurts the UPS and they'd rather turn the fluid system into the global electrical system than to make changes to the electricity distribution.
Not exactly: it's the proposals to handle electricity more in the manner of a fluid which have been rejected on UPS grounds. This proposal would only evaluate the loss factor when the count of power entity changes, or possibly less often, like every 30 seconds or so. The rest of the functionality (i.e. counting the number of power entities) is already built into the electrical system view, although not for the entities that I'm referring to.
The loss factor was also mentioned in the discussion and it was mentioned that it had been rejected before. I don't remember if a reason was given for rejecting the loss factor idea.
Koub
Global Moderator
Global Moderator
Posts: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by Koub »

ske wrote: ↑Sat Dec 01, 2018 8:56 am The loss factor was also mentioned in the discussion and it was mentioned that it had been rejected before. I don't remember if a reason was given for rejecting the loss factor idea.
viewtopic.php?p=301132#p301132
btw this overall suggestion (power losses over distance) is one of the very oldest in Factorio's history : viewtopic.php?f=6&t=119
And the devs' answer has always been "No". It doesn't mean it will never be "Yes", but that's highly unlikely, because the gains (additional realism and complexity) are likely to be too expensive (significative hit on performance, hence a de-optimization, and lowering mechanically how big a factory can be on a given system).
Koub - Please consider English is not my native language.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by eradicator »

Koub wrote: ↑Sat Dec 01, 2018 9:53 am And the devs' answer has always been "No". It doesn't mean it will never be "Yes", but that's highly unlikely, because the gains (additional realism and complexity) are likely to be too expensive (significative hit on performance, hence a de-optimization, and lowering mechanically how big a factory can be on a given system).
A thought on that unrelated to lossy electric transfer:

I think this fear of "lowering the maximum factory size" is a bit of a looming shadow over factorio development. So much thought is being devoted to "optimization" that sometimes i get the feeling that optimization is considered more important than game design (both from the devs and the community, including myself) when ofc it should never change the designed mechanics. Of course that's a quite complex problem. But for example with the fluid boxes it was on the table to completely remove flow (a game mechanic!) because that would be faster to simulate. I.e. to remove part of the simulation to make it faster without(?) realizing that it wouldn't be the same simulation afterwards. And quite often proposals are struck down with no other reason than that it "would make the game slower" without actually considering how good/bad the content of the proposal is. Quite some while ago a 2000SPM factory at 30UPS was awesome, but nowadays people complain if they can't run their 4000SPM+ factories at 60UPS. It's an upwards spiral with a measurement that is irrelevant to most players. Given the stage of development there won't be any major new systems added anyway (sadly), so i'm just hoping that the existing systems aren't cut down too much just to please the megabasers. But in the modding scene you can see that for example factorissimo - despite being chronically UPS heavy - is immensely popular because of how well the added mechanic fits into the game.

Don't get me wrong, the level of optimization being done is absolutely astonishing, and makes factorio stand out as the great game it is. (I recently loaded an old factory that i abandoned due to low UPS and it now runs more than twice as fast than at the time.) But it shouldn't affect the design of the game mechanic.
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.
bobucles
Smart Inserter
Smart Inserter
Posts: 1708
Joined: Wed Jun 10, 2015 10:37 pm
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by bobucles »

I think this fear of "lowering the maximum factory size" is a bit of a looming shadow over factorio development
It's true that players will never give up their incredibly huge factories for anything. But rather than worry about what players will think (everyone is an angry grandpa who pushed their trains uphill both ways and kids just don't know how good they got it nowadays), try to focus on what game play results will be.

Power transfer loss creates a dynamic where power plants lose efficiency with distance. If a plant is too far away it may struggle to power anything at all. That's the setup. The gameplay solution is very simple. Build lots of smaller power plants next to everything that needs it. For a solar powered base this means separating the factory bits and squeezing panels over every square inch of land in between them. A steam base will require engines dotted all over the place, with fuel lines covering everything as well. A nuclear base gets hurt the most because nuclear power hates being built small. Nuclear power may struggle to be viable on large spread out bases but still work well on hyper dense beacon bases.

Is that fun gameplay? Everyone's tastes are different, after all. Is it worth the design effort going into it? Probably not. If energy loss happens over distance, that means every single energy provider needs a load of extra calculations behind it. They need to know where their power is going, how far away it is and how much energy gets lost to inefficiency. This model would have to be vastly simplified because calculating that effort across every single provider and consumer in the game is completely nuts. Solar panels get hit the hardest because not only are they're all over the place but they're delivering power in 2 steps. First you losing some amount of energy over the distance to the accumulators, then you're losing energy from the accumulators going to their target. It sounds like a horrible mess.
User avatar
featherwinglove
Filter Inserter
Filter Inserter
Posts: 579
Joined: Sat Jun 25, 2016 6:14 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by featherwinglove »

Koub wrote: ↑Sat Dec 01, 2018 9:53 am btw this overall suggestion (power losses over distance) is one of the very oldest in Factorio's history : viewtopic.php?f=6&t=119
And the devs' answer has always been "No". It doesn't mean it will never be "Yes", but that's highly unlikely, because the gains (additional realism and complexity) are likely to be too expensive (significative hit on performance, hence a de-optimization, and lowering mechanically how big a factory can be on a given system).
Power loss over distance is not what I'm after, it's power loss for a given number of power distribution entities, i.e. power poles and substations. And the drop would be even across the system, and could be implemented as an efficiency hit on on all power generators (including accumulators in discharge mode.) Other than that, electricity would function exactly as it does currently. The only thing that's expensive is summing up all the power poles. If this were expensive, it wouldn't already be being done for literally every other kind of entity that uses and produces power, from inserters to turbines, when you click on a power pole to open the electrical system interface which literally lists every single one of them, except for the power poles.

The gameplay motivation is to encourage upgrading power distribution systems; currently the only motivation to do so is if you land in a desert or hate chopping trees. With construction robots deconstructing trees and building blueprints, one can save copper and steel and just do literally everything with small power poles and the electricity distribution tech is nothing more than obstacles on the tech tree. This idea would also encourage increasing power distribution technology with solar/accumulator systems since the accumulator would take the loss factor on both charge and discharge, so power coming out of an accumulator in a system with a 20% loss factor get a total of 36% lost (20% for the power coming out of the solar panels, and another 20% loss factor against the 80% remaining for the accumulators in discharge mode.)

The math might look expensive, i.e. F=(1-f)^n (F is grid loss factor, f is individual pole loss factor, n is the potentially gigantic number of power poles), but logarithms to the rescue: F=10^(n*log(1-f)). I think the Ti-83 does this internally since I'm not seeing any increase in delay or screen dimming with the former equation.
User avatar
featherwinglove
Filter Inserter
Filter Inserter
Posts: 579
Joined: Sat Jun 25, 2016 6:14 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by featherwinglove »

bobucles wrote: ↑Sat Dec 01, 2018 6:28 pm
I think this fear of "lowering the maximum factory size" is a bit of a looming shadow over factorio development
If a plant is too far away it may struggle to power anything at all. That's the setup. The gameplay solution is very simple. Build lots of smaller power plants next to everything that needs it. For a solar powered base this means separating the factory bits and squeezing panels over every square inch of land in between them. A steam base will require engines dotted all over the place, with fuel lines covering everything as well. A nuclear base gets hurt the most because nuclear power hates being built small. Nuclear power may struggle to be viable on large spread out bases but still work well on hyper dense beacon bases.
Actually, the proposal I have would penalize solar the most and nuclear the least, with conventional steam being somewhere in between. Like I corrected Koub, power loss over distance is not what I'm after, but power loss over the number of power poles and substations. With this approach, it doesn't matter where in a big factory the power is generated, just as long as the power is generated in the factory and not out in the boonies where you need a bunch of power poles to bring it to your factory. Solar tends to get distributed over a huge chunk of real estate, requiring a huge pile of power poles to connect everything to the grid, and then the accumulators in discharge mode get hit again by the loss factor. With a nuclear system, one needs something like 1/20th the real estate to be covered by power poles, and it's that reduction in the number of power poles that would encourage its use.
Zavian
Smart Inserter
Smart Inserter
Posts: 1649
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: Friday Facts #270 - HR Substation & Save/Load overview

Post by Zavian »

featherwinglove wrote: ↑Sun Dec 02, 2018 1:38 am Actually, the proposal I have would penalize solar the most and nuclear the least, with conventional steam being somewhere in between. Like I corrected Koub, power loss over distance is not what I'm after, but power loss over the number of power poles and substations. With this approach, it doesn't matter where in a big factory the power is generated, just as long as the power is generated in the factory and not out in the boonies where you need a bunch of power poles to bring it to your factory. Solar tends to get distributed over a huge chunk of real estate, requiring a huge pile of power poles to connect everything to the grid, and then the accumulators in discharge mode get hit again by the loss factor. With a nuclear system, one needs something like 1/20th the real estate to be covered by power poles, and it's that reduction in the number of power poles that would encourage its use.
But does that actually improve the gameplay, or simply lead to players being annoyed that they need to build lots of separate isolated power networks, and spend time calculating how much power each section of their base needs, and then building an appropriate power supply network. Then recalculating and rebuilding when they want to extend/upgrade any section. Personally I think I would find that more annoying than interesting. (None of the new decisions sound interesting to me, just more grunt work).
Post Reply

Return to β€œNews”