Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Verilog2factorio (github.com/redcrafter)
313 points by linux_is_nice on April 25, 2021 | hide | past | favorite | 70 comments



That's it, I am done. No more serious IT work for me. I am going to become a gamers consultant. If there are people who care enough to make things like this, there must be people who would pay decent money for "professionals" to come in and optimize their factorio game, or their minecraft builds, or to make them feel good about their solution to a Zachtronics puzzle.


You joke, but Factorio is a sufficiently "crunchy" logistics game that it has prompted me to study a number of serious topics, from learning linear programming to determine optimal production ratios, to dipping my toe into learning about the broader subject of systems dynamics, with stocks, flows, feedbacks, and so forth. I maintain that it's an excellent educational tool for these sorts of subjects.


> minecraft builds

Yeah that's the whole point of Roblox bucks for example, paying creatives for their builds


No doubt, gaming support has been a serious business for a while. Far beyond the gold farming, item trade, and "pay me for voice chat" underground. I'd take a bet that almost everybody reading this who cares about cloud providers has come into contact with companies who started out by providing servers and administration services for Counter Strike or Minecraft.


I’m guessing you’re mostly not serious, though I acknowledge there may be a market for what you describe.

As a lifelong gamer since the Commodore 64 (since parenthood scaling it way back to mostly crewing a tank in Hell Let Loose with two friends, or a ttrpg with same), looking back it feels like I took refuge in a medium (single-player games) ultimately less valuable than other-format stories, like books, film, and radioplays. What I’m driving at is a feeling that I’ve enjoyed elevated layers of luxury that may be an indicator of too much idle time for too many people in US culture. Is this a common mindshift with age?

Escape has a place, but a whole industry built around spending so much time in abstraction layers feels like a problem if it’s not helping us relate to each other better.


Video games are just a younger medium than books and movies. Even TV needed more time to be seen at a similar level to movies in terms of art.

We're getting there though. The past 15 years have given us many masterpieces of gaming that can absolutely be considered art, and they're becoming more and more common. As this happens more and more, the medium is taken more and more seriously.

Many games still suffer from feature-creep by way of trying to please users demanding "content". This incidentally make them feel like the primary goal is to waste time rather than to experience a high quality story. In other words, there are still too many "Big Bang Theory" and not enough "Breaking Bad" so that is why it still feels less valuable.

Because I told you I just binged The Queen's Gambit, you wouldn't look at me like I wasted my time, you'd ask me about the story. If I told you I just binged TBBT, you'd just think I'm nuts. (No offense if you like TBBT, it was a decent sitcom for a couple seasons, but … hey, you do you).

For example, I just finished Control. A wonderful, high quality game. Great storytelling, great mechanics, and … a crapton of completely useless busywork that is just there because it's expected to be there. A talent tree, repeat random side-missions, a crafting system, etc. None of this is useful to the core game. It's a shame because I believe if it had done less in terms of busywork mechanics and maybe focused a tiny bit more on puzzles, that game could have been a masterpiece of the same caliber as Portal and Portal 2. (Can you imagine if Portal 2 had a talent tree and a crafting system?)

Instead, it's a Season 7 of Game of Thrones. Great production value, but so hit and miss in terms of final quality because of avoidable mistakes. Could have been so good, you know?


Thanks for reminding me about Portal, and for the TV analogy. It might have been a Gamasutra article about games also being works of art, and a young medium (tabletop games, too, have both come a long way and have room to grow). We certainly have a plethora of options for how we spent our time alive.


The key is in streaming your work.


I would love the inverse as well: Factorio2Verilog. Then I can use Factorio as an IDE.


There's also Verilog to Minecraft.[1]

[1] https://github.com/itsFrank/MinecraftHDL


Seeing that 6502 reminds me that ARM also provides a free (restricted license) version of the Cortex-M0 and M3 cores in Verilog format...


I would love to see some screenshots added to the README.

I get that it compiles a Verilog design into a Factorio Blueprint, but what does the resulting factory look like? Is it just a bunch of wires and combinators?


> but what does the resulting factory look like? Is it just a bunch of wires and combinators?

It seems like... yes?

https://user-images.githubusercontent.com/35386456/115978429...


Cool! The screenshots added since I commented definitely help make this understandable!

I can definitely see some players building parts of their factories using this.


Kinda looks like the shape of Africa, I wonder if it’s ln purpose.


I did not expect this to be written in TypeScript.

The intersection of people who really understand Factorio, Verilog, and TypeScript has to be less than 250,000 people on entire planet -- in the entire universe.


I think “250,000” is still orders of magnitude too high - I would bet you that the number of people who simply know verilog is lower than 250,000.


