Friday Facts #182 - Optimizations, always more optimizations

Regular reports on Factorio development.
Asterix
Inserter
Inserter
Posts: 29
Joined: Wed Oct 12, 2016 5:51 pm
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by Asterix »

I like Minecraft. Bought it back in beta. And if it didn't take more resources than freaking fallout 4, I would happily play it to this day :P

And Drury: I did say there was a reason I'd been putting off the upgrade :P
Bigbigcheese
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Mar 22, 2017 1:40 am
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by Bigbigcheese »

Kane wrote:You telling me you rather have Minecraft then Factorio...? There would not be both it would been one or the other.
Don't want to say too much but I spent so much longer in Minecraft than Factorio before losing my creative streak, although with a significant number of automation related mods may I add...

But if the Factorio devs made Minecraft then it'd have been made to their specifications, all the cool stuff, the trains and things would be in Minecraft by default, would work and would be in 3D... Why would you not want 3D, working, super cool Factorio with big ass trains towering over you as they speed past delivering tonnes of rock to huge factories! Basically a wet dream!

Although i'd seriously pity Mr Potato 'Puter...
User avatar
StoneLegion
Filter Inserter
Filter Inserter
Posts: 687
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by StoneLegion »

Bigbigcheese wrote:
Kane wrote:You telling me you rather have Minecraft then Factorio...? There would not be both it would been one or the other.
Don't want to say too much but I spent so much longer in Minecraft than Factorio before losing my creative streak, although with a significant number of automation related mods may I add...

But if the Factorio devs made Minecraft then it'd have been made to their specifications, all the cool stuff, the trains and things would be in Minecraft by default, would work and would be in 3D... Why would you not want 3D, working, super cool Factorio with big ass trains towering over you as they speed past delivering tonnes of rock to huge factories! Basically a wet dream!

Although i'd seriously pity Mr Potato 'Puter...
Why would of there be trains or factorio. Since their visions came from things like modded Minecraft, etc. Without Minecraft the chances are they would been more Vanilla Minecraft. You have to see the actual true impact.
User avatar
jackd23
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Feb 21, 2017 12:23 pm
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by jackd23 »

I had this terrible idea of new vehicles for 0.16, like Truck-Trailers (or Tractor-Trailers, or maybe just trailers for your car) as an earlier alternative to trains (I've built car loading/unloading ports before, mainly for barreled oil, and solar stuff to take out and transfer to logistics storage and then build), perhaps a "road" item similar to "train tracks" so you can set up routes and stations as well as routes you can set up.
I still have some additional ideas to improve the performance of this GUI but it's at least manageable now for 0.15 it's manageable.
Both messages have been sponsored by the Department of Redundancy Department, thank you! :mrgreen:
Doctor, doctor, I have a condition, it's TRUE!
bobucles
Smart Inserter
Smart Inserter
Posts: 1708
Joined: Wed Jun 10, 2015 10:37 pm
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by bobucles »

Guys. I'd like to report a bug where the versioning number has an incorrect decimal placement. The decimal should be moved one spot to the right.
User avatar
aRatNamedSammy
Fast Inserter
Fast Inserter
Posts: 216
Joined: Tue Jul 08, 2014 4:26 pm
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by aRatNamedSammy »

that is what many games doesnt have... optimization! quality!
I still continue to wait patiently for your piece of pure gold!
WUBE ROCKS 8-)
Teeth for Two (so sorry my bad english)
MaexxDesign
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Tue Jun 21, 2016 9:59 am
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by MaexxDesign »

I'll be on vacation next week.
So... please release 0.15 tomorrow. :)

Sincerely, MaexxDesign
User avatar
Drury
Filter Inserter
Filter Inserter
Posts: 794
Joined: Tue Mar 25, 2014 8:01 pm
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by Drury »

jackd23 wrote:I had this terrible idea of new vehicles for 0.16, like Truck-Trailers (or Tractor-Trailers, or maybe just trailers for your car) as an earlier alternative to trains (I've built car loading/unloading ports before, mainly for barreled oil, and solar stuff to take out and transfer to logistics storage and then build), perhaps a "road" item similar to "train tracks" so you can set up routes and stations as well as routes you can set up.
I've always thought it'd be cool to have a sort of earlygame logistics robots that don't fly. Some sort of self-driving trucks that drive between truck stops.

Having to build roads for them would make them a bit too much like trains I think. The benefit would be not having to build much infrastructure for them, just letting them drive across vast distances. Useful for quick outposts with a small resource output.
mrvn
Smart Inserter
Smart Inserter
Posts: 5881
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by mrvn »

Kane wrote:You telling me you rather have Minecraft then Factorio...? There would not be both it would been one or the other.
I would rather have a FactorioCraft. The best of both worlds combined. :)
Hannu
Filter Inserter
Filter Inserter
Posts: 850
Joined: Thu Apr 28, 2016 6:27 am
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by Hannu »

Bigbigcheese wrote:But if the Factorio devs made Minecraft then it'd have been made to their specifications, all the cool stuff, the trains and things would be in Minecraft by default, would work and would be in 3D... Why would you not want 3D, working, super cool Factorio with big ass trains towering over you as they speed past delivering tonnes of rock to huge factories! Basically a wet dream!
2 dimensionality is an essential part of Factorio's logistic challenge. If there was possibility to lay inserters and transport belts in 3 dimensions, the logistics would be trivial and boring. Much like bot logistics, which I do not like. They could make recipes more complex but then planning would become too difficult and laborious. In real world planning of even small factory takes huge number of professional engineer's work hours. I think that balancing of 3D factory would be a very difficult task and results would probably not be very entertaining. Especially for casual players.

