To build or not to build (miners)

Post all other topics which do not belong to any other category.
Post Reply
blazespinnaker
Filter Inserter
Filter Inserter
Posts: 461
Joined: Wed Sep 16, 2020 12:45 pm
Contact:

To build or not to build (miners)

Post by blazespinnaker »

An interesting question when starting a new game, is when to stop building ore production and start building research.

Ore production can be used to build more ore production, and as soon as you start building something else, your ore production stops growing. However, at some point it is optimal to stop growing your ore production and start working on research.

At what point? I had assumed (incorrectly) that you want to start as late as possible. The more ore production, the more labs - right?

That doesn't seem to be the case.

I wrote a basic simulator in python for factorio and looked through the results. It's obvious that it depends on certain parameters:

How fast you can grow your ore production
How much it costs in ore to grow your ore production
How fast you can grow your research production
How much it costs to grow your research production
How much your ongoing research will cost you (science packs)

Observations:

being able to grow ore production faster doesn't mean you should always start later. With faster production, you'll be able to get more ore sooner and more research done, but since you have more ore earlier on, it may make sense to switch to lab production earlier.

If you're slow at ore production growth, it actually doesn't matter if you're very fast (relatively) at growing your research production, as you're throttled by your ore production. Too slow though, and you should definitely start building labs as early as possible.

Critically, being able to do something faster is less important than doing it at the right time. Of course, being able to do it fast and do it at the right time is better.

Obviously, if your ore production starts maxing out because you're not using it fast enough (max in a furnace, chest, etc), than that is an upper limit. I didn't account for that as I rarely hit it for the scenarios I'm looking at.

One handy part of the simulation finding, is that if you haven't got ore production up by a certain time, you're not going to be able to reach your optimal limit.
OptimaUPS Mod, pm for info.

Xeorm
Fast Inserter
Fast Inserter
Posts: 205
Joined: Wed May 28, 2014 7:11 pm
Contact:

Re: To build or not to build (miners)

Post by Xeorm »

I would say that the standard bit with Factorio is that you don't want to have any bottlenecks. Early game ore production is your main bottleneck and your hand-crafting is more than enough to handle what you can mine. Once you do have enough production to handle what you can handcraft it makes sense to start working on research. I'll typically build up to that point, dump enough into the labs for assembly machines, and then work from there to setup a fuller factory.

Squelch
Filter Inserter
Filter Inserter
Posts: 346
Joined: Sat Apr 23, 2016 5:31 pm
Contact:

Re: To build or not to build (miners)

Post by Squelch »

Balancing energy consumption and pollution output might also be two critical factors in the early game that drives the need for mines.

I tend to err on a slight overproduction of ore and rely on saturated outputs to limit energy and pollution at the mine, but then keep a eye on ore consumption to gauge the need for more mines while research is conducted.

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

Re: To build or not to build (miners)

Post by blazespinnaker »

Xeorm wrote:
Sat Dec 12, 2020 1:00 am
I would say that the standard bit with Factorio is that you don't want to have any bottlenecks. Early game ore production is your main bottleneck and your hand-crafting is more than enough to handle what you can mine. Once you do have enough production to handle what you can handcraft it makes sense to start working on research. I'll typically build up to that point, dump enough into the labs for assembly machines, and then work from there to setup a fuller factory.
I found with the simulations that's its very dependent on the individual. If they're faster or slower at certain things, than it changes when they should do stuff in order to be 'optimal'. Not everyone cares about optimal, so there is that.
OptimaUPS Mod, pm for info.

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

Re: To build or not to build (miners)

Post by blazespinnaker »

Squelch wrote:
Sat Dec 12, 2020 1:21 am
Balancing energy consumption and pollution output might also be two critical factors in the early game that drives the need for mines.

I tend to err on a slight overproduction of ore and rely on saturated outputs to limit energy and pollution at the mine, but then keep a eye on ore consumption to gauge the need for more mines while research is conducted.
Yeah, deathworld for sure!
OptimaUPS Mod, pm for info.

Koub
Global Moderator
Global Moderator
Posts: 6547
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: To build or not to build (miners)

Post by Koub »

blazespinnaker wrote:
Sat Dec 12, 2020 4:31 am
Squelch wrote:
Sat Dec 12, 2020 1:21 am
Balancing energy consumption and pollution output might also be two critical factors in the early game that drives the need for mines.