I would bet it's less than 10,000 in the entire world.


This feels a bit like that classic estimation interview question...

Verilog originated in 1984 and educational institutions have been teaching it roughly as long, multiply by how many students graduate each year in an EE-related field and I'm pretty sure the number is far more than that in India alone.

Of course, the number of people who know Verilog (and Factorio) enough to implement something like this is going to be a fraction of that.


Sure, but there’s a difference between “had a couple courses using it in college” and “have an understanding of the language sufficient to develop a novel backend”.


This project actually uses Yosys. From a quick glance at the code, this tool essentially uses Yosys for the heavy-duty logic stuff [1], resulting in a JSON-based logic definition using a couple of standard cells (DFF, MUX, arithmetic, etc.) that verilog2factorio parses [2] and translates into predefined Factorio blueprints. The only part that I couldn't find would be laying out the cells into the overall blueprint (and performing routing).

[1] https://github.com/Redcrafter/verilog2factorio/blob/9691b702...

[2] https://github.com/Redcrafter/verilog2factorio/blob/9691b702...


It does simulated annealing in src/sim.ts, I think.


You don't need much understanding in advance to develop a novel backend, since you are forced and guided to learn the whole language as you try to write the backend and start pattern matching on the data structures.


I don't consider "took a class in it" sufficient to constitute "really understand" in most subjects. Classes often don't actually teach actual understanding of the subject, and even when they do, most people end up forgetting it afterwards.


Some saw/earnt vhdl someone after it emerged. ~half? Verilog had a popularity ramp up time of a few years too. I'm going with a much smaller number than you there. Could be way wrong!


I think the apparent increase in Verilog popularity is due to pretty much all FOSS toolchains (i.e. mostly Yosys) only supporting Verilog [1], so most of the content publicly visible on blogs etc. uses Verilog.

And I guess the reason that most tooling focuses on Verilog is that the VHDL standard is a little bit of a mess from a parsing point of view. Essentially, in order to correctly parse some VHDL file A you first need to parse every other file that A might depend on. [2] Source: Tried writing a VHDL parser a few years ago.

[1] AFAIK you can buy a license for a VHDL frontend from one of the companies contributing to Yosys, but that's a different story.

[2] Example: What is f(1)? It could be a) calling a function called f with a parameter_association_list consisting of 1 or b) an indexed name, accessing an array called f at index 1, or c) some other things if we're not currently in an expression context. The only way to parse this correctly is to know what f is, but if f is not defined in the file you're currently parsing, there's no way to know other than parsing all other files...


VHDL/Verilog is a bit like Pascal/C division used to be, with VHDL having more fans in Europe and Verilog on US, and then the respective countries that do business with them.

At least that is how I understand the market division, it might also be that one of them has already won, not sure about that.


I decided to learn Verilog after reading of a different division. Namely that VHDL is the preferred option of defense industry applications in the US, Verilog preferred in non-MIC business. Given the advantages of VHDL over Verilog looked less than overwhelming and Verilog has some advantages of its own, (verilator, seemingly more RISC-V cores in verilog, open-source tool chain looks closer to being useful to me etc.) That's the call I made. It looks like it's not so hard to switch from one to the other if you need to do that though.


Can confirm was taught vhdl in my robotics master's degree this year, studying in Europe


I love it, because we are finally getting into the state that people don't cargo cult C and C++ as being the only path to write compiler related tools.


But the number of people who understand verilog, but not typescript (or at least javascript), is probably close to zero.


That seems unlikely. Plenty of electronics engineers working in Verilog, who haven’t ever glanced at Javascript.


But to use TS as a language of choice? Different story.


You haven't met a lot of electrical engineers.


There are dozens of us.


TypeScript pays better than verilog, so I bet quite a lot of people who learned verilog knows it.


If you write your own language the only people who know how to use it is 1 :)


I bet it’s less than 10000.


Repo updated with examples.


Someone needs to make a video about this.


I love this! would love to see this used in a introduction to hardware course.


Note that factorio data propagation in circuit is not fast.

In factorio, it will take one frame for two objects connected by the circuit to synchronize. The game runs at 60fps. So, if you connect 60 components in a series, it will take 1 second to propagate a change.

This is the basis of how clock circuits work, but I guess is not perfect for the more complex circuits.


wow, this is pretty cool!


[flagged]


Please follow the site guidelines that ask you (a) not to take HN threads on flamewar tangents, and (b) not to fulminate. Those things lead to less interesting conversation.

https://news.ycombinator.com/newsguidelines.html

We detached this subthread from https://news.ycombinator.com/item?id=26929780.