Computing power would be another problem. If there were interesting animated entities instead of boring minecraft style cubes, polygon number would explode to insanity and no consumer computer or graphics card could handle even medium sized factory with couple of thousands of entities. Programming would also need special skills which are rare in game development teams, like effective use of multithreading capabilities.

But yes, 3d Factorio able to run huge factories and somewhat realistic train traffic between them and ability to fly with a helicopter and see the whole main base with thousands of assemblers and inserters and kilometers of 3D belt spaghetti would be wet dream for me too.
User avatar
Jon8RFC
Filter Inserter
Filter Inserter
Posts: 554
Joined: Tue May 10, 2016 3:39 pm
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by Jon8RFC »

Will the GUI tweaks include things such as the modular armor grid and logistics chests?

Maybe you won't notice it in single player, but in large multiplayer mega-factories where my cpu seems to struggle (despite saving the same map and having zero problems with the mega-factory locally), when I open the grid for my mk2 armor, my UPS drops and struggles to come back until I'm out of that interface. The same happens when hovering over logistics chests.
Image
alingis
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Nov 26, 2016 3:37 pm
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by alingis »

Perf suggestion:

When constructing or deconstructing tracks, batch the actual placement/removal of the track entities to only occur once per x (~30) frames.

This should limit the super-costly large train network recalculations to appear far less hitchy.


(Alternatively wait until all scheduled construction bots targeting tracks have arrived to batch them up; though this may or may not make sense depending on how bot scheduling is managed.)
mrvn
Smart Inserter
Smart Inserter
Posts: 5881
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by mrvn »

alingis wrote:Perf suggestion:

When constructing or deconstructing tracks, batch the actual placement/removal of the track entities to only occur once per x (~30) frames.

This should limit the super-costly large train network recalculations to appear far less hitchy.


(Alternatively wait until all scheduled construction bots targeting tracks have arrived to batch them up; though this may or may not make sense depending on how bot scheduling is managed.)
Constructing or deconstructing tracks should not need any train network recalculations except for a few cases:

1. trains or cars get placed or removed (if it's the first/last train/car in a block)
2. 2 blocks are joined by placing a new track or removing a signal
3. a block is split in two by removing a track or placing a signal
Karamel
Inserter
Inserter
Posts: 25
Joined: Sun Nov 13, 2016 9:12 am
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by Karamel »

bulldog98 wrote:
PacifyerGrey wrote:
Rseding91 wrote:Single sided, double sided, a big train, a small one, loop-based or no loops makes no difference in the games performance. They're all the same.

I have no idea where people get these ideas from but they're all false.
If you have a loop at every intersection it should multiply available paths exponentially based on the number of intersections you will meet on the way.
I am not sure how the pathfinding in factorio works but generally in many-to-many lists the search tree works mostly the same. Loop-free design prevents the search tree from growing and should perform better.

Correct me if I am wrong.

But maybe the process of path finding is so fast anyways that it will not impact game performance at all as it actually runs pretty rarely.
They use the A* algorithm which is normally algoritmically fast, but only gives approximate optimal results, since pathfinding is NP hard. And solving NP hard problems exact can take exponential time.
If you store a map of depot -> distance on each exit from a block, pathfinding trough a graph becomes both guaranteed optimal and O(1) (with almost-free fixed cost), at the cost of having to broadcast trough the entire train network block by block when depots are added or removed, and parts of it when the logical structure changes. If you want to check the entire route, O(1) becomes O(average distance to next depot on train schedule).
BenSeidel
Filter Inserter
Filter Inserter
Posts: 590
Joined: Tue Jun 28, 2016 1:44 am
Contact:

Re: Friday Facts #182 - Optimizations, always more optimizations

Post by BenSeidel »

Karamel wrote:
bulldog98 wrote:
PacifyerGrey wrote:
Rseding91 wrote:Single sided, double sided, a big train, a small one, loop-based or no loops makes no difference in the games performance. They're all the same.

I have no idea where people get these ideas from but they're all false.
If you have a loop at every intersection it should multiply available paths exponentially based on the number of intersections you will meet on the way.
I am not sure how the pathfinding in factorio works but generally in many-to-many lists the search tree works mostly the same. Loop-free design prevents the search tree from growing and should perform better.

Correct me if I am wrong.

But maybe the process of path finding is so fast anyways that it will not impact game performance at all as it actually runs pretty rarely.
They use the A* algorithm which is normally algoritmically fast, but only gives approximate optimal results, since pathfinding is NP hard. And solving NP hard problems exact can take exponential time.
If you store a map of depot -> distance on each exit from a block, pathfinding trough a graph becomes both guaranteed optimal and O(1) (with almost-free fixed cost), at the cost of having to broadcast trough the entire train network block by block when depots are added or removed, and parts of it when the logical structure changes. If you want to check the entire route, O(1) becomes O(average distance to next depot on train schedule).
The issue is that the developers want a load balanced rail network where the trains take into account congestion. Add into that the ability to have stops with the same name, alternate paths like the ones you get in rail stackers, etc and you quickly find that a preprocessed graph does not work.

The issue isn't with A*, but our computers: They are becoming less and less general purpose machines.
Post Reply

Return to “News”