I tend to err on a slight overproduction of ore and rely on saturated outputs to limit energy and pollution at the mine, but then keep a eye on ore consumption to gauge the need for more mines while research is conducted.
Yeah, deathworld for sure!
Not only for deathworld-ish settings. Some people struggle with biters even with default settings (at least if careless with pollution when not enough military power is there to defend)
Koub - Please consider English is not my native language.

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

Re: To build or not to build (miners)

Post by blazespinnaker »

That is true.
OptimaUPS Mod, pm for info.

JimBarracus
Filter Inserter
Filter Inserter
Posts: 331
Joined: Mon Jul 03, 2017 9:14 am
Contact:

Re: To build or not to build (miners)

Post by JimBarracus »

It also strongly depends on your playstyle.
You also need to unlock things to keep going. At the same time you need to build defense.
The buffer storage is also important. Do you really need to have 10k belts waiting to be placed somewhere?

It also matters from which direction you plan your factory. Do you use your starter ore field and want to make the most of it or do you have a number in mind like 5 red science pack assemblers etc.

In the end its the eternal bottleneck hunting. There is always something, that needs some tweeking. You either overproduce something or you lack something. A perfect ratio is hard to get.

Amarula
Filter Inserter
Filter Inserter
Posts: 390
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: To build or not to build (miners)

Post by Amarula »

