Friday Facts #392 - Parametrised blueprints

Regular reports on Factorio development.
Rebmes
Long Handed Inserter
Long Handed Inserter
Posts: 75
Joined: Sat Sep 15, 2018 7:51 pm
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by Rebmes »

It's understandable, but as a casual player I barely scratch the surface of blueprints, and will never need this.

Etherblood
Burner Inserter
Burner Inserter
Posts: 14
Joined: Tue Mar 21, 2017 12:20 am
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by Etherblood »

Until now I had to put placeholder names into my blueprints, export them as string, process them with a selfmade program to generate blueprint copies for each recipe, and then import it into factorio.
This will be so much easier now, thx!

My program also calculates wagon filters for a given recipe which is very convenient, like this:
Screenshot 2024-01-05 174339.png
Screenshot 2024-01-05 174339.png (1.1 MiB) Viewed 1951 times
The train in the screenshot visits all ingredient stations, waits at each until the matching ingedients are full (meaning the math also applies to train schedules), and then goes to the assembling station to unload all ingredients.
There won't be any ingredient balancing issues due to the filter ratio on wagons.
(Note: This is not possible for all recipes, eg. satellite ingredients cannot be loaded into a wagon with perfect ratio like this.)

Will something like this also be possible?
Last edited by Etherblood on Sat Jan 06, 2024 2:50 am, edited 14 times in total.

Script_Coded
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Jan 05, 2024 4:50 pm
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by Script_Coded »

I've never posted here but felt like I had to create an account just to say thank you!!!

Zsigu
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Jan 05, 2024 4:20 pm
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by Zsigu »

Upserter wrote:
Fri Jan 05, 2024 1:50 pm
I really appreciate the effort that goes into improving the game experience for power users. I hate to come across negative, but part of me does feel that this goes too far, while also not going far enough. Something about it reminds me of "low code / no code" tools, or perhaps GUI query builders like you might find in SAP BusinessObjects. They look great at first, and they get the job done for many, but in my experience they have a couple of unfortunate failure modes:

1) They aren't quite powerful/complex enough and users get frustrated by their limitations. In the case of parameterised blueprints, there are all kinds of extra features you could imagine a player wanting: maybe to put an if-statement into the variable definition somewhere, or to set the belt tier using a parameter, or to hide/show elements depending on a parameter value, or to use a math expression that you hadn't anticipated. Once you give users a sniff of this kind of configurability, they will inevitably yearn for more. The programming analogy that comes to mind is the C preprocessor - initially just a simple, optional parameter substitution facility. But it was quickly expanded to be nearly Turing-complete in its own right.

2) They are so complex that they are tantamount to doing real programming, but without the support of real programming tools, and real programming would actually be easier. This is where Enterprisey tools often end up. I've seen some horrific "no code" applications that would have been dramatically simpler if a few lines of Python had been allowed.

Maybe you'll manage to find a balance that works for Factorio, but I can't help wonder if you should just bite the bullet and give us a Lua Combinator. Not in a cheaty sense - just give the player programmatic access to defining blueprints. Take input values from the circuit network. Modify a blueprint object using Lua code, or define one from scratch. Keep the parameter-supplying GUI that you've built here, but allow the player to embed Lua code into the blueprint which does all the work of deriving values and handling dependencies - and more. Output a blueprint item. Insert it into a roboport to have bots build it at a specified location.
There's a Minecraft mod called "computer craft", maybe someone here has heard of it, it got pretty popular. It released around 2011, and introduced some turtles that you could program in lua (and a bunch of other stuff later on). A lot of incredibly creative stuff was built with it, I watched several survival playthroughs where they would program the turtles to mine, kill mobs, dig tunnels, etc. It had a very hands-on feel, and didn't feel too detached from the game either which is rare. It got many kids into lua programming, me included.

So anyways, I can absolutely imagine your Lua Combinator fitting into the game well if care is taken and, well, it's Wube.
Space Engineers has C# programmable blocks as well, though I don't think they integrate quite as nicely as CC does.

