If you've ever done a lot of combinator stuff, you know it can be tedious to do by hand. I wrote a node.js library to make it very easy to import/export blueprints, and modify or just read them! Here's a video where I've taken advantage of the ability to interact with things outside of Factorio...
Unfortunately, this video is not available in your country because it could contain music from SME, for which we could not agree on conditions of use with GEMA.
Re: Generating Blueprints by Coding
Posted: Tue Jul 05, 2016 7:38 pm
by DemiPixel
delassa wrote:Ok I must say that is the first time I have ever been rick rolled and enjoyed it, that is fantastic man.
Well, my hope is that this library could be used to generate tedious, repeated things such as RAM for a computer or whatnot.
Re: Generating Blueprints by Coding
Posted: Sun Jul 17, 2016 2:02 pm
by Amegatron
Nice library. Though I'm not goot at JS, i wrote a simple code to generate somthing like ROM. Also I noticed some strange things. For example, the generated blueprint has an incorrect preview in game: my combinators are spaced incorrectly in preview and wires are floating in the air But the actual placement is correct though. See the screenshot:
Also I could not understand the units I should specify when creating an entity. I thought 1 is 1 tile in game, but as I saw in your example, 0.5 can also be used.
Also I think it would be nice to specify entity's direction when creating
Re: Generating Blueprints by Coding
Posted: Mon Jul 18, 2016 6:47 am
by nonstickfrypan
My 256 character 8x8 VGA font (viewtopic.php?f=8&t=28570) was not constructed by hand I wrote some "throwaway" C to create a blueprint for me.
Also I think it would be nice to specify entity's direction when creating
Umm, you can? (direction=)
Re: Generating Blueprints by Coding
Posted: Mon Jul 18, 2016 5:11 pm
by DemiPixel
Amegatron wrote:Nice library. Though I'm not goot at JS, i wrote a simple code to generate somthing like ROM. Also I noticed some strange things. For example, the generated blueprint has an incorrect preview in game: my combinators are spaced incorrectly in preview and wires are floating in the air But the actual placement is correct though. See the screenshot:
Also I could not understand the units I should specify when creating an entity. I thought 1 is 1 tile in game, but as I saw in your example, 0.5 can also be used.
As for the offset, that's an issue I've had as well and have been trying to figure it out. A temporary solution is to use blueprint string's "fixer" button which will fix a blueprint if you click a few times with it. (Is this still in the latest version of Blueprint String?)
As for the offset, that's an issue I've had as well and have been trying to figure it out. A temporary solution is to use blueprint string's "fixer" button which will fix a blueprint if you click a few times with it. (Is this still in the latest version of Blueprint String?)
Not sure how to fix it yet, unfortunately :/
Thanks for feedback. I'll check blueprint "fixer" as soon as I get to Factorio. As for direction - i meant an argument to "createEntity" method so it is created right in the needed direction (in most cases without direction I have to say "true" to "allowOverlap" for combinators and later specify their direction). In your example I suppose entity is first created, then rotated.
Re: Generating Blueprints by Coding
Posted: Mon Jul 18, 2016 6:12 pm
by nonstickfrypan
DemiPixel wrote:
As for the offset, that's an issue I've had as well and have been trying to figure it out. A temporary solution is to use blueprint string's "fixer" button which will fix a blueprint if you click a few times with it. (Is this still in the latest version of Blueprint String?)
// Hack: a) Next item is a decider and the width/pos seems relative to the right-hand side of the entity.
// b) Adding the constant combinator has already increased the x position by 1, but to account for
// observation (a) another 0.5 has to be added before a decider can be added (deciders are 1.5 wide)
//
So I obviously ran across a similar issue. Not really sure if my conclusions were correct though... it was weird
Edit: attached is the C code. It's a horrible mess. It's badly written. It's not generic. It's not a library (it was intended to do one thing only and that was make the font "ROM" and some lamps); it was written in about 30 minutes a throwaway code for the specific purpose of encoding the font data... so it's pretty useless but maybe it can help somebody.
Re: Generating Blueprints by Coding
Posted: Mon Jul 18, 2016 10:09 pm
by DemiPixel
Amegatron wrote:
Thanks for feedback. I'll check blueprint "fixer" as soon as I get to Factorio. As for direction - i meant an argument to "createEntity" method so it is created right in the needed direction (in most cases without direction I have to say "true" to "allowOverlap" for combinators and later specify their direction). In your example I suppose entity is first created, then rotated.
I see, because of overlap. Interesting... Perhaps I'll change the arguments to (name, position, opt) and include "direction" in the opt. You are correct.
nonstickfrypan wrote:Interesting. I have this in my code:
// Hack: a) Next item is a decider and the width/pos seems relative to the right-hand side of the entity.
// b) Adding the constant combinator has already increased the x position by 1, but to account for
// observation (a) another 0.5 has to be added before a decider can be added (deciders are 1.5 wide)
//
So I obviously ran across a similar issue. Not really sure if my conclusions were correct though... it was weird
Edit: attached is the C code. It's a horrible mess. It's badly written. It's not generic. It's not a library (it was intended to do one thing only and that was make the font "ROM" and some lamps); it was written in about 30 minutes a throwaway code for the specific purpose of encoding the font data... so it's pretty useless but maybe it can help somebody.
I change the position of the center. I believe if this is off by half a tile, it screws everything up (or something like that). Still not sure.
DemiPixel wrote:
I change the position of the center. I believe if this is off by half a tile, it screws everything up (or something like that). Still not sure.
That makes some sense and may be correct. I'm not sure either... I'll have to experiment some more!
Re: Generating Blueprints by Coding
Posted: Tue Jul 19, 2016 11:38 am
by ssilk
When I click on the video I see
Unfortunately, this video is not available in your country because it could contain music from SME, for which we could not agree on conditions of use with GEMA.
Well, I know how to go around such restrictions, but as moderator I need to ask, if you can upload it again without music?
Re: Generating Blueprints by Coding
Posted: Wed Jul 20, 2016 8:31 am
by nonstickfrypan
ssilk wrote:When I click on the video I see
Unfortunately, this video is not available in your country because it could contain music from SME, for which we could not agree on conditions of use with GEMA.
Well, I know how to go around such restrictions, but as moderator I need to ask, if you can upload it again without music?
And, perhaps, put a link to the video of the factorio action in BOLD because I suspect many people see this thread and don't actually realise the link is there or worth clicking on; and it IS worth clicking on
Re: Generating Blueprints by Coding
Posted: Thu Sep 15, 2016 11:17 am
by ssilk
I moved this to tools.
Re: Generating Blueprints by Coding
Posted: Thu Sep 15, 2016 1:59 pm
by nonstickfrypan
I would be nice if more people did this. I might start expanding my hacky blueprint generator code.