JMTetris 2.3 - Webstart

JMTetris - A simple tetris game

Webstart and JAR download:
http://juddman.com.au/JMTetris/
Standalone JAR version works fully now.

Default keys:
Move: Left/right arrows.
Soft drop: Down
Hard drop: Up
Rotate: X and Z

Note: it will put a directory named .jmtetris in your home directory where it stores the music and your high scores.
For Windows, this is C:\Documents and Settings<name>.jmtetris
or for Vista, it’s probably Users<name>.jmtetris

I do not reccommend the soundbank download unless you’re using an old version of java (1.4.x). It fixed a major timing problem with midi on Java 1.4. For newer Java versions, It’s not necessary if you think the midi music sounds OK already. It shouldn’t do any harm though. to remove it if you did install and want to go back, look in your java install directory for lib/audio/soundbank-mid.gm

-JuddMan

It just crashes every time at the webstart splash screen !?! Um. This is 1.4.2_05; maybe 05 has damaged my webstart install…

[quote]If anyone knows a trick to get jnlp to work under a restricted web server (they won’t add a mime type), please let me know.
[/quote]
Try to upload a file called .htaccess with the following content: AddType application/x-java-jnlp-file jnlp
Or, if this doesn’t work, rename your jnlp-file to .php (or whatever your provider supports) and set the content-type to jnlp via

<?php 
      header("Content-type: application/x-java-jnlp-file");
?>

I dont get anything after the webstart splash screen. Nothing in the log either… odd!

Here is what I get when I try to run the Jar. Is this 1.5 or something?


java -jar JMTetris.jar