Although as far as I'm concerned, they could just merge Shenzen I/O with Factorio and have combinators and chips with their own 50 page manual haha. That'd be great.. (https://usermanual.wiki/Document/SHENZH ... 22646/view)
Last edited by Zsigu on Fri Jan 05, 2024 5:03 pm, edited 2 times in total.

epartridge
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Apr 07, 2021 4:30 am
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by epartridge »

THANK YOU!

This is the one thing on my expansion wishlist I never thought I'd get to see. This announcement made my week; blueprint parametrization will be invaluable to me. It will make city blocks so much more ergonomic to design, as well as a thousand other things I'm sure.

Thank you for having enough faith in the community to explore a feature like this.

User avatar
FerMod
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Mar 12, 2017 10:21 am
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by FerMod »

I have no words. I simply love this feature.
I can't wait to play with all the new toys you are going to give to us.

Kadet123
Inserter
Inserter
Posts: 46
Joined: Sat Sep 24, 2022 1:56 am
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by Kadet123 »

I love the idea behind the feature, and I think most veterans and hardcore players will love it. But I'm a little afraid newer players will shy away from it.

When the article first started, my first thought was "oh boy, they are finally making the upgrade planner be able to replace item names..." I was expecting someone to plop down the fish station, and hit upgrade planner and select replace fish with iron plates, and all the filters, train stop names, etc would get updated in whatever area they selected next.

Maybe that can be considered as a simpler alternative, or maybe we can have both?

I'm not saying I dislike the feature, I love it a lot. It has a lot more capability than I was initially picturing. Just offering some feedback.

Kadet123
Inserter
Inserter
Posts: 46
Joined: Sat Sep 24, 2022 1:56 am
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by Kadet123 »

Also, a question about the "ingredient of" feature.. How does this behave if an item has multiple recipes? For a vanilla example, if I select light oil, its ingredients might be any of heavy oil, crude oil, water, steam, or coal depending on the recipe. (From Heavy Oil cracking, Advanced Oil Processing, or Coal Liquifaction). Or other examples like mods that have a dozen ways to make iron plates.

Do all of the possible inputs get populated? Or maybe, when you're selecting the "Ingredient of" feature, the "item to craft" isn't really an item, its a recipe?

Sorry if I just missed a detail somewhere..

ElderAxe
Fast Inserter
Fast Inserter
Posts: 131
Joined: Thu May 18, 2017 8:04 am
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by ElderAxe »

03noster wrote:
Fri Jan 05, 2024 4:36 pm
Looks amazing. Now the only thing we need are basegame recursive blueprints!
Yes please

User avatar
thecatlover1996
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Sun Sep 18, 2016 12:50 pm
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by thecatlover1996 »

I love programming, I love Factorio, and I absolutely love the fact that Factorio is introducing features especially for programmer-brains more and more 🤓

dexteritas
Burner Inserter
Burner Inserter
Posts: 16
Joined: Fri Nov 13, 2020 5:57 pm
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by dexteritas »

Parametrized blueprints are a really nice and convenient extension.

I also have some ideas to further extend this feature:
  1. It would be nice to have default parameters, e.g. by adding a button "save as default" to the "blueprint parameterization" GUI.
  2. A more general approach could be to save a parameter configuration by an arbitrary name that would appear in a dropdown menu in the "blueprint parameterization" GUI the next time for easy reuse.
  3. Additionally or instead of 1. and 2., a button to export a specific parameter configuration (instance) as new blueprint with two options:
    1. independent copy (similar to the existing "duplicate blueprint" function)
    2. reference blueprint: this blueprint is just a reference to the original parametrized blueprint and would change if the original is changed, but saves the chosen parameters.
Motivation for 3b: You could have different blueprints for train unloading stations, that occur multiple times (scrollable in one blueprint book). You would be able to change the layout for all reference blueprints at once by just changing the original one, in a way that can't be done by upgrade planers, e.g. adding lamps, concrete, laser turrets or optimize the rail layout.

ElderAxe
Fast Inserter
Fast Inserter
Posts: 131
Joined: Thu May 18, 2017 8:04 am
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by ElderAxe »

Kadet123 wrote:
Fri Jan 05, 2024 5:56 pm
Also, a question about the "ingredient of" feature.. How does this behave if an item has multiple recipes? For a vanilla example, if I select light oil, its ingredients might be any of heavy oil, crude oil, water, steam, or coal depending on the recipe. (From Heavy Oil cracking, Advanced Oil Processing, or Coal Liquifaction). Or other examples like mods that have a dozen ways to make iron plates.

Do all of the possible inputs get populated? Or maybe, when you're selecting the "Ingredient of" feature, the "item to craft" isn't really an item, its a recipe?

Sorry if I just missed a detail somewhere..
Nice catch. This is more common on mods like PY, KS2, SE, Angels. etc. You can have multiple recipes of same item with different yields and different side products.
So if selecting "ingredients of" will be an option for parameters, selecting "output #x of..." or "recipe of" should be possible as well.

It should be possible to configure something like this: Parameter #1 is a "Recipe" for Parameter #0. So when player choose Solid Fuel as Parameter #0, If there are multiple recipes researched & active for Solid Fuel, player should choose one of the recipes. So Parameter #2 can be set as the fluid on unloading station.

Since the scenario above feels like overkill, then how can we force the player to choose a recipe of Solid Fuel instead item/signal of Solid Fuel?

ElderAxe
Fast Inserter
Fast Inserter
Posts: 131
Joined: Thu May 18, 2017 8:04 am
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by ElderAxe »

dexteritas wrote:
Fri Jan 05, 2024 6:12 pm
Motivation for 3b: You could have different blueprints for train unloading stations, that occur multiple times (scrollable in one blueprint book). You would be able to change the layout for all reference blueprints at once by just changing the original one, in a way that can't be done by upgrade planers, e.g. adding lamps, concrete, laser turrets or optimize the rail layout.
If you're talking about different type of unloading station versions like red belt, blue belt, provider chest, fluid, ltn, warehouse etc.. then you always need to modify each version and having some part a blueprint referencing another part from the master blueprint would complicate the game soo much.

If you're talking about different unloading stations for iron, copper, steel etc. This is the most common issue parameterized blueprints solves. By having one unified train unloading station blueprint and to choose the parameters after placing the blueprint. When you update your one blueprint, all newly placed stations will have the latest version.

dragon_gawain
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Dec 19, 2021 11:37 pm
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by dragon_gawain »

I've been wanting this for years.
Would it also include the ability to modify modules?
For example, lets say I have an old blueprint that uses assembly machines 1's. I then use an upgrade planner to upgrade the assemblers in that blueprint to tier 3's. Now, there are more module slots available. Would I be able to fill in those module slots (or even better, parameterize) those module slots?

Bloodred217
Burner Inserter
Burner Inserter
Posts: 9
Joined: Tue Apr 11, 2023 10:49 am
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by Bloodred217 »

This is a nice feature to have. I kind of 'worked around' this problem up until now by having a main BP of a build with temporary configuration and then a set of simpler BPs which just contained things like stations, combinators and so on with specific settings on them. In practice I'd paste the main BP to build everything and then place a specific configuration BP on top. Being able to just set parameters is going to be a big improvement and make this a lot easier. I don't think I really needed things like parameter formulas anywhere up to this point but I can imagine situations where these would be useful and if a system like this is being added it makes sense to build in such options from the first place, so I'm glad to see them.

Thinking about formulas immediately brings the idea of configuring things based on item stack size, potentially useful when dealing with train stations and inventories in general. I wonder, is it going to be possible to access item stack size in some way? Say I want to set a number in a combinator that's equal to 10 stacks of a particular item. That could be 1000 for 10 stacks of iron plate, or 100 for 10 stacks of LDS, or 500 for 10 stacks of iron ore and so on. Would something like this be achievable with BP parameters by setting the item type and having the parameter system know what the stack size of the item is?

Tooster
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Wed Mar 24, 2021 6:42 pm
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by Tooster »

ElderAxe wrote:
Fri Jan 05, 2024 6:32 pm
So if selecting "ingredients of" will be an option for parameters, selecting "output #x of..." or "recipe of" should be possible as well.

It should be possible to configure something like this: Parameter #1 is a "Recipe" for Parameter #0. So when player choose Solid Fuel as Parameter #0, If there are multiple recipes researched & active for Solid Fuel, player should choose one of the recipes. So Parameter #2 can be set as the fluid on unloading station.

Since the scenario above feels like overkill, then how can we force the player to choose a recipe of Solid Fuel instead item/signal of Solid Fuel?
This calls for a pattern matching :D

Code: Select all

[productParameter] matches [recipe]: [ingredient1] [ingredient2] [_] [ingredient4])
where `productParameter` is bound to a recipe output, recipe can be `*` (any) or a concrete recipe, and `ingredient1...4` are bound to matching recipe ingredients with `[_]` being an omitted and unbound ingredient.
Look mom, I made a mod ^^ Barrel Stages

