Tetris... in Factorio?

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Tetris... in Factorio?

Post by XKnight »

XKnight wrote: Unfortunately rotation was not implemented, because I am tired and this challenge a little bit boring.
But maybe I will come back to this task tomorrow :)
I decided to start working on the improved version, main goals:
- add rotation
- simplify collision check
- simplify L/R move
- reduce cycle length below 15 ticks at least
- increase interface responsiveness

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Tetris... in Factorio?

Post by kovarex »

XKnight wrote:
kovarex wrote:That looks cool. How do you store the game state?
1.png
Simple 2D array with 0/1 in each cell:

0 1 0 0 1 1
0 1 0 1 1 0
0 1 1 1 1 0
0 0 1 1 1 1
0 1 1 0 0 0

Each column can be represented as a single number:

0 1 0 0 1 1 | 16|
0 1 0 1 1 0 | _8|
0 1 1 1 1 0 | _4| => 0 29 7 14 30 18
0 0 1 1 1 1 | _2|
0 1 1 0 0 0 | _1|

Each number is stored as a unique signal
0 29 7 14 30 18 => "A" 0, "B" 29, "C" 7, "D" 14, "E" 30, "F" 18

As a result you can store 2D array with dimensions 180 x 32 inside one combinator.

Second combinator is used to store falling object.
Cool, that is the reason there are 30 rows I guess :) (2^31 is the limit of the cominator numbers).

I'm quite surprised, that the setup is not too big, making this using redstone would probably be a lot bigger.

Is the map accessible?

It would be good to have some kind of button + switch entities to play with these kind of things, I'm not sure if we have it in the roadmap for 0.13, but it would be really easy to do.

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Tetris... in Factorio?

Post by XKnight »

kovarex wrote: Is the map accessible?
Sorry, but I can not share the whole map, because it contains several other unique contraptions...
But you can find blueprint string for tetris here: http://factorioblueprints.com/view/hYvDtGfpLg8MjmYaS

You should put 1 green circuit into the "Interface chest" to move figure left, 1 red circuit - to move right.
To erase map you should rebuild "Map" combinator.

Just a small hint: you can place red/greed circuits on your quickbar (under the key "1" and "2"), and do not close chest window while playing.

flyco
Burner Inserter
Burner Inserter
Posts: 5
Joined: Wed Mar 16, 2016 11:56 am
Contact:

Re: Tetris... in Factorio?

Post by flyco »

Blimey. I am filled with speechless amazement.

Wow!

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Tetris... in Factorio?

Post by DaveMcW »

I am building a 7-color display, so I need 200 unique color signals. (Because colored lamps require a color signal.)

That means every lamp needs its own wire and decoder. Here is the board before it is wired up. This is going to be like my days in IT wiring a patch panel.
tetris1.jpg
tetris1.jpg (305.68 KiB) Viewed 28157 times
I am optimizing for speed, which means massively parallel circuit design. Each of the 200 lamps has its own memory cell. Each memory cell has 11 built-in functions with direct memory access.
tetris-memory.jpg
tetris-memory.jpg (393.17 KiB) Viewed 28157 times
I'm a bit worried this will drop Factorio below 60 FPS. :)

piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Re: Tetris... in Factorio?

Post by piriform »

Not sure if I've got this right
200 cells@ 65 tiles/ cell + ~500 for the display ~13500/1024 =13+ chunks = EPIC! :lol:

User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: Tetris... in Factorio?

Post by Dr. Walrus »

DaveMcW wrote:The main problem is getting player input, it is quite awkward without mods.
Kovarex wrote:It would be good to have some kind of button + switch entities to play with these kind of things, I'm not sure if we have it in the roadmap for 0.13, but it would be really easy to do.
XKnight wrote: You should put 1 green circuit into the "Interface chest" to move figure left, 1 red circuit - to move right.
To erase map you should rebuild "Map" combinator.
This sort of situation is the exact reason I made the pressure plates mod. Using three pressure plates to control the left, right, and rotate functions would be a lot easier than placing things into a chest. I would be super happy if my mod could help make such a great build possible.
Last edited by Dr. Walrus on Mon Mar 21, 2016 9:31 pm, edited 3 times in total.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Tetris... in Factorio?

Post by ssilk »

The bottom line for this week FFF is clear now. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Tetris... in Factorio?

Post by XKnight »

XKnight wrote:
XKnight wrote: Unfortunately rotation was not implemented, because I am tired and this challenge a little bit boring.
But maybe I will come back to this task tomorrow :)
I decided to start working on the improved version, main goals:
- add rotation
- simplify collision check
- simplify L/R move
- reduce cycle length below 15 ticks at least
- increase interface responsiveness
Finally I found some time to finish this Tetris...

