repak shawahb
people who speak in metaphors can shampoo my crotch

^

   

rsw@jfet.org


blogroll

       
Sat, 19 Sep 2009

now with squid bits!

Your brain cannot repel entertainment of this magnitude!

TriHs r465 adds a major feature: two player mode!

True to my word, I've added in the "asshole button" for each player: swap your opponent's next piece for a random one. I don't know yet whether it's a useful addition or not, but at the very least simple strategies like denying them the I or giving them a neverending stream of S and Z are probably annoying enough to get you punched in the face.

I've also added shadow mode, even though I think it's totally cheese. By default it's off, but you can activate it with <Ctrl>-s.

The other somewhat major change I made was breaking the drawing module out of Main. This is a logical partitioning of functionality, and probably makes it a bit easier to swap out Cairo for, e.g., OpenGL. Not that I have any plans to do this, but perhaps someone else will be adventurous. (Hippo, I'm looking in your direction.)

Update: r466 corrects the previous loss condition to bring it in line with the official rules.


[ permalink | 0 comments (add one you lazy bastard!) ]

writebacks (add one you lazy bastard!)

Tue, 15 Sep 2009

damnit Jim

Because Jim is such a nitpicking bastard, and after reading the Wikipedia page, I have an update for you. (Seriously, thanks for the feedback, Jim.)

r460 has the following changes:

  • CW and CCW keybindings (that you might hate, depending on your keyboard; just fix it if you don't like mine)
  • Instant (hard) drop
  • Hard drop on the final "down" press (or just wait for the soft drop as before)
  • Updated scoring system so that it rewards multiples a bit more
  • Changed the color scheme to match The New Tetris.
  • a README file!

As I add minor updates, I'll just post them here. (Major ones will go in their own entry.) Here's a summary of every version I've posted so far:

  • r457 - first release
  • r458 - added Makefile
  • r460 - fix detailed above
  • r461 - fixed an erroneous return value from the keyboard handler that was really harmless
  • r462 - took focus off the Quit button so that space bar doesn't cause the program to exit
  • r465 - see 2009091901
  • r466 - fixed loss condition to bring it in line with the official rules


[ permalink | 2 comments ]

writebacks

jim wrote


Nice, a lot better (once the key bindings are fixed.. I used z/x to rotate, and up to hard drop)
Hitting space kills the program instantly (probably shouldn't leave focus on the Quit button)

rsw wrote


Oops, didn't notice that. I'll try to get to it tonight.

Mon, 14 Sep 2009

the (not) long awaited...

...is here! You'll need Graphics.UI.Gtk (a.k.a. Gtk2Hs), Graphics.Rendering.Cairo (also part of Gtk2Hs, but sometimes distributed separately), and Control.Concurrent (I use an MVar for game state in case I want to do something crazy later).

For now, this is just a normal tetris game. Ctrl-R restarts, Ctrl-Q (or Alt-Q, or the Quit button) quits.

Enjoy.


[ permalink | 5 comments ]

writebacks

jim wrote


no makefile?
how do you rotate left vs right?
no instant drop?
the long delay between pieces when you hold the down arrow is strange.
your rotation system is weird and you're missing wall kicks etc. see http://tetris.wikia.com/wiki/Tetris_Guideline

rsw wrote


Check again. Forgot to add it 'cause I'm dumb.

All the things you mentioned will be added.

Also, I'm not really a fan of wall kicks, but I'll have a look at the guideline. It's pretty simple to add them.

rsw wrote

actually...
Wall kicks aren't required as far as I can tell.

What specifically do you not like about my rotations? I try to keep the "center of gravity" fixed for the pieces, and I specifically adjusted the rotations work that way. What is it you don't like?

Instant drop and shadows are coming.

I didn't bind keys for both rotations, but it's trivial to add. I only made "up" CCW because Katherine said she preferred that (see? user feedback). Now I see that "up" should be instant drop, so I suppose I'll go to "," and "." for CCW and CW or something like that.

The delay comes because pieces only "lock in" during interrupts. This is laziness on my part, and I might decide to keep this one a "yes it's broken but I just don't care."

jim wrote


Wall kicks: sure but they're nice. If I push a button to rotate a piece, I clearly want it to rotate, so it shouldn't just do nothing just because the piece is near a wall.

Rotations: yours are unusual. especially the long piece, which doesn't go around the center at all. plus they're just different from any other tetris variant I've played, it feels weird.

"lock in" during interrupts: it's terrible, the delay between drop and lock isn't even constant because it depends on when you dropped the piece. "it's too hard to fix" is pretty lame...

rsw wrote


It's not hard to fix, actually. It just pollutes the relative purity of the division bewteen interrupt handler and keyboard handler. It's basically one line to fix it (and I mean _change_ one line, not add).

Anyway, instant drop kind of implies instant lock-in, so you'd figure I have to implement this eventually anyway.

Regarding the rotations: I looked at the SRS ("Super Rotation System," standard on new Tetris games), and the thing I don't like about it is that the rotations don't preserve the lower boundary of the piece. Rotations that allow you to move the piece vertically introduce twists, which I think are pretty much cheating.

Most implementations of wall kicks make twisting even easier.

I don't wanna sound like an Egyptian or nothin'

...but I really like libcairo. Over the weekend I wrote a Tetris-like game using cairo via Haskell's Gtk2Hs bindings.

I have one more obvious bug to fix before I release the source, so I'll probably post tonight once it's fixed. After that, I'm going to implement a bastard function, then scale it out to two players and allow each player to choose the other's next piece if they want.

Obviously we'll need a computer opponent mode as well...

(If you're wondering, I'm hovering around 300 lines of code, but that's a bit on the high side because I went for readability over smallest LoC, and I basically wrote a library of game state transforms and collision predicates and didn't use all of them.)


[ permalink | 0 comments (add one you lazy bastard!) ]

writebacks (add one you lazy bastard!)




post a comment:

Save name/email/&c
Name:
URL/Email: [http://... or mailto:you@wherever] (optional)
Title: (optional)
Comments:
Key:
(Required)