Any help to create a tetris like game

I tried for a while to make a Tetris like Game to train me.
I managed to get a few things, but I am having difficulties especially for collisions and procedural creation of the pieces.

I would like to know if anyone had any idea how to do it in the best way in unreal engine 4.

I do not request a tutorial, just a little guidance.

Thank you in advance.

Hi Elendil,

One of the first big test blueprints I made was a falling block game. I’ve received permission to release it, so I’ll dust it off and try posting it to GitHub or somewhere.

It might not be the best example of how to do things in UE4 now as it’s over 2 years old at this point, but it’s at least a step in the right direction.

Cheers,
Michael Noland

Cool !
i’m happy to hear that.
Let me know when it will be downlodable.

Thanks

Have you some ideas for me to move on?
I managed to make a Tetris but with only a cube which is not terrible.

I can not create the tetromino using the construction script. Or rather I can not have collision when I create these pieces using the construction script.
I do not understand why …

I created two blueprints. One for the board, the second is my pawn (tetrominoes).
The pawn controls its movements and collisions. The board creates two arrays, one with a counter to allow me to destroy object when you have a complete line.
At each collision a message is sent to the board to fill these tables.

I also had the idea of ​​using triggers rather than collisions. Each returning if something overlaps it or not. Maybe it would be better …

Thanks in advance …

Hi Elendil,

I actually didn’t use collision at all in Falling Block Game. It uses an array of currently occupied cells instead.

For example, when a piece falls:

  • It checks to see if a complete line has been formed (this happens first, not last, since you can slide a piece around during a small time window before it locks into place)
  • It removes the current shape of the piece from the array
  • It checks to see if it will collide with any cells after moving a line down
  • It then writes the update piece positions into the array

Moving left or right do a similar process:

  • Are there collisions if I moved in that direction? If so, done.
  • Otherwise erase the current piece, move it left, and write it back

Pressing down forces the piece move down timer to fire immediately

Pressing up pushes it down as far as it can go and immediately locks it in place

Cheers,
Michael Noland

Ok thanks for the tips. I’m going to try this way ;).

And i look forward to see your Falling Block Game, when it will be out…