Tetris

Wow. my first playable game.

took my time.

in all my newbieness i started another project quite a while ago. set my sights too high, and it’s still not finished. so here’s a message to anyone just starting out: Start simple, cause if it’s twice as complex a game no doubt it’ll be 20 times as hard to create.

This is a simple tetris game which didnt take much planning at all. All the graphics were done in fireworks, all the midi was ripped off found somewhere.

i know i’ll probably spend as much time playing this one as i did coding it :slight_smile:

Here’s a screenshot:

http://members.austarmetro.com.au/~juddman/images/JMTetrisPreview.gif

Controls are X for clockwise rotation and Z for counter-clockwise. down makes the piece fall quickly and up does a hard drop.

Download: http://members.austarmetro.com.au/~juddman/files2/JMTetris0.5.zip

Known issues:

-artefacts left outside the play area. I need to add a fillRect. now why didnt i do that?
-once a piece got stuck in the roof. no idea why. couldnt get it to happen again though.
-Excessive abundance of orange L pieces
-not very many yellow S pieces (all pieces chosen at random)

-gets hard quickly

-music tends to play the more annoying songs more often (or is that my imagination?)

-music sometimes plays the same song(s) over and over (though that’s random too, and 11 midis to choose from.)

it does WAY too much painting, but still performs well here. this is an early release, so i havent done any real optimization. I set it to target 50 fps and it gets average 48, but if it were set to 80 it’d get about 75 (on this computer)

anyone who has performance problems with the game please let me know what OS and hardware you’re running, and what you think might be causing it to be slow.

i dont think it’ll work too well on Windows 95/98. if anyone has either of these OS and could test it, please let me know how it goes.

i’ll be updating this a bit… need to add a points system (instead of just counting lines), maybe change the background color when advancing levels, a special effect for the line(s) being removed…

Edit: btw. you can put your own midis in the midi folder, or delete the midi folder if you dont like the music.

hmm

when you change display modes in windows it fails to draw the graphics. how do i make the bufferStrategy start working again?

Good job, very nice. Fix those minor issues and I’ll be back.

JMTetris 0.7

http://members.austarmetro.com.au/~juddman/files2/JMTetris0.7.zip

or if you dont want music or already downloaded this game:

http://members.austarmetro.com.au/~juddman/files2/JMTetris0.7.jar

i made a few optimisations to the drawing. it only updates the blocks and their background unless it’s determined that a refresh is needed (if you press escape and open the menu for example) and repaints the lot. got a very noticable performance increase from 18 fps on the old 450 to 45 fps, and on this 1 ghz dell laptop it went from using about 15% cpu down to 6 for just normal playing.

i was wondering why my other slower computer was stuttering and being very irregular when playing the midi files in JMTetris. i thought it was just slow, but i tried raising the framerate on this computer to the max (simulate high load) and the music was working fine.

tried running the midi on a separate thread. exactly the same. the diference turned out to be the plugin i was using. the old computer still had 1.4.1 running on it and after i installed 1.4.2, the midi worked fine, and the game got a small performance boost to boot.

out of curiosity i tried 1.4.0 and the midi was much worse there.

im happy to say though that on an old AMD K6 450 computer it runs perfectly well (48 fps is what my unreliable fps calc reports) on Windows 95, and on that same computer running XP, it uses 52% cpu but has only 32 fps average, which is only just noticable when you do a soft drop.

anyway, i’ve got a win95 installation now, so hopefully my games will be running just as well on '95, '98 and ME as they are on XP. this one certainly seems to.

fixed the artefacts, added a menu. a couple more midis. No major new features, mainly a touch-up and a bit of optimisation.

F2 starts a new game. apart from that none of the ‘menu’ options work yet. Sorry ppl who are used to using the up arrow to rotate the piece. definable controls are next on the to-do list.