- removed global clock generator. This is the most significant improvement, because using GCG always means dirty and slow solution, but this solution can be implemented very fast. As a result, new main cycle has variable length (6 or 7 ticks) and it is about 3 times faster than previous build (20 ticks). I even had to put 3 smart inserters more, because one smart insert is not capable to handle new speed.
- lots of things were simplified: previous build used 150 combinators, new one - 125.
- added possibility to rotate object.
- added possibility to perform several rotation/moves per one fall (by default 4 moves).
- added possibility to temporary increase falling speed (x5).

Known issues: slow filled line processing (due to incompatibility with new data representation); may be improved in future.
Also wall kicks (from original tetris) may be easily added, the only missed thing is an array with predefined offsets.
1.png
1.png (1.49 MiB) Viewed 27985 times
animation.gif
animation.gif (931.07 KiB) Viewed 27985 times
Details you can find here: http://factorioblueprints.com/view/abdtJi9NCcQAYyyw7
Last edited by XKnight on Thu Mar 24, 2016 8:20 pm, edited 1 time in total.

User avatar
Phribos
Inserter
Inserter
Posts: 30
Joined: Mon Mar 21, 2016 9:44 am
Contact:

Re: Tetris... in Factorio?

Post by Phribos »

Awesome! :shock:
"if speed one day kills me don't be sad because i was smiling"
Paul Walker

piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Re: Tetris... in Factorio?

Post by piriform »

Very nice work!
So what's next? Pacman or Space Invaders? :D

Fish
Inserter
Inserter
Posts: 26
Joined: Thu Mar 24, 2016 1:20 pm
Contact:

Re: Tetris... in Factorio?

Post by Fish »

Wow, nice job! :shock:

Koub
Global Moderator
Global Moderator
Posts: 7293
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Tetris... in Factorio?

Post by Koub »

piriform wrote:Very nice work!
So what's next? Pacman or Space Invaders? :D
Factorio :)
Koub - Please consider English is not my native language.

Koub
Global Moderator
Global Moderator
Posts: 7293
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Tetris... in Factorio?

Post by Koub »

[Koub] Topic moved to "Show your creations" upon a member's suggestion :). Surely this is a creation that deserves to be shown.
Koub - Please consider English is not my native language.

User avatar
Smarty
Global Moderator
Global Moderator
Posts: 816
Joined: Sat Oct 04, 2014 5:00 pm
Contact:

Re: Tetris... in Factorio?

Post by Smarty »

Koub wrote:
piriform wrote:Very nice work!
So what's next? Pacman or Space Invaders? :D
Factorio :)

Wait what? :shock:

factorio in factorio?

Koub
Global Moderator
Global Moderator
Posts: 7293
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Tetris... in Factorio?

Post by Koub »

I've seen game of life playing game of life. It's the most amazing thing I've ever seen, so much Inception-like :).
Admit it : Factorio playing Factorio would be totally mind blowing - even if I'm aware it can't be done ^^
Koub - Please consider English is not my native language.

User avatar
Evan_
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Sun Mar 13, 2016 9:24 am
Contact:

Re: Tetris... in Factorio?

Post by Evan_ »

Koub wrote:Factorio playing Factorio would be totally mind blowing - even if I'm aware it can't be done ^^
Strange, I can't do the opposite. I always play Factorio while playing Factorio. And it's totally mindblowing indeed.

Awesomesauce Tetries by the way.

vanatteveldt
Filter Inserter
Filter Inserter
Posts: 946
Joined: Wed Nov 25, 2015 11:44 am
Contact:

Re: Tetris... in Factorio?

Post by vanatteveldt »

piriform wrote:Very nice work!
So what's next? Pacman or Space Invaders? :D
For inspiration: https://www.youtube.com/watch?v=j2cMHwo3nAU

Armok Invaders, space invaders implemented within Dwarf Fortress. The perils of including a turing complete system within your game...

piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Re: Tetris... in Factorio?

Post by piriform »

The perils of including a turing complete system within your game
Perils, what perils? If that's the worst that can happen, then bring it on. I'm almost certain that the Laundry Files scenario is just fiction and could never happen in RL or Factorio..... I think :?


ps :)

zytukin
Fast Inserter
Fast Inserter
Posts: 215
Joined: Sat Mar 12, 2016 12:14 am
Contact:

Re: Tetris... in Factorio?

Post by zytukin »

need some way to play notes now so you can add the classic tetris music :D

Post Reply

Return to “Combinator Creations”