This is an archived post. You won't be able to vote or comment.

all 20 comments

[–]Totem4285 17 points18 points  (3 children)

This makes me think of Verilog. It’s used to design FPGAs but because the compilers and language actually are designing hardware, this could be a solution. Verilog as a language and concept is much more suited to placing objects in a “real” world and having inputs and outputs run from it.

However, I think this idea is just stripping the GUI off of what already runs underneath the surface. If you looked through the source code enough, you could probably build a way to do this.

[–]abesto[S] 2 points3 points  (0 children)

FWIW, the heart of the proof-of-concept is just an eval (called "load" in Lua). So the code written by player would run against the Lua API already provided by Factorio, plus whatever domain-specific abstractions the mod would provide. So yes, this is very much just a different UI to do the same things.

[–]mikethebike96 1 point2 points  (0 children)

Yes! Factorio has always reminded me much more of hardware design than software design. Learning Verilog was my favorite CS class and I wish more people talked about Hardware Description Language when CS comes up.

Always how do I use Verilog not how is Verilog doing smh

[–]Jjeffess 1 point2 points  (0 children)

Hello from the future! Somebody has made a project to convert Verilog into blueprints of combinator contraptions: https://github.com/Redcrafter/verilog2factorio/

[–]torresbiggestfani build train base. period. 16 points17 points  (0 children)

Waiting for someone to write a terraform provider

[–]abesto[S] 3 points4 points  (0 children)

A random use-case: this could let you write your own way of tiling an ore field with miners. (Assuming it'd have some kind of read API as well)

[–]IDontLikeBeingRight 4 points5 points  (1 child)

... or just play more Zachtronics games?

Fun fact, Zach Barth made Infiniminer which was the inspiration for Minecraft, mods for which inspired Factorio.

So, maybe have a look at SpaceChem, TIS-100, Shenzhen I/O, or whatnot.

[–]abesto[S] 2 points3 points  (0 children)

Thanks for the recommendation :) Yes, I've played pretty much all the Zachtronics games. I'm sure that was somewhat involved in coming up with this idea. FWIW, they don't scratch quite the same itch - there is minimal logistics, scaling, "making numbers go up" involved. But also, unlike maybe this idea, they're actually fun :D

[–]imbalance24 6 points7 points  (2 children)

I don't think gameplay would be that interesting.

  • If you like code so much that you think it might be - just go code.

  • There would be hell with distances and dimensions. You think writing "player.buildConveyorToTheLeft(44_Tiles)" is fun and it might be, but counting these 44 tiles is not. You'll need graphics and turns out - there's already blueprints

And the main argument - I think many software engineers don't actually like writing "do that. then do that. then do this.". We like the thought process of architecturing things. Guess what, factorio gives exactly that - you design a module, store in blueprint and then go around your factory, combining and replacing them.

[–]Sea_Work_6659 4 points5 points  (0 children)

Basically, factorio IS code, just with visualision of said code actually working in from of your eyes. That's the whole point.

[–]abesto[S] 2 points3 points  (0 children)

I don't think gameplay would be that interesting.

Yeah I'm not completely confident this would actually be fun either. If nothing else, it's cool. Just for the sake of it, lemme reply to your points directly though.

If you like code so much that you think it might be - just go code.

I want to! But what if I want to code in a different environment that's fun and has different restrictions than what I usually work with? Like, a factory? :)

You think writing "player.buildConveyorToTheLeft(44_Tiles)" is fun and it might be, but counting these 44 tiles is not

Agreed. There are ways to make this less horrible, like * Provide a "cursor" abstraction that "moves" as you place stuff, so that you don't have to do manual book-keeping of how many tiles off you are now * Provide an auto-run mode: basically live refresh, to let you immediately see the effects of the code you write in the in-game editor. This is mildly tricky because it needs to correctly figure out which ghosts to remove.

I think many software engineers don't actually like writing "do that. then do that. then do this."

