Help my game enter the web

Hi!

I’ve made a platform game in Swing and it works pretty good on my computer. Now I would like to put it on my website for my friends to play it. Which way is the best?
Java applets: Extend Applet from the JFrame
Java Web Start: Don’t really know what this is. Does it require my friends to download special software?
Java FX: Don’t really know what this is either but from what I heard it is similar to an applet.

The game has to be able to communicate with mysql on the server, both write and read. Ideally it will be full screen.

Thanx
/KaptenDavidsson

webstart is the way to go…

a quick google search showed this: http://showmedo.com/videotutorials/video?name=3190000&fromSeriesID=319

Except that WebStart’s implementation is utter crap and the browser plugin is actually more stable these days, and not an unknown technology to the enduser/player.

Riven you should really give jws a try on 1.6.0_18 (latest update) think they finally fixed the caching problems.

Applet, to have communications it needs to be signed. This is not too difficult though.

Applet seems to be pretty good choice but most applets will not work on Opera browsers, and some Linux/Mac machines
seem to have problems with applets too. Our racing game would not start in browser in many people’s machines,
but running them through ‘appletviewer’ from command line worked, but many people may find this difficult.

Applet to go fullscreen however will need some tricks, like popping a JWindow to get out of the browser window. I had trouble getting that to be stable when ‘undecorated’, and still haven’t had time to figure it out.

Have seen a lot of ok Webstart applications and our old game was webstart, perhaps some explanations or link to thread already discussing it, as to why it is bad would be in order I guess.

kk, the reason I said jws, is because he is using a swing application, and I am guessing it runs in a window, and as far as I know he would have to change his code ot an applet to run it as an applet amd I right?

applet don’t have to be signed if they want to communicate with the server they are hosted on, and now they also have cross domain support, so no longer need to be signed to connect with any server.

http://weblogs.java.net/blog/joshy/archive/2008/05/java_doodle_cro.html

not if you use a lwjgl applet or a library like slick :slight_smile:
they have proper fullscreen support.

example of slick applet with fullscreen support here

That would really be nice. It takes roughly 6 months to get something like 25% penetration though.

Thanx alot everyone, your comments have been most helpful.

Judging from your answers it seems like both applets and jws will work so I might try both (I need to learn them anyway) but I started out trying applets. So far I get it to work pretty good by just open my JFrame in the applet init block. I had to change my ImageIO.read(new File(“bild.jpg”)) to new URL(getDocumentBase(), “bild.jpg”) and that part seems to work. My problem now is to connect to a mysql server. I think the database is on the same computer as the server but I’m not sure, I use one.com as my webhost. When I try to call Class.forName(“com.mysql.jdbc.Driver”) I get a noClassDefException. I think I can get it to work though.

/Mike

Don’t communicate with the database directly, leave it private on the server!!!

Instead build a script (i.e. communicate.php) and place that on your site. To communicate to the server you make a HTTP GET request of the script passing in your arguments and what the script writes out is your response. This adds a layer of control between what those outside your server (including your applet and others) can and cannot ask your DB about. If you want lots of communication, then build it using lots of small scripts for handling each type of request.

If you have a search around JavaGaming about how to build highscore tables for applets then you’ll find lots of discussion and advice on this subject.

Also standard Java doesn’t come with a MYSQL driver (or didn’t when I last used it). On the MYSQL site somewhere is a .jar file containing the driver which you’ll need to download, upload to your site and then link to in the applet tag as a part of your applets codebase.