You are not logged in.

#1 2010-01-26 05:10:37

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Petris: Tetris clone written in Python

I was recently trolling around for a decent, configurable Tetris clone and found none. This vexed me to no end. Long story short, I grew a pair and wrote my own.

The 'P' in 'Petris' stands for either 'Python' or 'Peasantoid', depending on how narcissistic you think I am. The game is more or less finished at this point. Criticisms are welcome.

Configuration is done in ~/.config/petris/rc.py. See /usr/lib/petris/rc.py for reference; I tried to choose sensible defaults.

AUR package: http://aur.archlinux.org/packages.php?ID=33965
git: http://peasantoid.org/git/petris

Some screenshots:
(the statusbar font is 14px Inconsolata)

shot1.png shot2.png

Last edited by Peasantoid (2011-05-10 20:18:31)

Offline

#2 2010-01-26 06:03:52

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Petris: Tetris clone written in Python

Please change the dependency "pygame" to "python-pygame".

The pause feature is great. The colors are beautiful. I like the "simple" design. The gameplay is solid.

My suggestions:

Do not "auto rotate" when you hold the up key. Nobody holds down the "rotate" key to continue rotating a piece. tongue (I think) yikes

When holding the "down" key, and after the current piece hits the floor, do not allow the next piece to start falling quickly until the you let go of the "down" key and press it again.

I found the speed to increase rather quickly. I started feeling rushed after about 10 lines cleared.

Consider adding a slight pause or "flash" when clearing any lines.

Very nice! A worthy contribution. smile

Offline

#3 2010-01-26 06:17:14

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: Petris: Tetris clone written in Python

drcouzelis wrote:

Do not "auto rotate" when you hold the up key.
...
When holding the "down" key, and after the current piece hits the floor, do not allow the next piece to start falling quickly until the you let go of the "down" key and press it again.

These suggestions would make the game easier, but they don't really go in line with the tetris flavors I remember and kind of cheapen the game.  Frankly, I don't like the pause feature either.. or at least the screen should be blanked while paused.

Offline

#4 2010-01-26 06:29:37

wesley_of_course
Member
Registered: 2007-09-13
Posts: 110

Re: Petris: Tetris clone written in Python

Pretty sharp - graphics  , I like .  And Thanks !

[wesley@ratdog ~]$ petris
NOTE: /home/wesley/.config/petris/rc.py does not exist. default config /usr/share/petris/rc.py will be used.

What didn't or do I need to do in this case ?

Offline

#5 2010-01-26 06:30:51

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: Petris: Tetris clone written in Python

drcouzelis wrote:

Please change the dependency "pygame" to "python-pygame".

D'oh! Will do.

drcouzelis wrote:

The pause feature is great. The colors are beautiful. I like the "simple" design. The gameplay is solid.

Merci bien. big_smile

drcouzelis wrote:

When holding the "down" key, and after the current piece hits the floor, do not allow the next piece to start falling quickly until the you let go of the "down" key and press it again.

Could be implemented, I suppose, though I don't really see the utility. Is this a problem for anyone else?

drcouzelis wrote:

Do not "auto rotate" when you hold the up key. Nobody holds down the "rotate" key to continue rotating a piece. tongue (I think) yikes

I found the speed to increase rather quickly. I started feeling rushed after about 10 lines cleared.

Both of these are configurable. (see /usr/share/petris/rc.py: variables 'keys', 'move_interval', and 'move_interval_decrease')
I'll change the defaults if anyone else finds this is a problem.

drcouzelis wrote:

Consider adding a slight pause or "flash" when clearing any lines.

This falls under the banner of eye candy. As a rule, I tend to avoid that sort of thing... though you're welcome to create a patch. smile

wesley_of_course wrote:
[wesley@ratdog ~]$ petris
NOTE: /home/wesley/.config/petris/rc.py does not exist. default config /usr/share/petris/rc.py will be used.

What didn't or do I need to do in this case ?

Ahh, I should've made the message more informative. It's implying you should create ~/.config/petris/rc.py so as to customize the game. To just get rid of the notice, you can use the following snippet:

from rc_default import *

and that will disable the warning whilst retaining the defaults.

tdy wrote:

Frankly, I don't like the pause feature either.. or at least the screen should be blanked while paused.

I'll create a config option to blank the screen. [update: It's been pushed to the git repo.]

Last edited by Peasantoid (2010-01-26 13:44:11)

Offline

#6 2010-01-26 13:22:26

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Petris: Tetris clone written in Python

I changed the key settings in my "rc.py" file. Now it's just how I like it. Thank you for making a well documented configuration file. Also, I just noticed the "Next" piece display. That was a good idea.

As for "flashing when a line disappears", what I meant didn't have anything to do with eye candy. It has to do with game play. When the game is going fast enough, clearing a line would allow you to take a (small) break, check out the board, and check out what piece is coming next. It kind of acts as a reward. For reference, Ltris does not implement the flash, and Tetris for Game Boy does implement the flash. It changes the game play a bit. It's just something to consider.

