Jetris - A shameless Tetris clone. [Update]

For this game, I simply pretended that someone had requested I create Tetris so that it ran using only standard Java with zero external libraries(for better or worse). Until the very end, I relied on my existing knowledge from prior games without looking up solutions elsewhere. It really helped me identify which areas I need to improve on the most.

The area it turned out I needed vast improvement was sound programming. Ended up scouring the web for various solutions for one-shot playing of *.wav sound files with minimal lag and decent stability.

I don’t believe this game is perfect in its current state by any means, there’s a few things I’d like to add. The only feature I know I will add is a high-score table instead of the current single high score being saved.

The scoring rules are very similar to the classic NES version of Tetris. More lines cleared at once yields more points than single line clearing. Forcing a piece down gives points based on the distance traveled.

The tetraminoes are randomized to a certain extent. Within seven pieces, they will not repeat. Once a set is cleared, a new one is created. Not sure how fair this is. A possibility is remembering the last 3 or 4 pieces and randomizing them based on that, to help create more variety.

Game speed starts slow, but becomes very difficult level 18+. I’m not a very skilled Tetris player so I don’t know if it’s possible to survive past level 20 with the way I’ve programmed Jetris. If there’s any expert players within the JGO community I’d love to hear your thoughts on this.

Controls:
W or UP - Rotate current piece clockwise.
E - Rotate current piece counter-clockwise.
A & D or LEFT & RIGHT - Move current piece horizontally.
S or DOWN - Force current piece down. If released before the piece lands, bonus points will not be rewarded.
ENTER - Start game, pause game, or begin new game after a game over.
ESCAPE - Return to main menu from pause screen.

All assets were produced by myself and my son Jack(He was attached to my side through most of this.)
Sounds were recorded with Audacity using household objects.
The simple graphics were made with GraphicsGale Free Edition.

[Update]
Download from DropBox here

Added counter-clockwise rotation. Pressing E will rotate it in that direction.
Improved difficulty curve.
Force Drop speed increased.

If you encounter a bug, experience excessive lag, the game crashes, or you have a suggestion, I’d be happy to hear from you.


Decided to share the source code for this project in case anyone wanted to pick it apart. Perhaps someone still learning can take something from it.
Keep in mind this isn’t perfect code by any means, it just does what I wanted it to do. There’s some stuff in there that I’m sure wasn’t the right way to go about it, just did it the only way I knew how.

Welp, here’s the source.
It’s an Eclipse project, so if I did it right, you “should” be able to just import it into your workspace.

I tried your game, it’s very well made! I didn’t have time to play it for very long, but I didn’t encounter any bugs and it ran smoothly. I really liked the particle effects when you clear a row - how did you do that? Randomly-placed squares with a random velocity? Anyways, the game felt very clean and ‘simple’. Nothing was over the top - and that’s a good thing. I find it pleasing when a game has simple graphics and a simple interface. Makes me feel like I’m playing an old gameboy game. :smiley:

I’m glad you liked it!

As for the particles, there’s 16 * 16 per block. Each one is given the color from the location it’s spawned. Each gets a random negative float for its vertical velocity, and the horizontal velocity is a float obtained from the Math.sin() function with a random integer as the radian. Once they update, their vertical velocity is gradually increased to a positive. That’s all it really is. However each particle is 2 * 2 pixels instead of the single pixel from which it derives its color. I tried them as single pixels and it just didn’t have the same feel.

Ohh, interesting. I thought particles were more complicated, but thinking about it again they’re actually really simple. Thanks for sharing!

Great clone! I got to level 19, and you’re right, it does get hard very quickly, too quickly. A slower progression of the speed increase would be better imo. Background music would help add to the experience too. It would be nice to be able to rotate the pieces either direction as well. Good work :smiley:

Thanks for trying it out! I’ve been pondering a way to make the difficulty increase smoothly while I was in town with the wife and son, I think I know what to do now. I would like background music as well, and to create it myself. Having a hard time finding resources that I can grasp in that area. Making the sounds was enjoyable and I can only imagine music being just as satisfying, once I gain a basic understanding of it.

You got it, you’ll be able to rotate in either direction with the next build.

nice clone man! as said before i like the particles. does it go into invisibility mode once you reach level 100?

I’ve seen that from Tetris: TGM. I had no plans to implement it, but I’m not against it.

Will be posting the next build soon.

Counter-clockwise rotation has been added. Wasn’t as simple as I thought it would be, given how the method worked. That said, the rotation method has been improved a good bit because of it.

Vastly smoother difficulty increase. It should now be felt with every level completed, instead of suddenly getting bombarded at level 17+. From my playtesting and watching my wife play, the earlier levels have become slightly harder.

Force drop speed is much faster, need input on if it’s too quick, or if it’s something you can adapt to.

Thanks for playing the game and giving me feedback everyone!

EDIT: Bah, I lost the Game! I just had to look at your signature SirSoltex. xD Been several months since I thought about the Game.

Decided to share the source code for this project in case anyone wanted to pick it apart. Perhaps someone still learning can take something from it.
Keep in mind this isn’t perfect code by any means, it just does what I wanted it to do. There’s some stuff in there that I’m sure wasn’t the right way to go about it, just did it the only way I knew how.

Welp, here’s the source.
It’s an Eclipse project, so if I did it right, you “should” be able to just import it into your workspace.

Also added this to the topic post, that way anyone that wants to take a peek won’t have to scroll around.