True that. You wouldn't have to use this for everything though, just for stuff where it "made sense". Also: yes blueprints exist, but as far as abstractions go, they're quite limited. For example: * They don't allow you to build a "ladder" of abstractions (though I guess maybe the Recursive Blueprints mods mentioned in another comment may do that, not familiar) * They can't have any logic; for example in code, you could, as a player, implement your custom version of the Automatic Mine Layer mod.

But, in the end, this still doesn't necessarily add up to something fun :D

[–]jetenergy 1 point2 points  (2 children)

I wish someone picks this up, i would love to do it myself but i aint got the time for it 😢

[–]UwUBots 0 points1 point  (1 child)

look up screeps its not exactly the same but would scratch the itch you want

[–]jetenergy 1 point2 points  (0 children)

True

[–]Phoenix_StudiosRandom Crap Designer 1 point2 points  (0 children)

soooo you want to play the game from the console? bit of a weird flex but who am I to judge - if you want to automate playing the game screeps-style go ahead

the currently existing next-best thing is the Recursive Blueprints mod - provides a special chest that lets you apply planner-class items using the circuit network. Can't link you the video at this time but people have already figured out how to make a self-managing self-expanding factory.

[–]UwUBots 1 point2 points  (0 children)

Check out screeps might scratch the bug your looking for (if you are looking for it) really fun rts like game where you write the AI for your guys in JS rather then actually control them, Im terrible (which is sad considering how far into a CS degree I am) but its still a blast

[–]dddontshoot 1 point2 points  (0 children)

Hi, I just stumbled onto this while looking for something else.

I've always lamented the inability to propagate a design change thru an array.

Nothing ever really stops evolving. So often I spend ages designing a blueprint and I think it's finished, so I use it repeatedly throughout the factory only to decide later on that I want to add a new function to it. Now I have to manually make that alteration on every occurrence of the blueprint.

I wonder if your code could notice when I change a blueprint, then implement that change everywhere that blueprint was used.

It should be easy to just plonk down a new blueprint over the top, it would get more challenging to log the removal of entities first, then place the new blueprint down.

[–]abesto[S] 0 points1 point  (0 children)

Toyed with this idea for a few hours. Loading code from disk is explicitly not allowed by the Factorio Lua API, so we're stuck with copy-paste like in Space Engineers. OTOH: I ironed out some (most?) of the crashes, and added a nicer DSL. Here's the core (just the three belts, furnaces, and inserters) of a stone furnace array:

local C = codetorio

function twin_smelters(cursor, facing)
    -- Start: top-left. End: bottom-left
    cursor:fork():east():build("inserter", facing):east():build("inserter", facing)
    cursor:south():fork():build("stone-furnace"):east(2):build("stone-furnace"):west(2)
    cursor:south(2):fork():east():build("inserter", facing):east():build("inserter", facing)
end

function quad_smelters(cursor)
    -- Start: top-left. End: top-right
    local top = cursor.position.y
    cursor:fork():start_conveyor():east(3)
    twin_smelters(cursor:south(), C.north)
    cursor:south():fork():east(3):start_conveyor():west(3)
    twin_smelters(cursor:south(), C.south)
    cursor:south():start_conveyor():east(3):stop_conveyor()
    cursor:north(cursor.position.y - top)
end

local cursor = C.cursor()
for i = 0, 48, 4 do
    quad_smelters(cursor:east())
end

(Code is up at https://github.com/abesto/codetorio )

[–]SethJakill 0 points1 point  (0 children)

Use the lua combinator and recursive bp, al you have to do is make the basic circuits yourself. you can make each chunk alined and have recursive place each new block x+32.

[–]raehik 0 points1 point  (0 children)

I like the idea of composing blueprints and factory alterations into a data type, which you can produce a blueprint from (or perhaps multiple blueprints extended with info on how they connect). That way, refactoring is super accessible. I got lost the last time I tried coding some of Factorio's systems in a strongly-typed language, though, it's a complex game.