Exception in thread "main" java.lang.UnsupportedClassVersionError: JMTetris (Uns
upported major.minor version 49.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

Yes, it seems to be 1.5. At least it works on my 1.5 machine…

the php trick worked! thanks!

It’s now recompiled in 1.4. Sorry about that. it was a stupid mistake, especially since i even had the same problem myself as somewhere along the line i had set 1.5 to disabled in webstart.

If your webstart uses JRE 1.4, you’ll probably need the soundbank (it’s offerred by the game) otherwise the sound will be jumpy… the soundbank samples are nicer than windows midi anyway :slight_smile: and i have no idea what it’ll sound like on a mac or linux without the soundbank… anyone care to try?

http://www.adam.com.au/kellyjones/perm/JMTetris.php

-JuddMan

Edit: How do i specify where files should be downloaded to? in jnlp?
they are currently going to the location the jnlp (or JAR) was launched from, or if it was launched via a link, to the desktop

i now have a small web page for it:
http://www.adam.com.au/kellyjones/perm/

Works perfect on my linuxbox, very nice game and slightly addictive :slight_smile:
Personaly I would like the option to turn off the “shadow-block” that shows where the block will land, (I’m easily distracted :wink: )

// Gregof

That’s easy. i’ll get that option in next version.

I’ve been thinking of ditching the ingame menu in favor of a Swing JMenuBar… in fact, i’ve done it before on the JInput version of this game, and i really liked it. Any comments on this? it would reduce the JAR size a little too. (about 40k)

Also, if you get stuck in the key config dialog, be sure you’re not setting the same key to more than one action. it’ll keep looping till you change it.

by the way, if any mac or linux users out there could test it out with the midi but without the soundbank file and let me know how it sounds and what the JVM version you are using? as far as i have tested, 1.5 comes with the soundbank so there’s no need to download it*, but in 1.4 it sends the midi to the OS, and due to timing issues in that VM, does not sound good in Windows.

  • i’m not too sure on this anymore. i think it doesn’t

Then you absolutely MUST popup an error message saying so! Are we supposed to be psychic?

The problem is that there are keys I don’t want to use, and don’t want to assign, but you force me to anyway, so I’m just going to assign them to something random…

(linux) I got no sound at all until I downloaded both of the things the in-game dialogs offered me to, and restarted. Then I got a single bouncy background music, but when I tried to skip to the “next song” using ?f8? it just went silent.

Great!! I loved the ‘shadow’ in the bottom where the piece would be.

The alpha on the menu looks nice as well.

Is there any way of telling it which soundbank to use? I’ve got both the 5meg and smaller version installed. I believe java is supposed to grab the higest quality one by default, but wasn’t sure if you made an explicit check for it or not.

Regards,
Aaron R>

I run Linux with java 1.4.2_04 and the sound was ok for me, I think that I used midi and no soundbank, but if someone tells me how to “reset” webstart so it doesn’t remember those choices I can test it again. I tried to remove the .java directory in my home and webstart re-downloaded the jars, but I didnt get the sound questions this time, any ideas how to reset it?

// Gregof

“any ideas on how to reset it”

  • check your home directory. i think that’s where the files are downloaded to. (soundbank-mid.gm)
    On windows, it goes to the desktop, unless you downloaded and opened the jnlp yourself, where it goes to the same folder the jnlp is in. (i should have all these files go into a JMTetris subfolder. gotta do that tomorow)

but it does unzip the midi to a folder called “midi”, the soundbank file should be right there next to that folder along with a file called ‘game.cfg’ (delete this to reset the game settings and hi scores)

i’d like to do something like what Wurm Online have done where you choose where to save packs, but how do they store the location you chose so it knows where to look next time it’s loaded?

You can get the download dialog to show up again by deleting the midi folder then restarting the game in case you rejected the soundbank but want it now, or delete game.cfg if you clicked never download.

i’m adding a couple of rmf files to the collection too (like mod files, they have their own sound samples. java midi can play them.)
here’s one if u want to try it. (21k)
http://www.adam.com.au/kellyjones/perm/grinpound.rmf
and one with vocals (144k)
http://www.adam.com.au/kellyjones/perm/vampster.rmf
They’re both included in the ‘default’ music pack now.

also, just added: to see the midi player window, press F6. (it’s a hidden option). you’ll probably want to do this and open those files rather than repeatedly hitting F8 and hoping java’s dodgy randomness is in your favor. also, you can use the open dialog in the midi player to find where these files are getting downloaded to :slight_smile:

and while i was at it, chucked in a quick toggleGhost method, press F9 to switch it on and off. i’ll update the menu to indicate this very soon.

oh and also added a dialog in the key config telling you about repeated keys before it starts over.

[quote]Is there any way of telling it which soundbank to use? I’ve got both the 5meg and smaller version installed. I believe java is supposed to grab the higest quality one by default, but wasn’t sure if you made an explicit check for it or not.
[/quote]
Actually, the soundbank is offered always when you donwload the midi because the JRE never comes with it, so for the basic gamer who doesn’t know much more about java than “it’s that plugin thingy that goes in the browser and i can play some games with it”, you can almost guarantee that the soundbank is not installed.

(It actually starts playing the music as soon as it’s downloaded, and used to ask “does the music sound ok”. a lot of those songs have a 4 second silence at the start, which i find annoying…)

If you already have soundbanks installed, there’s no reason to download it, especially if you have the hi quality or mid quality ones, as it won’t get used anyway.

however, i don’t like the best quality one at all… it’s probably just a matter of taste, but i think it’s very inconsistent. some samples are great, some are average quality, and a typical song sounds like each instrument is being played in a diferent room with diferent recording tools, some of the samples sound nothing like what they do in winamp or the other java soundbanks for that matter, which makes them sound out of place in the song.

Things to do:

  • A Proper check for existing soundbanks so that if you already have the mid quality or better version, it doesn’t offer it
  • Make it install the soundbank to the correct location in the JRE
  • Make it put the music and config file it downloads / creates in a better location. any tips on this one would be helpful.
  • Remove any music tracks from the ‘pack’ that you guys find particularly annoying (mario theme? tetris themes? that aqua song?)
  • Edit the menu graphic (yep, it’s just a png with text and all) to show the ghost and midi player options
    *or
  • Ditch the menu graphic and go with a JMenuBar - i’m leaning towards this one.

-Make it easier. (atm, it’s pretty hard to get much past level 10)

I actually wanted to point something out abou the soundbank install. On windows at least, I haven’t checked my linux install, the soundbank DOES come with the jre. Most people don’t realise its there.

When you go through the installer you can pick a standard install or a custom one. If you choose custom, you’ll get 2 more options to install. One is for extra language support, the other is for sound and media. The second option will install a default soundbank! Most people probably always do a normal install so they wouldn’t get the soundbank by default.

The linux RPM just installs, without any options, AFAIK.

Regards,
Aaron R>

PS - Great game again!

Ok
I have checked again and it works fin for me under linux without the soundbank.
// Gregof

webstart:
http://www.adam.com.au/kellyjones/perm/JMTetris.php

The game now checks for existing soundbanks installed in the JRE it’s using, and prompts for the download if there are none or if you only have the minimal one. (there’s 3 of them). it wont bother with the soundbanks at all if you never downloaded the music in the first place though.

It installs the soundbank into the correct location in your JRE, so if you have any other midi-using games that sounded dodgy before, check em out again. they’ll probably sound better. (as long as same VM is used)

The config and music files are now saved into a folder called JMTetris in the location provided by the system property user.home (which is c:\documents and settings\your name\ for windows users, and ~ for linux users, i think.)

I have added the extra options to the menu graphic, removed a dodgy midi from the soundbank (responsible for the midi player going silent for a while sometimes, tho it works in winamp.)

so all up, it’s a bit of a tidy-up of files that the game uses, and also, the game will now use the same config and music files no matter where you launched it from or how. (unless you log on as someone else of course, the only choice to cater for this would to be to put the files somewhere in a subfolder in the root, and under linux, not everyone has access to that area anyway.)

ATM, i’m not going to change the menu to a JMenuBar anymore.

-Judd.

Screenshot and a bit of info:
http://www.adam.com.au/kellyjones/perm/

1.9…
-easier dificulty

-checks for the soundbank properly.

-Made rotating the piece push it one to the left or right if there’s no room for it to rotate, which means that you dont have to move the piece away from the wall just to rotate it. should also allow for some interesting manouvering in tight spots.

edit: - 2 new songs. removed ‘vampster’ - too big, gets dodgy when the blocks stack up.

edit: i’ve noticed that the game uses 44% of my cpu on 1.5 and only 33% in 1.4.2_04

edit: although 1.5 doesnt by default come with a soundbank, it does have decent midi timing, so if you like your operating system or sound card’s midi synthesis better than java’s soundbanks, you don’t need to download the soundbank for 1.5 (u can tell if it’s using 1.5 by the shiny blue super cool 3D JButtons)

2.0(beta):

Webstart:
http://www.adam.com.au/kellyjones/perm/JMTetris.php

  • Added JInput support, including force feedback on those OS’s that have JInput support for it. (windows: yes, Linux: dunno, Mac OS: don’t think so)

  • a few other minor adjustments.

Java 1.5 no longer seems to support rmf files (i just get silence). removed the other rmf file from the music pack. (well, so much for that idea…)

also, if you have one of those gamepads that maps only to buttons, the controller won’t work properly. you need a controller which reports an X and a Y axis.

currently, the controller setup i have has a few configurable options, but i haven’t done any UI for them, so hopefully the defaults suit most people for the moment. the one option i did include was to press F3 to swap clockwise and anticlockwise turning. it does both, but on some of my controllers i like to swap which buttons do which action. it doesn’t save this option yet.