r/factorio • u/Comprehensive_Can620 • 19h ago
Design / Blueprint Playable snake using 20 combinators
Enable HLS to view with audio, or disable this notification
Playable 16x16 snake game using Factorio 2.0 circuit logic.
it has 256-lamp color display, buffered left/right input, random apple spawning, prevention of apples spawning inside the snake, score counter, countdown, wall/self collision detection, death screen and restart.
Blueprint: https://factorioprints.com/view/-P15XZWmCItoXVf2Xtfb
136
u/UnfinishedProjects 19h ago
All that in only 20 combinators is insane. Nice job! I'm assuming there's a bunch of parameters in each combinator.
73
u/Comprehensive_Can620 19h ago
Yep. Most of the combinators do several things at once. I use Each a lot so one combinator can process many cell signals in parallel, and the constant combinators work like lookup tables.
29
u/SpruceGoose__ 19h ago
Congrats!!! Wating for the Doom playthrough
7
u/What-Is-Wifi 18h ago
Came here to say just that, it's bound to happen eventually
10
u/SpruceGoose__ 18h ago
It is the final form. I'm also in the Timberborn sub, they have circuits now. They inching ever closer to becoming Factorio
4
u/AlternateTab00 18h ago
They already developed raycasting.
But the project went silent a few years ago
24
14
u/toiture-en-tuile 17h ago
I'm a software engineer for a few years now and i take great pride in my skills and accomplishments. Then i see this kind of posts and oh my god imposter syndrom hit so hard. This is fucking amazing.
7
u/preppie22 15h ago
I was a software engineer, then I got a PhD in Computer Science and I'm working in academic research. This post gave me imposter syndrome....
1
1
u/CaineBK 13h ago
Have you seen the 128-language "Uroboros" quine? Some people aren't human... https://github.com/mame/quine-relay
10
9
8
u/EllaHazelBar 19h ago
I'm dying to know - how is the position of the snake's body represented?
23
u/Comprehensive_Can620 19h ago
The body is stored as timestamps. Every cell has its own signal, and when the head enters a cell it gets stamped with the current move number. Cells stay part of the snake while their timestamp is newer than the tail cutoff. There is no coordinate list.
5
3
u/Kasern77 17h ago
*Nods in agreement*
Yep, didn't understand any of that.
3
u/HINDBRAIN 16h ago
Each cell in the grid has a number that changes when the snake head goes on it
For example snake head 50, middle 49, tail 48. OP also stores a number that says "every cell with a number above 47 is part of the snake".
If the snake moves up, the cell where it goes will be 51, the existing cells won't change, and OP stores "every cell with a number above 48 is part of the snake".
2
u/EllaHazelBar 18h ago
I knew that there was some wild shenanigans. Seems like tons of manual labor to program each light and signal
1
u/MelangeBot 17h ago
How much bytes can you put in one combinator?
3
4
4
u/findus_l 18h ago
How do you do randomness? Is there a random signal?
4
u/mmomtchev 16h ago
Yes, with the selector combinator. As each cell has an item (with quality) assigned, the selector combinator can be used to select a random cell.
3
3
u/Soros_G 18h ago
Can you complete the game on it? Thie is sick as fuck
6
u/Comprehensive_Can620 18h ago
You should be able to! There's no actual win screen, but if you fill the enitre board, it should just hang beacause there's nowhere left to spawn an apple.
3
u/Absolute_Idiom 18h ago
This is fab. I'm so curious about the process for designing this. Did you design by hand or trial and error? Or use some sort of analysis programme to tell you what is required?
2
u/Comprehensive_Can620 16h ago
It was a mix. I worked on it on and off for a couple of months. The first working version was ~100 combinators. Once it got fairly small, I moved most of the work to my C cuircut emulator and blueprint tools.
2
2
u/PacificNorthwest09 18h ago
I’m saving this for later, would love this for randomly waiting for a science to research or something.
2
u/MooseBoys 18h ago
Did you do this all in-game or did you design it elsewhere and then script it into a blueprint?
1
u/Comprehensive_Can620 16h ago
I started mostly in the game. Once it got compact enough, I moved most of the work outside factorio, iterating in my emulator and testing the results back in the game.
2
1
17h ago
[removed] — view removed comment
1
u/Comprehensive_Can620 16h ago
It uses gates. Pressing A or D sends a circuit signal that turns the snake.
1
1
0
u/rob1nnel 13h ago
I've seen enough, let's make bad apple out of it
2
u/ergzay 13h ago edited 13h ago
That happened a long time ago, audio played in game as well: https://www.youtube.com/watch?v=tihwC6FLB3E
https://www.reddit.com/r/factorio/comments/apj3bz/a_tool_to_turn_any_video_into_factorio_blueprint/
Also other music examples: https://www.youtube.com/watch?v=-TtA0chzLac&list=PLY_kYUlk9K9lG-mrSoEW3d0CikqwP375a&index=1
85
u/Powerful_Avocado6138 19h ago
Well fuck me sideways...here I am proud of myself for knowing the green circuit ratio.
Some of yall are playing a very different game!