I find your comment about not adding eye candy interesting because, to me, the guide lines around the falling pieces are eye candy. But please don't remove them! I like them. smile

I like that the game feels very Archish. It's like a conky version of Tetris. big_smile Maybe I will hack it so the colors of the pieces are shades of cyan.

Offline

#7 2010-01-26 13:46:54

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: Petris: Tetris clone written in Python

drcouzelis wrote:

I find your comment about not adding eye candy interesting because, to me, the guide lines around the falling pieces are eye candy.

Well, it's not intended as such -- just as a way of helping new players. It's sort of like the 'ghost piece' some clones have.

drcouzelis wrote:

Maybe I will hack it so the colors of the pieces are shades of cyan.

Good idea... but you don't need to hack it. It's all in the config. big_smile

Last edited by Peasantoid (2010-01-26 13:47:11)

Offline

#8 2010-01-26 21:27:49

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: Petris: Tetris clone written in Python

Update: I added hard-drop and an Arch theme.

shot3.arch-theme.png

You can load the theme with this line in rc.py:

from mod.arch_theme import *

You'll need to update. Also, I recommend re-downloading the AUR package, because I updated the PKGBUILD to run `git pull` if the repo has already been cloned.

Last edited by Peasantoid (2011-05-10 20:17:52)

Offline

#9 2010-01-26 22:52:18

linkmaster03
Member
Registered: 2008-12-27
Posts: 269

Re: Petris: Tetris clone written in Python

This is great! Coincidentally enough, I was looking a simple Tetris game a few weeks ago, and I couldn't find any that were simple, usable, and classic-looking. The only suggestion is to remove disregard key repeating on the piece rotation. No other Tetris game I've played does that, and it is annoying, especially considering I have a fast key repeat rate. tongue

Offline

#10 2010-01-26 23:45:07

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: Petris: Tetris clone written in Python

linkmaster03: Yeah, I was just about to disable rotate key repeat by default. By the way, though, your xorg key repeat rate would not influence SDL.

[update: change pushed to git repo]

Last edited by Peasantoid (2010-01-26 23:48:09)

Offline

#11 2010-01-27 00:24:27

Heller_Barde
Member
Registered: 2008-04-01
Posts: 245

Re: Petris: Tetris clone written in Python

neat little game, perfect for a little break from coding. I am the worst tetris player though hmm roll

Offline

#12 2010-01-27 03:01:27

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Petris: Tetris clone written in Python

The Arch theme is way hot! big_smile

I really appreciate just how configurable you made it. It is even so easy to create a jumbo 40x80 sized Tetris board. tongue

Just for your reference, I changed the setting "move_interval_decrease" to 0.0025. I find it more relaxing and it allows me to play a little longer before things get hectic.

I suppose the sad part is, not that it's pretty much done, what will you do next? How about an icon to replace the "python" and a ".desktop" file?

Offline

#13 2010-01-27 04:00:12

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: Petris: Tetris clone written in Python

drcouzelis wrote:

I suppose the sad part is, not that it's pretty much done, what will you do next? How about an icon to replace the "python" and a ".desktop" file?

Since I don't use a DE, I unfortunately have no experience with icons or .desktop files. If you do, I'd appreciate the help...? smile

drcouzelis wrote:

jumbo 40x80 sized Tetris board

whaaaat

Last edited by Peasantoid (2010-01-27 04:02:13)

Offline

#14 2010-01-27 04:23:03

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Petris: Tetris clone written in Python

Peasantoid wrote:
drcouzelis wrote:

I suppose the sad part is, not that it's pretty much done, what will you do next? How about an icon to replace the "python" and a ".desktop" file?

Since I don't use a DE, I unfortunately have no experience with icons or .desktop files. If you do, I'd appreciate the help...? smile

I'll go ahead and throw one together.

Peasantoid wrote:
drcouzelis wrote:

jumbo 40x80 sized Tetris board

whaaaat

Well, I think it's kinda cool. tongue
tM2Q2eA

Offline

#15 2010-01-27 04:25:47

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: Petris: Tetris clone written in Python

drcouzelis wrote:
Peasantoid wrote:
drcouzelis wrote:

jumbo 40x80 sized Tetris board

whaaaat

Well, I think it's kinda cool. tongue
http://omploader.org/tM2Q2eA

Seriously. That's bigger than my monitor.

Offline

#16 2010-01-27 05:06:58

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Petris: Tetris clone written in Python

Alright, I sent you a new icon and desktop file.

I also put my playing area back to the standard size. tongue

Offline

#17 2010-01-27 05:35:56

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: Petris: Tetris clone written in Python

drcouzelis wrote:

Alright, I sent you a new icon and desktop file.

I like it. I'll be including that in the codebase in short order. You also get the honor of being the only contributor. big_smile

[update: changes are now in place]

Last edited by Peasantoid (2010-01-27 05:41:02)

Offline

Board footer

Powered by FluxBB