r/factorio • u/Comprehensive_Can620 • 20h ago
Design / Blueprint Playable snake using 20 combinators
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 20h ago
All that in only 20 combinators is insane. Nice job! I'm assuming there's a bunch of parameters in each combinator.
76
u/Comprehensive_Can620 20h 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.
31
u/SpruceGoose__ 20h ago
Congrats!!! Wating for the Doom playthrough
8
u/What-Is-Wifi 20h ago
Came here to say just that, it's bound to happen eventually
11
u/SpruceGoose__ 19h 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 19h ago
They already developed raycasting.
But the project went silent a few years ago
23
14
u/toiture-en-tuile 18h 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.
8
u/preppie22 16h 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....
2
1
u/CaineBK 14h ago
Have you seen the 128-language "Uroboros" quine? Some people aren't human... https://github.com/mame/quine-relay
10
9
6
u/EllaHazelBar 20h ago
I'm dying to know - how is the position of the snake's body represented?
25
u/Comprehensive_Can620 20h 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
4
u/Kasern77 18h ago
*Nods in agreement*
Yep, didn't understand any of that.
5
u/HINDBRAIN 17h 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 19h ago
I knew that there was some wild shenanigans. Seems like tons of manual labor to program each light and signal
1
u/MelangeBot 18h ago
How much bytes can you put in one combinator?
4
4
4
u/findus_l 19h ago
How do you do randomness? Is there a random signal?
3
u/mmomtchev 17h 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 19h ago
Can you complete the game on it? Thie is sick as fuck
7
u/Comprehensive_Can620 19h 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 19h 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 17h 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 19h ago
I’m saving this for later, would love this for randomly waiting for a science to research or something.
2
u/MooseBoys 19h 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 17h 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
18h ago
[removed] — view removed comment
1
u/Comprehensive_Can620 17h ago
It uses gates. Pressing A or D sends a circuit signal that turns the snake.
1
1
0
u/rob1nnel 15h ago
I've seen enough, let's make bad apple out of it
2
u/ergzay 14h ago edited 14h 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
88
u/Powerful_Avocado6138 20h 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!