Java Applets now supported on Kongregate!

Well, indeed :frowning: The thing is - Ultratron is pretty rock solid code (apart from that exception, but it was only a test applet and I don’t need to fix that). It’s been out there since 2005, and the only thing that breaks it normally is entirely missing OpenGL drivers, ie. totally vanilla unpatched XP machines, more or less. But, put it in an applet, even with the (almost) latest JVM, and… boom, broken. I mean, how bloody hard can this be??

Cas :slight_smile:

Would you like Ultratron on Android?

Oh yes, and Titan Attacks and Droid Assault (though I fear DA is a bit beyond android).

Cas :slight_smile:

really its not that hard, however there are a few big pitfalls you need to watch out for. (someone should really create a list somewhere)

  • remember your not running a pure Display anymore, it may not seem like it but applets have some AWT graphics code, which is enabled but not used. So adding the following applet parameter
<param name="java_arguments" value="-Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true -Dsun.java2d.d3d=false -Dsun.java2d.opengl=false -Dsun.java2d.pmoffscreen=false">

should pretty much kill any hardware acceleration it may try to use, avoiding any driver clash or problems that may occur between awt and lwjgl on weak drivers.

  • don’t use any System.exit(0)'s in your code, as that will kill the plugin - yes the the ultratron applets has a few of those :slight_smile:

  • for stability always use

  • unrelated - just curious, why the does the Ultratron applets have ?, you can’t see any AWT components, let along drag them :slight_smile:

  • unrelated(2) - @princec in Ultratron how are you doing the really smooth mouse cursor, when mouse is grabbed? is that just drawing an image at Mouse.getX()/getY() ? or some sort of native cursor?

  • relatively speaking princec is using a really old version of lwjgl, lots of bugs were killed especially for applets in more recent releases of lwjgl, ranging from corrupt file downloads to memory leaks. You should really use lwjgl 2.2.2+ (yes out soon :)) if you want nice lwjgl applets :slight_smile:

@Swattkidd7 do other lwjgl applets work for you or do they all fail? e.g. Minecraft or Final Kapster

That might be, but the reason they gave Markus was:

Even Unity seems to be a plugin that Just Workstm, but it will almost certainly be a plugin they will have to install. But yep, shame java is the only platform that has these big stability issues. >:(

So the LWJGL plugin seemed like a really good idea, but then again, princecs lwjgl applet also give me a white screen. I first saw the bootloader for a split sec, and then white. The console showed:

java.util.zip.ZipException: unknown compression method
	at java.util.zip.InflaterInputStream.read(Unknown Source)
	at java.io.BufferedInputStream.fill(Unknown Source)
	at java.io.BufferedInputStream.read(Unknown Source)
	at sun.awt.image.PNGImageDecoder.produceImage(Unknown Source)
	at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
	at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
	at sun.awt.image.ImageFetcher.run(Unknown Source)
Applet INIT
Applet START
display_parent.isDisplayable() = true
Exception in thread "Thread-14" java.lang.NoClassDefFoundError: Lnet/puppygames/applet/News;

Not sure if the first part was just something extra that I got, but seems relevant to the NoClassDef.
WinXP, FF 3.5 & Chrome, Java 1.6.0_17, Mobile Intel 965 Express (Could be the problem). Cleaned the java cache. Final Kapster works fine though pretty sure Minecraft did as well.

Edit: Spelling

pretty sure thats a bug thats been fixed in a newer lwjgl release. (just means you got a corrupt download)

It might even kill the browser with all the other tabs, so this is really bad for user retention ;). Very dangerous when you use the same codebase for both applet and application, since it is easy to forget… (I know :wink: )

Psst over here. Feel free to add more as well. Read more

Or better yet, games4j.com. It even has a great wiki :wink:

Yup, I think I had that problem with this laptop before (and the pixel format bug as well), so it is very likely.

I will eventually get around to fixing a few of the niggles and updating the LWJGL release it’s against but I’m too busy on Revenge of the Titans right now.

But seriously - System.exit() can do that??? Sheesh. It should simply throw an exception if you try to call it in an applet.

Cas :slight_smile:

yup on ordinary applets it can’t do that, but remember your using a signed applet, so no more sandbox, you can do pretty much anything :slight_smile:

alternatively, if your ultratron jar doesn’t need to go outside the sandbox, just don’t sign it, and it won’t be able to do that.

also don’t forget to check out all the small things added to make lwjgl applet process more smoother and nicer.

e.g. like the new Display.setInitialBackground(r,g,b) method, where you can choose the background color (default - black) when Display creates a new lwjgl window, leads to a much smoother and seamless switch from AppletLoader to LWJGL Game. Theres even new Mouse methods for stuff like detecting mouse entering or leaving a lwjgl Display or even getting mouse coordinates outside the LWJGL Display.

Yea both of those work for me…

and jeez, Oracle should hire some of you guys, who know the problems and even fixes for them, its amazing the work you guys do for this community.

I shall try to get on the case. Might even do a Kongregate experiment.

Cas :slight_smile:

Kongregate answered me:

[quote]Thanks for your email. We did indeed deny both of these games, though for different reasons. We’re not 100% against Java games, but they provide additional security, compatibility, and difficulty of use issues, so we’re definitely hesitant to include them. While I don’t want to go into the details of the rejection (you’re welcome to ask the dev if he wants to explain them), the short answer is that the games didn’t make sense for us to incorporate given the risk/reward ratio and the terms of the agreement. If Java continues to show strong games and gets to a must-have point then I imagine we’ll reconsider, but right now we’re seeing much more attention on other platforms and so that’s where we’re investigating at this point.

Cheers,
Anthony
[/quote]
:’(

You should ask the dev, would be nice to know.

Other than that, they didn’t close the door completely and would probably be okay with it if it’s a really good/popular java game (something like Runescape).

Mike

From the blog:

[quote](UPDATE: Kongregate has temporarily stopped excepting Silverlight and Unity games. They are working through some user experience issues with offering these type of games.)
[/quote]
It really does seem like Flash is the only smooth way to offer decent content to a user at the moment. :-\

I will take a look at the LWJGL 2.2.2 release this weekend and try and upload a more fixed applet so we can see what the user experience is like. At least, for people with the latest VM installed. Anything before u10 is a writeoff as far as I’m concerned.

Cas :slight_smile:

That doesn’t necessarily follow. Kong has been a flash site for ages, so of course all of their users have flash. Quite a few ask for Flash 10, though, and I doubt everyone has that. I know I used to play games there with Flash 9 and auto-rate at 1/5 anything I couldn’t play for whatever reason. It could be primarily a question of site administrator perception.

Nothing I think some awesomely compelling free content couldn’t fix.

I wonder if the first 10 levels of Droid Assault would be interesting enough as a standalone applet?

Cas :slight_smile:

That sounds great, would be instant hit IMO, you should also copy the method Robokill uses to get users to pay for the game :slight_smile:

Yup agreed, 40% of all java plugin installs are now u10+, could well be double that for the audience you are targeting. You should probably also bundle it with a nice javascript script to detect and provide a user friendly message for those not on u10+. The javascript code Brackeen posted here on jgo a while back is probably a really good option to start with or the Java Deployment Toolkit.

[quote]The javascript code Brackeen posted here on jgo a while back is probably a really good options
[/quote]
Could you provide the link, if possible?

Thanks