JimBarracus wrote:
Thu Dec 17, 2020 6:57 am
It also strongly depends on your playstyle.
I confess I hate burner miners. (Sorry all you BM out there I don't mean to hurt your feelings!) But there it is.

I have watched a few speed run videos, and seeing them take all the first iron to make stacks of burner miners just .. I can't watch... :oops:

The great thing about Lazy Bastard was learning that you could launch a rocket without building any burner miners. Not one! :shock:

So now when I start a new game, I use that first burner miner to mine enough to make that first power system and a couple of electric miners. Then off it goes to the museum, where all the relics like that first set of light armour get stored. :lol:

It isn't speedy but it gets the job done. Of course that means that I just don't do the speed runs. I managed to Get on Track (with more than just a little help from my friends), but the Spoon seems to be forever out of my reach. And that is okay for me, because it is my play-style.
Luck is not a robust control.

JimBarracus
Filter Inserter
Filter Inserter
Posts: 331
Joined: Mon Jul 03, 2017 9:14 am
Contact:

Re: To build or not to build (miners)

Post by JimBarracus »

Amarula wrote:
Thu Dec 17, 2020 3:53 pm
I confess I hate burner miners. (Sorry all you BM out there I don't mean to hurt your feelings!) But there it is.
They have their pros and cons
-they are cheap
-they dont need electricity

-they pollute like crazy
-they need fuel
-they need inserters to be refueled automatically
-they cover a small area

I usually end up building 5 of them.
2 for iron
2 for coal
1 for copper

The only thing I use them in the long run is for my blackout strategy.

In the end its again all about playstyle. I am sure that someone launched a rocket only using burner tech as far as possible.
There are even burner mods for assemblers and such things.

I am also sure that there is someone who launched a rocket only using the one burner miner you start with.

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

Re: To build or not to build (miners)

Post by blazespinnaker »

Mathematically, I would argue the most important math equation for optimal build order (bootstrapping) is the gauss consecutive sums function - n(n+1)/2 = 1+2+3+4+..+n

It's like the factorio golden rule for build order

This equation comes up critically in factorio speedrun achievemnts. For example, for gotlap (the train achievement in 90 minutes in factorio), you need to build 375 green science throughout the game. The problem is tho that logistic science takes 6s to craft. This comes out to 6 * 375 / 60 = 37.5 minutes of assembler time (ignoring inputs for a moment).

You could build 37 assemblers and assuming you had enough material (and labs!), you could do it all in the last minute of your achievement.

Or you could just incrementally build a total of 8 assemblers over 8 minutes (and a bit) 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 8*9/2, or 36. Of course, you want to make sure they're fully productive during those 8 minutes.

Similar, with research labs. Gotlap requires 177 minutes of lab time total. To avoid having to build all those labs, you start early and feed it over time, using gauss again. n(n+1)/2 = 177, n=19.. Of course, adding a lab every minute is a little tricky unless you're Macro or Nefrums, so you can try something like adding 5 labs every 5 minutes. 5 labs * 5 minutes * n(n+1)/2 = 177. n =~ 3.3 (https://www.wolframalpha.com/input/?i=5 ... F2+%3D+177)

And the math checks out. 5 labs for the first 5 minutes is 25 minutes of lab time. The next 5 minutes will have 10 labs for 5 minutes, for 50 minutes. Next, 15 labs * 5 minutes = 75. You have 25 + 50 + 75 = 150. After the 3rd set of 5 minutes, you have 27 labs minutes left. You could add a couple more labs or just wait a little extra time.

Again, of course, you want to make sure the labs are fully filled with science during that ~20 minute period.

Getting on Track Like a Pro, btw, requires you do it in 90 minutes, so you can tweak the parameters as you see fit. eg, you could do something every 10 minutes. Ignoring the first 20 (setting up base infra) and the last 20 (constructing the rail / train). That leaves you with 50 minutes, or n=5. Instead of solving for n now, you're solving for number of labs. the equation looks like Labs Per Period * Period In Minutes * (n*(n+1)/2) = 177. N is 5, your period here is 10, so labs per period = (177 / 10) / (5*6/2). So, you're adding slightly more than a lab every 10 minutes for 50 minutes.

Sounds easy,, right?

What the speedrunners are doing wrong, I think, is over building production early on. Rather, they should be getting their labs out as soon as humanly possible and adding production / research incrementally. Handfeeding can help here quite a bit to do that, though some type of factory work makes sense.
OptimaUPS Mod, pm for info.

4xel
Fast Inserter
Fast Inserter
Posts: 107
Joined: Fri May 26, 2017 3:31 pm
Contact:

Re: To build or not to build (miners)

Post by 4xel »

A lot of very information on this thread, and your python script is surely invaluable in designing strategies. A lot of points remind me of Rain's speedrun guide:
https://www.youtube.com/watch?v=_0Kqc6JaSQs
notably the part where he says that the earlier you build a machine, the more value it will generate over the run, and how factorio speedrun are essentially capitalism where you want to reinvest your resources and grow exponentially.

However, I disagree with :
blazespinnaker wrote:
Fri Dec 18, 2020 12:58 pm
What the speedrunners are doing wrong, I think, is over building production early on. Rather, they should be getting their labs out as soon as humanly possible and adding production / research incrementally. Handfeeding can help here quite a bit to do that, though some type of factory work makes sense.
While it's true that that in theory, you want to build machines as soon as they are crafted, in practice, you have to run between the different parts of the factory you have to build. Speedrunner

That's why for example they mostly go 4 labs very early on then 15 then >30+modules labs or so -which is already incremental and which they do; adding incrementally a single lab at a time every 2 minutes 57 is pure insanity even factoring only walking time.

Now for very short speedruns like steelaxe or GoTLaP, or for the burner phase of any run, building incrementally with the finest possible grain should be done and is done by speedrunners.

I guess for longer runs, once you have bots you could make a point that most build should be broken down in two or more incremental steps and done alternatively with resource and crafter. But you have to bear in mind that player time is one of the resources you have to work with, you can't optimize just resources, crafting time and research time alone. IMO as long as your buffers are near empty at the end of your run, as long as all your machines and labs were working more or less constantly and as long as you're always doing something useful, you're doing fine, you're not doing anything obviously wrong.

Short of going full TAS or combinator computer + recursive blueprint, the more you optimize ignoring player time, the harder to execute. And I think going 2-5 labs very early, 15+ once red green in online and expanding a second time once yellow purple is online is a very decent compromise to ramp up labs incrementally without having to constantly tend to them.

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

Re: To build or not to build (miners)

Post by blazespinnaker »

Well, I see factorio as two games. Pre bots and post bots: viewtopic.php?f=5&t=92439&start=40

Everything changes once you hit bots. The combinatorial explosion and the optimization search space that bots provide is near infinite in possibility. I really think the infra that Any% folks develop pre bots is about 85% a waste of time if it is delaying them to getting to bots. Though it looks cool :) The gotlap runners, IMHO, are the best of the bunch and all runs will eventually converge on their tactics. It's unfortunate they are running for trains and not bots, tho.

That all said, it's not a super hard rule to skip all infra. For example, setting up a smelting farm very early on that you will leverage when you hit bots may have some value. There are probably other exceptions to the rule as well.

Intutions like "the earlier you build a machine, the more value it will generate over the run" are useful, but the stumbling block I was running into was specifically quantifying so as to calculate precise timing and rate of placement for optimal build orders, which is how I arrived at using the gauss formula.

Btw, it's worth noting that recent improvements in gotlap time have coincided with starting research earlier.

TAS isn't really the way to go, but as another player mentioned, slowing the game speed down is the best way to determine optimal actions per minute. Yes, certain finnicky things become more viable at slower speeds, but reality checks by speeding it up keep things practical.
OptimaUPS Mod, pm for info.

Post Reply

Return to “General discussion”