BinarySpike
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Jun 28, 2016 2:15 am
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by BinarySpike »

ElderAxe wrote:
Fri Jan 05, 2024 12:46 pm
https://mods.factorio.com/mod/blueprint-variables this mod provides parameterization on blueprints right now. But since i share my blueprints, everyone that wants to use parameterized blueprints needs to have this mod installed as well and that makes it unusable for my case.
I've been working on a "compile" feature that lets you get a vanilla blueprint output from your selection.

Though, I'm blown away that Wube was probably working on this while I was working on my mod!

twostepSA
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Jan 05, 2024 7:51 pm
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by twostepSA »

Can we have the ingredients sorted by quantity needed? Or at least an option in the BP for that? That way people can design BPs that are optimized for inserting the most of ingredient #1, then #2, etc.

Blitz4
Inserter
Inserter
Posts: 21
Joined: Sat Mar 07, 2015 9:37 pm
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by Blitz4 »

Add Blueprints as a downloadable mod. This somewhat makes them a mod. But more importantly cool creations should be shared and this is going to create some cool stuff.

Also, speedrunners can use blueprints, but not mods.

Blitz4
Inserter
Inserter
Posts: 21
Joined: Sat Mar 07, 2015 9:37 pm
Contact:

Re: Friday Facts #392 - Parametrised blueprints

Post by Blitz4 »

BinarySpike wrote:
Fri Jan 05, 2024 7:40 pm
ElderAxe wrote:
Fri Jan 05, 2024 12:46 pm
https://mods.factorio.com/mod/blueprint-variables this mod provides parameterization on blueprints right now. But since i share my blueprints, everyone that wants to use parameterized blueprints needs to have this mod installed as well and that makes it unusable for my case.
I've been working on a "compile" feature that lets you get a vanilla blueprint output from your selection.

Though, I'm blown away that Wube was probably working on this while I was working on my mod!
:) very cool

only other game I know that has a similar feature is dfhack's quickfort for Dwarf Fortress

Post Reply

Return to “News”