> how many man-millennia have been wasted because of the armies of people who have posted something they're proud of, but is complete rubbish, on npmjs.org?

None. If someone is proud of something they worked hard on, why shouldn't they post it? What is the harm their hard work being public causes? It hurts literally no one.


Wow please stop with this gatekeeping. Seriously, people "posting their crap" is a great thing about open source. More should be encouraged to do so. If you look at my github profile you'll find the crap I wrote when I was 15 and still learning lua and python. The repos are of course archived and not claiming to be "web scale and enterprise ready", but nobody should shy away from learning in the open.

You know what the worst thing about open source actually is? People who aren't owed anything, demanding to only see high quality code for their free enjoyment.

Seriously, this is a neat clearly proof of concept tool for a video game that is entirely about wasting time.


Please don't respond by taking threads further into flamewar. I get that your intention is positive but when you do it this way it does at least as much harm as good. If you took out the swipes it would work much better.

In fact, if the entire comment were just the third paragraph, it would be just fine.

https://news.ycombinator.com/newsguidelines.html


Ok, I've edited my comment to make it less hostile.


If you still open with "Wow please stop with this gatekeeping" then you're still breaking the site guidelines. Please do better. Threads deteriorate more from people's reactions to bad comments then they do from the bad comments themselves. Much more, actually, because flamewars wouldn't spread at all if the only reactions were downvotes and flags.


I've removed the inflammatory stuff, it was out of line. But calling people out on gatekeeping others from contributing in open source is not that, i disagree.

I usually just flag and move on, i probably should have done that here too, but i stand by what's left of my comment post-edit.


If you're tempted to use the phrase "calling out", you're probably not in the intended spirit of this site.

https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...

That kind of thing has poisonous systemic effects. It's not worth it.

https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...

Btw, I agree with you on the underlying point. But how one goes about making right points is exceedingly important. It may be more important than wrongness, although that's an unfashionable perspective at the moment.


Fair enough.


[flagged]


I understood your comment just fine. Yes you are the one gatekeeping. No, people still don't owe you high quality code.

If a repo claims to be something that it isn't, you can complain (to the extent that it's polite and that your complaint might well be ignored regardless). Better yet would be to contribute.

The last repository whose quality-to-claimed-usefulness ratio was bad enough that it got me to complain, I now maintain. Be the change you want to see, instead of muttering about man-hours.


Where is this code ever claimed to be useful?


am not talking about this code, and never was.


They couldn't put in a sentence stating what this actually does?


I’d imagine the target audience for this consists entirely of people who already know what Verilog and Factorio are. And if you’re part of that intersection then it’s instantly obvious what it does from the title alone.


I'm no expert on the topic, but it looks like a protocol for interpreting hardware logic into a Factorio game board.


They managed to describe fully what it does in the project name and post title.

Unless you want an explanation of what verilog and factorio are, but then that sounds like it's another question from "what this project does".


Verilog is a hardware description language. So for example you could use it to program your FPGA (FPGA is a digital circuit you program from scratch). Factorio is an interesting video game where you basically use limited resources to construct factories that build different objects, the success depending on how well you design and optimize your factories.


The repository states in it's readme:

> This project will compile verilog (a hardware description language) into factorio blueprints.


Always thought programmatically generating Factorio blueprints was a really cool idea and Verilog seems like a great language to model blueprints, but this repo definitely needs more work before being shared with the world.

One of my favorite tools that shows what's possible: https://autotorio.com/example/outpost


> this repo definitely needs more work before being shared with the world

No, don't say that :( I see way too many people that don't want to share their code because they don't think it's tidy enough or complete enough and that they just need to clean it up or adding some more features. But the thing is that they never get around to cleaning it up or adding those features and therefore they never share it. And often times I have seen this happen with stuff that is really good and usable.

"Perfect is the enemy of good" applies 100% in such cases.


The repo totally stands on its own now but when I made the comment it was only a few sample files and a readme with a few lines on how to install the project without any mention of what the project actually was besides its name. Now with a proper readme and some pictures I think it's much better.


Great idea to comment on someone else's post on HN by pointing to related work, but the communication standards of the parent definitely need some work before being unleashed to the world.


> Great idea to comment on someone else's post on HN by pointing to related work

Almost every Show HN has references to other similar works in the comments. The point is to have a good discussion and I think talking about similar works is highly relevant.


Hence GP earnestly calling it a great idea.


No reason not to share works on progress with the world!


Oh yeah, it's not production ready, to all who depend on it be warned !


Neat, I'd never seen outpost generator before, quite useful. I wish it were possible to generate blueprints directly from mods so stuff like that could be directly integrated into the game.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: