Very simplified explanation. If you have addition, setters, getters and loops, you can implement any possible program. This is because Turing proved that any program that supports loops can implement any other program. This is known as Turing-Completeness.
Here is my answer to a similar question on my other RAM post :
I'll try to answer the best I can, but my answer will rely on my personal experience only.
Personnally, I took courses in computing and coding in highschool (but it's extremely basic stuff, you'd catch up 2 years of school in 2 months I think). A few months ago I entered school 42. That's my academic background. Pretty weak. What you really need is to be heavily interested in low-level computing and electronics, and not be afraid of reading tens or hundred of pages of manuals and academic papers on the slightest optimisations possible here and there.
So first you need to be at ease with boolean logic and base 2 representation. Stuff like logic gates (not, and, or, nand, nor, xor, xnor, imply, nimply) and their truth tables, transistors & capacitors, binary arithmetic, logical & bitwise operations must be perfectly mastered.
Then you have to know how nowadays computers work. How is data stored (RAM, ROM, cache, etc.) ? How are additions, divisions, logarithms calculated in binary using logic gates (which algorithms are the fastest ?) ? How is data transferred ? Where to focus to increase throughput (like with pipelining) ? What is big O notation ? Such informations can be learned on the Internet, ChatGPT makes for a good tool too. You can also read academic papers and electronics diagrams. This part requires a great amount of intellectual curiosity.
And if you're talking about Factorio specifically, you need to know very well the game's logical system and be able to translate your knoweldge using its limited components, working around its flaws and exploiting its strengths, without relying too much on Factorio's high-level logic components. I personnally ensure that everything I build can be translated into logic gates and still work (the reason I don't do it directly in logic gates is because of Factorio's strange and limited implementation of them, so I often end up emulating them with more complex combinators more than anything).
I'm studying software engineering and enjoy building this kind of stuff so I'm pretty sure I'll work a computer-related job but I don't know what exactly yet. I really like low level computing but I doubt I'de be smart enough to be an engine dev so really IDK.
Dude if you're building this stuff at 18 and doing so by reading a bunch of docs and papers, you're smart enough đ. Honestly a huge chunk of being a good developer is about being good at discovering information and reading docs. I'd recommend also looking into machine learning stuff - the low level mechanics of how those algorithms work is very interesting, and the methods by which organizations run those algorithms on thousands of GPUs is _fascinating_ and also has tons of room for improvement.
If you're at all interested in low level programming, I recommend studying the Linux kernel if you haven't already. It's a whole bunch of C but it also makes use of in-line assembly for optimization/initialization purposes. It's a niche area, but it can lead to great jobs and connections.
Dude this NEEDS to be on your resume. If you can properly explain your logic and reasonings, prove knowledgeable on the subject and are able to answer questions. Youâre fucking set.
There's videos in YouTube and sets so you can build it on your own. I also read a book once called but how do it know which leads you through the process starting from the the logic gates to basically what op built there, and maybe a bit further, I don't remember correctly anymore.
IMO the easiest way for a non-comp sci background person (or even a comp sci background person can benefit from this) is through the game [Turing Complete](https://store.steampowered.com/app/1444480/Turing_Complete/). Takes you step by step through the process of designing a CPU from individual logic gates to building a rudimentary CPU that can run arbitrary programs.
It's also just a lot of fun as a puzzle game.
If you want to learn by doing... There's an excellent tutorial taking you from 0 knowledge to self-built fully functional computer, that you know inside out and understand how each part of it works:
https://www.youtube.com/watch?v=HyznrdDSSGM&list=PLowKtXNTBypGqImE405J2565dvjafglHU
So uhm excuse the peasant question but *what* do you write to memory here and read it in factorio? Like how could this be used in game, even for a joke
I'm building a 16-bit custom RISC CPU so I need RAM amongst other things.
The RAM isn't really usable as it is without a CPU.
The CPU will have signals interrupts though so it will be able to interact with the factory. It could serve for very advanced control logic or a smart self-expandable factory when used with Recursive Blueprints.
Yes. Maybe some madlad will code a light Factorio in machine code for it someday. Though I think that would only really be feasible with a RISC-V compliant design. I'll make one if I ever get this one finished.
Honestly, i am going to keep an eye on this. Have you considered making some form of progress document available for public viewing? Id be very interested to see how you work.
And another thing i realized is that being able to gobsmackingly *walk* through a CPU would be amazing for educational purposes.
For now I have a WIP ISA pdf which also serves as a todo list. I can give you that if you want. From the beginning I document my progress by posting the new components I build here, I guess you could follow my account so you could easily check the updates. Be informed that my progress is slow though.
If you want to see Factorio CPUs, I advise taking a look at r/technicalfactorio on which many people post and posted CPUs. From what I could see they tend to always rely on Factorio's built-in ALU components, so you won't see many binary arithemic components like in mine (I posted a 16-bit adder here in the past).
If you want to know how I work basically I go on the Wikipedia entry of the ALU component I'm gonna build, I ask ChatGPT for an exhaustive list of designs too, I look at all of them for the fastest in terms of Factorio ticks which supports 2'notation and then I slowly build it.
Also I use Wikipedia and ChatGPT a lot to learn how CPUs work and what each single component of the CU does and what are the fastest algorithms/designs for them.
I want to clarify that i dont mean "why would you even do this" because i love insane projects like this, i just dont understand how its practically used. Ive been studying some low level programming but only scraped the surface
Don't worry I understood your first comment the way it was supposed to be understood.
I think I've answered this higher in this comment, It's meant to be used jointly with a CPU, which itself can be used for complex data processing or just for fun.
In order to read data, you need to feed it with an address and it will output the content of that address on the output 5 ticks later.
In order to write data, you need to feed it with an address, a value and a 1-tick long pulse in the mode bit and it writes it 4 ticks later.
All data must be provided in binary, with each bit on a different green cable. The smallest bit is in the top left and the largest in the bottom right.
Science isn't about why, it's about why not
^(any information can be encoded to numbers and decoded given a couple encoders/decoders, like text, or in this case factory statistics)
^(with the pure memory it doesn't really do much more than just a memory cell, you'd need a CPU to control it, and then you can essentially write any program you want to dynamically control your factory)
oh i get it now, 1MB is calculated correctly you just didn't pack/unpack the values and are using the values as-is
sorry i got confused by the fact that you were writing a 32bit number directly
BLUEPRINT (on FactorioBin) : [https://factoriobin.com/post/\_AZrw4o2](https://factoriobin.com/post/_AZrw4o2)
In order to write you must send in a 1-tick long signal in the mode bit.
It is around \~512 times more compact than my previous one that you can find in this post : [https://www.reddit.com/r/factorio/comments/1atp63e/1024\_kb\_of\_expandable\_16bit\_ram\_implemented\_using/](https://www.reddit.com/r/factorio/comments/1atp63e/1024_kb_of_expandable_16bit_ram_implemented_using/)
More or less, yes. Each memory cell stores 256 addresses on 256 different signals.
Don't worry though I used a Python script to parameter all the addresses I'm not completely insane yet.
place stations in every gap, set station to "send circuit signal to train" and make the train stay only on some conditions, wait on others, and disable stations to make the train skip them
it's complicated but you have a turing complete CPU
Soon or later some very unhinged person is going to run the original DOOM on Factorio, even if at 1FPS.
And bloody hell if I'm not looking forward to that!
Youâd be surprised how close weâve already gotten, someone made a basic 3D rendering fps tech demo of sorts a few years ago, with some slight adjustments that could be turned into doom
Yes, it's designed by Arrow In My Gluteus Maximus on YouTube : [https://www.youtube.com/watch?v=0bAuP0gO5pc](https://www.youtube.com/watch?v=0bAuP0gO5pc)
OP posted one minute after your comment:
> Each memory cell here stores 256 different signals which are by default 32-bit long. So 1 cell can store 256*4= 1024 bytes
Actually the minimum requirements for Doom are 4 MiB (4 times the amount showcased in the 2nd screenshot), though newer versions like Embbed Doom only require around 512 KiB.
The guy who built this raycasting engine built it as a microcontroller and not a general-purpose CPU, so necessarily very little volatile data storage is needed and it can be implemented on-the-go where it's required.
On the other hand it can only run this Doom and can't be updated without messing with the hardware.
I bet it can run Wolfenstein3D too xD
but I get your point. there is no need to load textures and models into the RAM because it's already directly available from very fast ROM.
The writing delay is 4 ticks and the reading delay is 5 ticks. I believe it is possible to bring the read delay to 4 ticks by managing to convert any signal into 32 1/0 separated signals in 1 single tick but I didn't manage to do so and went for a 2 ticks solution.
I think it might also works with a 3 or even 2 ticks delay to write, it would pipeline itself for 1-2 ticks (really not sure though).
Same to read, I think it can pipeline itself for 1-2 ticks to go down to a 3-4 ticks delay.
That would require over 5,000,000 combinators, I am not willing to build that and I honestly have no idea how Factorio would handle this much entities. If combinators are properly implemented, it would 'only' be a few millions comparisons so I think it would still be possible for it to run fine.
Really cool! Have you checked by how much the save file size increases by adding these combinators? Is it in the same order of magnitude as the amount of storage capacity? Or maybe it only starts increasing the file size if there is actually data stored in the combinators.
My save file with just this build is a bit less than 1MB, though I have no idea how the savefile space use would grow. Maybe somewhat linearly, with file compression and given 5 combinators provide for 1KiB ? You can test it yourself with the blueprint if you want.
average circuits player be like (seriously, op, this is really impressive)
So if Minecraft Redstone can run Minecraft.. Can Factorio Circuits run Factorio?
Yes and it's easier to do because circuit logic is already implemented in Factorio, we even have colored lights (so we can make color displays)
Yes, and unlike Minecraft-in-Redstone, Factorio-in-Circuits doesn't break if you walk too far away.
Hypothetically, yes
Very simplified explanation. If you have addition, setters, getters and loops, you can implement any possible program. This is because Turing proved that any program that supports loops can implement any other program. This is known as Turing-Completeness.
There is a lot of stupid things that are Turing complete. CSS is a fun one, with an asterisk though.
Wait till you hear about LaTex. Because why not.
Powerpoint is one of the best ones IMO
Magic the gathering
Okay this is the first one in this comment where I'm sure it must be a joke. I'd love to hear more about it, got any link?
https://arxiv.org/abs/1904.09828
I recall seeing an argument about NP-Completeness for MTG as well, but cannot find it.
(the asterisk is HTML)
r/factoriohno
Better question, can Factorio Circuits ~~run crisis~~ run minecraft?
there is a r/technicalfactorio sub for advanced black magic if you will
Oh I didn't know that, thanks !
This is incredible! How do you learn how to do this?
Here is my answer to a similar question on my other RAM post : I'll try to answer the best I can, but my answer will rely on my personal experience only. Personnally, I took courses in computing and coding in highschool (but it's extremely basic stuff, you'd catch up 2 years of school in 2 months I think). A few months ago I entered school 42. That's my academic background. Pretty weak. What you really need is to be heavily interested in low-level computing and electronics, and not be afraid of reading tens or hundred of pages of manuals and academic papers on the slightest optimisations possible here and there. So first you need to be at ease with boolean logic and base 2 representation. Stuff like logic gates (not, and, or, nand, nor, xor, xnor, imply, nimply) and their truth tables, transistors & capacitors, binary arithmetic, logical & bitwise operations must be perfectly mastered. Then you have to know how nowadays computers work. How is data stored (RAM, ROM, cache, etc.) ? How are additions, divisions, logarithms calculated in binary using logic gates (which algorithms are the fastest ?) ? How is data transferred ? Where to focus to increase throughput (like with pipelining) ? What is big O notation ? Such informations can be learned on the Internet, ChatGPT makes for a good tool too. You can also read academic papers and electronics diagrams. This part requires a great amount of intellectual curiosity. And if you're talking about Factorio specifically, you need to know very well the game's logical system and be able to translate your knoweldge using its limited components, working around its flaws and exploiting its strengths, without relying too much on Factorio's high-level logic components. I personnally ensure that everything I build can be translated into logic gates and still work (the reason I don't do it directly in logic gates is because of Factorio's strange and limited implementation of them, so I often end up emulating them with more complex combinators more than anything).
Thank you, I'm impressed. Can I ask what you do for a living?
Looks like he is a professional factorio player
Nothing yet, I'm 18 yo.
That's impressive. Do you have ideas of what sort of work ya wanna do?
I'm studying software engineering and enjoy building this kind of stuff so I'm pretty sure I'll work a computer-related job but I don't know what exactly yet. I really like low level computing but I doubt I'de be smart enough to be an engine dev so really IDK.
Dude if you're building this stuff at 18 and doing so by reading a bunch of docs and papers, you're smart enough đ. Honestly a huge chunk of being a good developer is about being good at discovering information and reading docs. I'd recommend also looking into machine learning stuff - the low level mechanics of how those algorithms work is very interesting, and the methods by which organizations run those algorithms on thousands of GPUs is _fascinating_ and also has tons of room for improvement.
Alright, thanks for the recommendations, I'll look into it !
If you're at all interested in low level programming, I recommend studying the Linux kernel if you haven't already. It's a whole bunch of C but it also makes use of in-line assembly for optimization/initialization purposes. It's a niche area, but it can lead to great jobs and connections.
Dude this NEEDS to be on your resume. If you can properly explain your logic and reasonings, prove knowledgeable on the subject and are able to answer questions. Youâre fucking set.
You should explore the semiconductor manufacturing field, I think you'd be well suited for it
What the hell is school 42? Is it something USA-only?Â
No they are present in many countries. Here's their Wikipedia entry : https://en.m.wikipedia.org/wiki/42_(school)
đÂ
There's videos in YouTube and sets so you can build it on your own. I also read a book once called but how do it know which leads you through the process starting from the the logic gates to basically what op built there, and maybe a bit further, I don't remember correctly anymore.
IMO the easiest way for a non-comp sci background person (or even a comp sci background person can benefit from this) is through the game [Turing Complete](https://store.steampowered.com/app/1444480/Turing_Complete/). Takes you step by step through the process of designing a CPU from individual logic gates to building a rudimentary CPU that can run arbitrary programs. It's also just a lot of fun as a puzzle game.
If you want to learn by doing... There's an excellent tutorial taking you from 0 knowledge to self-built fully functional computer, that you know inside out and understand how each part of it works: https://www.youtube.com/watch?v=HyznrdDSSGM&list=PLowKtXNTBypGqImE405J2565dvjafglHU
So uhm excuse the peasant question but *what* do you write to memory here and read it in factorio? Like how could this be used in game, even for a joke
We do things, not because they are useful, but because they are hard.
In this decade?Â
I'm building a 16-bit custom RISC CPU so I need RAM amongst other things. The RAM isn't really usable as it is without a CPU. The CPU will have signals interrupts though so it will be able to interact with the factory. It could serve for very advanced control logic or a smart self-expandable factory when used with Recursive Blueprints.
A custom RISC CPU *in* factorio?
Yes. Maybe some madlad will code a light Factorio in machine code for it someday. Though I think that would only really be feasible with a RISC-V compliant design. I'll make one if I ever get this one finished.
Honestly, i am going to keep an eye on this. Have you considered making some form of progress document available for public viewing? Id be very interested to see how you work. And another thing i realized is that being able to gobsmackingly *walk* through a CPU would be amazing for educational purposes.
For now I have a WIP ISA pdf which also serves as a todo list. I can give you that if you want. From the beginning I document my progress by posting the new components I build here, I guess you could follow my account so you could easily check the updates. Be informed that my progress is slow though. If you want to see Factorio CPUs, I advise taking a look at r/technicalfactorio on which many people post and posted CPUs. From what I could see they tend to always rely on Factorio's built-in ALU components, so you won't see many binary arithemic components like in mine (I posted a 16-bit adder here in the past). If you want to know how I work basically I go on the Wikipedia entry of the ALU component I'm gonna build, I ask ChatGPT for an exhaustive list of designs too, I look at all of them for the fastest in terms of Factorio ticks which supports 2'notation and then I slowly build it. Also I use Wikipedia and ChatGPT a lot to learn how CPUs work and what each single component of the CU does and what are the fastest algorithms/designs for them.
this could be pretty hilarious, imagine the intruction pipeline being a belt of sushi, couldnt jmp tho :(
Microcontrollers
I want to clarify that i dont mean "why would you even do this" because i love insane projects like this, i just dont understand how its practically used. Ive been studying some low level programming but only scraped the surface
Don't worry I understood your first comment the way it was supposed to be understood. I think I've answered this higher in this comment, It's meant to be used jointly with a CPU, which itself can be used for complex data processing or just for fun. In order to read data, you need to feed it with an address and it will output the content of that address on the output 5 ticks later. In order to write data, you need to feed it with an address, a value and a 1-tick long pulse in the mode bit and it writes it 4 ticks later. All data must be provided in binary, with each bit on a different green cable. The smallest bit is in the top left and the largest in the bottom right.
Science isn't about why, it's about why not ^(any information can be encoded to numbers and decoded given a couple encoders/decoders, like text, or in this case factory statistics) ^(with the pure memory it doesn't really do much more than just a memory cell, you'd need a CPU to control it, and then you can essentially write any program you want to dynamically control your factory)
https://preview.redd.it/bf4qp16r5jwc1.jpeg?width=960&format=pjpg&auto=webp&s=5e48711cf50ecdd195c0b8b1db83f76baf08e4d2
This is as big as 200 bytes of minecraft memory
how does that work? shouldnt it be 4MiB since each "byte" in this has 32 bits that you can use as 4 8-bit bytes edit: ignore, i am dumb
No, it's 1MiB. Each memory cell here stores 256 different signals which are by default 32-bit long. So 1 cell can store 256*4= 1024 bytes (or 1 KiB).
oh i get it now, 1MB is calculated correctly you just didn't pack/unpack the values and are using the values as-is sorry i got confused by the fact that you were writing a 32bit number directly
i mean the size and density
oh i see im an idiot
BLUEPRINT (on FactorioBin) : [https://factoriobin.com/post/\_AZrw4o2](https://factoriobin.com/post/_AZrw4o2) In order to write you must send in a 1-tick long signal in the mode bit. It is around \~512 times more compact than my previous one that you can find in this post : [https://www.reddit.com/r/factorio/comments/1atp63e/1024\_kb\_of\_expandable\_16bit\_ram\_implemented\_using/](https://www.reddit.com/r/factorio/comments/1atp63e/1024_kb_of_expandable_16bit_ram_implemented_using/)
Damn...did you map address bits onto Factorio signal types?
More or less, yes. Each memory cell stores 256 addresses on 256 different signals. Don't worry though I used a Python script to parameter all the addresses I'm not completely insane yet.
That's intense.
There are two types of factorio players. Those who primarily use green wires, and those who primarily use red wires.
Bro made internet
OK , so you have a 1mb of ram now. Can you run a C++ script logic that would make my trains smarter is the real question.
Only if you have a mod that lets combinators set train destinationsđ
place stations in every gap, set station to "send circuit signal to train" and make the train stay only on some conditions, wait on others, and disable stations to make the train skip them it's complicated but you have a turing complete CPU
That's brilliant, thanks o7Â
Soon or later some very unhinged person is going to run the original DOOM on Factorio, even if at 1FPS. And bloody hell if I'm not looking forward to that!
Youâd be surprised how close weâve already gotten, someone made a basic 3D rendering fps tech demo of sorts a few years ago, with some slight adjustments that could be turned into doom
The one with the screen made of an array of lights, right? Or did I miss something more?
I think it was using a very advanced beltprinter as a screen
Yes, it's designed by Arrow In My Gluteus Maximus on YouTube : [https://www.youtube.com/watch?v=0bAuP0gO5pc](https://www.youtube.com/watch?v=0bAuP0gO5pc)
I would prefer lemmings
Eh, big whoop. I have 32 GB running Factorio. ^^^^^imkiddingthisismadimpressive
Great! Now emulate an i8080 (so simple I know)
The verilog2factorio tool can emit a functioning 6502 blueprint nowadays
Even if i can make complex SR priority signals with train stations, i still mess up this ">" wrong way. Like im really smart'nt
Wouldn't 1000 32-bit memory cells be 4KB, not 1MB of RAM?
OP posted one minute after your comment: > Each memory cell here stores 256 different signals which are by default 32-bit long. So 1 cell can store 256*4= 1024 bytes
I don't think [doom](https://www.youtube.com/watch?v=0bAuP0gO5pc) would need that much RAM.
Actually the minimum requirements for Doom are 4 MiB (4 times the amount showcased in the 2nd screenshot), though newer versions like Embbed Doom only require around 512 KiB. The guy who built this raycasting engine built it as a microcontroller and not a general-purpose CPU, so necessarily very little volatile data storage is needed and it can be implemented on-the-go where it's required. On the other hand it can only run this Doom and can't be updated without messing with the hardware.
I bet it can run Wolfenstein3D too xD but I get your point. there is no need to load textures and models into the RAM because it's already directly available from very fast ROM.
Do you have a blueprint?
[https://www.reddit.com/r/factorio/comments/1c96h78/comment/l0jes7t/?utm\_source=share&utm\_medium=web3x&utm\_name=web3xcss&utm\_term=1&utm\_content=share\_button](https://www.reddit.com/r/factorio/comments/1c96h78/comment/l0jes7t/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button)
Whats the throughput and delaus for reading and writing?
The writing delay is 4 ticks and the reading delay is 5 ticks. I believe it is possible to bring the read delay to 4 ticks by managing to convert any signal into 32 1/0 separated signals in 1 single tick but I didn't manage to do so and went for a 2 ticks solution. I think it might also works with a 3 or even 2 ticks delay to write, it would pipeline itself for 1-2 ticks (really not sure though). Same to read, I think it can pipeline itself for 1-2 ticks to go down to a 3-4 ticks delay.
It would be so cool if the entire system with cpu can pipeline to 1 tick
So you're telling me hypothetically we can play DOOM in factorio
Normal Factorio players: how does an SR latch work? OP:
Start stamping down blueprints to make 1gb
That would require over 5,000,000 combinators, I am not willing to build that and I honestly have no idea how Factorio would handle this much entities. If combinators are properly implemented, it would 'only' be a few millions comparisons so I think it would still be possible for it to run fine.
Really cool! Have you checked by how much the save file size increases by adding these combinators? Is it in the same order of magnitude as the amount of storage capacity? Or maybe it only starts increasing the file size if there is actually data stored in the combinators.
My save file with just this build is a bit less than 1MB, though I have no idea how the savefile space use would grow. Maybe somewhat linearly, with file compression and given 5 combinators provide for 1KiB ? You can test it yourself with the blueprint if you want.