Arcane Tactics: applet loader

I’ve resurrected one of my abandoned projects, Arcane Tactics. The game is real time tactics with a fantasy setting. The game isn’t ready to play yet, but can you guys give the applet a try? It is here:
http://arcanetactics.com/applet/
The server isn’t running yet! I know “Play” doesn’t work. I’m specifically looking to make sure the applet works everywhere. Any feedback on the applet loader would be great. :slight_smile:

So far, I have fleshed out a party creation UI and spent quite a bit of time on the applet loader (anything to keep me from finishing the game! wtf!?). It is based on LWJGL’s loader, but with a few changes for a hopefully better user experience. The progress bar is glowing and smoothly animated. It is constantly (or almost always) moving, so you never feel like it has hung. Also it is weighted toward the end. It artificially fills up too fast to give the user the feeling it is almost done sooner. It fades out for a more pleasant transition to the game. I dimly draw the applet version in the corner, to remove confusion as to whether then cache is being used.

I’ve tested it on Windows in Firefox, IE6, and Chrome and it seems to work well. It doesn’t work on OSX for some reason. I don’t have OSX myself, but others say the loader works but the game never starts, they just get a black screen. It’s a mystery, there are no exceptions thrown or any errors in the OSX console. Maybe someone here has some insight why?

I have OSX in VMware and I fixed problems until it fails due to some OpenGL problem. I thought it was because my VM doesn’t have hardware acceleration, but alas it still doesn’t work on real hardware. At any rate, here is the exception running in VMware:

[quote]java.lang.NullPointerException
at org.lwjgl.opengl.GL11.glGetString(GL11.java:1771)
at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.initiateGLInstances(LwjglGraphics.java:200)
at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setupDisplay(LwjglGraphics.java:156)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:138)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:130)
[/quote]
This doesn’t seem like a nice way for LWJGL to die. How should I modify libgdx to avoid an NPE and throw an exception if LWJGL can’t start up?

I mentioned in this thread a simple error collecting mechanism and I’m using it in the applet. So, if the applet doesn’t show up for you, likely we’ll be able to see your error here:
http://arcanetactics.com:8080/at/error?p=view

I’m sorry I wasn’t able to make my applet loader changes generic and contribute back to LWJGL. I burnt hours on it already and it would take some effort to get everything I want in a way that is also usable for any game. I do think some of what I did, like the smoothly animating progress bar, would be useful for all LWJGL applets. Maybe someone would port some or all of what I’ve done or write something similar from scratch? Here is my code:
http://arcanetactics.com/temp/AppletLoader.java
It has been formatted, so for your diffing pleasure, here is the original (which is from LWJGL 2.8.2) formatted with the same formatter:
http://arcanetactics.com/temp/AppletLoaderOriginal.java
I hardcoded all the settings, ripped out a couple things (eg, no animated gifs), and did what I needed for my progress bar, fading out, etc.

Beyond that, I think LWJGL would benefit from promoting an easy way to get running in an applet. Eg, put all your JARs in a directory, run something, and now you have everything signed and your applet is ready to be deployed. I don’t care how it’s done, but I can’t help mention that Scar could do it. :slight_smile: It has an lwjglApplet method, but that only works out of the box if Scar is already building your project. Figuring out Scar ruins the whole idea with making it super easy to go from JARs -> working applet. Scar could still be used though, for its utility methods. Eg, here is part of my build script for Arcane Tactics:


String keystore = ...;
String alias = ...;
String password = ...;
keystore(keystore, alias, password, "Esoteric Software", "Arcane Tactics");

String distDir = ...;
String appletDir = ...;
new Paths(distDir, "**/*.jar", "*.html", "*.jpg").flatten().copyTo(appletDir);
for (String jarFile : new Paths(appletDir, "*.jar")) {
  String fileName = fileName(jarFile);
  if (fileName.equals("appletloader.jar")) {
    sign(unsign(jarFile), keystore, alias, password);
    continue;
  }
  if (fileName.contains("native")) {
    lzma(sign(unsign(jarFile), keystore, alias, password));
    continue;
  }
  sign(unpack200(pack200(unsign(jarFile))), keystore, alias, password);
  lzma(pack200(jarFile));
}

Note this is all plain Java code, it just has a static import for Scar.*. As you can see, the whole generate keystore, unsign, pack200, unpack200 (to normalize the JAR), sign, pack200, and then lzma is pretty intense. Imagine trying to write an Ant script for that nastiness! It would also be nice if it could generate and/or update the JARs section in the HTML file. Is a tool like this worth the effort? Would the LWJGL cats promote and maintain it?

Really nice work, especially like the smooth always moving progress bar which IMO would make a really nice addition to the official AppletLoader.

One feature of the AppletLoader which I think has a lot of potential is its headless mode, unfortunately just not had the time to document it properly and write examples for it yet. Basically it enables you to write the appletloader loading screen in html/javascript, thus allowing endless customisation possibilities (basically whatever you can do with javascript/html including putting advertisement banners on it). There is a rather old example here to briefly demonstrate it, probably won’t work, especially on mac, since that example uses a really old lwjgl version and the html/javascript code isn’t tested properly but it should give a rough idea of what is possible.

The loader worked fine for me (Windows Vista, IE9) and the game so far looks magnificent.

Two words: Spider Assassin. 8)

Obviously people will want to read that whole thread, and perhaps play the game described there, in order to fully appreciate the significance of your error collecting approach. (Yay! Free publicity! ;D )

Simon

Wow! The graphics is really smooth, and the title screen is impressive. How did you create that?

Looks great and worked fine for me (Windows 7 32-bit, Firefox 8.0.1)!

The glowing progress bar is cool and so is the title screen. And tweening menu dialogs are also cool!

A nice tool to wrap up my game jars with all required LWJGL stuff to deploy as an “applet to go” would indeed be a great thing to have!

I think all the deployment trouble we have with Java (Webstart JNLP files, Applet signing/packing, Applications without .exe on Windows and included JRE) is one of the biggest reasons Java isn’t used as much for game development as it could :frowning:

So whatever tool can help here (for example like Kappa’s fat jar tool JarSplice or LWJGL’s AppletLoader) is one step forward!

Hello Nate,

Your applet on my mac mini gave this in the system.log file
(Both Safari and Firefox)

Dec 10 21:22:44 www [0x0-0x15f15f].org.mozilla.firefox[59583]: Exception in thread “AWT-AppKit” netscape.javascript.JSException: Plugin instance for applet ID 1 was already released
Dec 10 21:22:44 www [0x0-0x15f15f].org.mozilla.firefox[59583]: at sun.plugin2.main.server.LiveConnectSupport.getInfo(LiveConnectSupport.java:405)
Dec 10 21:22:44 www [0x0-0x15f15f].org.mozilla.firefox[59583]: at sun.plugin2.main.server.LiveConnectSupport.shutdown(LiveConnectSupport.java:41)
Dec 10 21:22:44 www [0x0-0x15f15f].org.mozilla.firefox[59583]: at sun.plugin2.main.server.JVMInstance.unregisterApplet(JVMInstance.java:1376)

(These messages don’t appear when running the lwjgl applets from the 16kb contest)

Not sure if it helps, but a quick google search hinted towards mixed 32-bit / 64-bit libraries.
Might be something you can work with?!

Best regards from
M.E.

Thanks everyone for trying it out. :slight_smile: Got a couple exceptions I didn’t expect.

It sounds a little scary. Potential for things to go wrong is even higher than applets, which is already not great.

Thanks. 8) It’s just two images drawn on top of each other with blending.

Thanks for the exception, M.E. This is the only clue I have for OSX. Does it make any sense kappa? Would it cause a black screen after loading? Is there anything I can rip out that might help?

worked fine for me, Ithink that your menu transitions are sick though!

Oooh I got this:



java.lang.Exception: JNLPClassLoaderUtil: couldn't find a valid JNLPClassLoaderIf
	at com.sun.jnlp.JNLPClassLoaderUtil.getInstance(Unknown Source)
	at com.sun.jnlp.JnlpLookupStub.findService(Unknown Source)
	at com.sun.jnlp.JnlpLookupStub.access$000(Unknown Source)
	at com.sun.jnlp.JnlpLookupStub$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.jnlp.JnlpLookupStub.lookup(Unknown Source)
	at javax.jnlp.ServiceManager.lookup(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.badlogic.gdx.backends.lwjgl.LwjglNativesLoader.<clinit>(LwjglNativesLoader.java:33)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplet.<init>(LwjglApplet.java:44)
	at com.esotericsoftware.arcanetactics.ArcaneTacticsApplet.<init>(ArcaneTacticsApplet.java:9)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at com.esotericsoftware.arcanetactics.AppletLoader.switchApplet(AppletLoader.java:1074)
	at com.esotericsoftware.arcanetactics.AppletLoader$3.run(AppletLoader.java:414)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$000(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Really smooth and really cool graphics, great job! :slight_smile:
How did you do that highlighted loader bar? :stuck_out_tongue:

If a NullPointerException is thrown in LibGDX’s main loop -> graphics.setupDisplay(); -> initiateGLInstances() by the following call:
String version = org.lwjgl.opengl.GL11.glGetString(GL11.GL_VERSION);
then yeh it does look like it’ll crash the LibGDX applet thread as it isn’t caught and therefore cause a black screen.

Really odd though why the glGetString call would throw a NullPointerException once the Display has been created. It does look like some sort of driver or lwjgl bug, you could try comment out that line (or catch exception) on OS X since you can assume any OS X 10.5+ will have OpenGL 2.1 to see if you get any luck. Btw your error collecting mechanism is pretty cool, would be nice if it also displayed a bit more information about the system it happened on like the OS and Java Version.

Also which version of LWJGL are you using?

Thanks. :slight_smile: It’s easy, just Interpolation.swing.apply. Run LwjglTestStarter and choose InterpolationTest and it’ll show a little graph of all available interpolators, as well as let you test each one.

http://screensnapr.com/e/hDjakl.png

Ehh, that code is in a try/catch(Throwable), it should never be thrown or logged! WTH? Sounds like the applet did work though. Thanks. :slight_smile: The loader is Java2D, the bar and glow are separate images and are shown more and more using clip, just like the LWJGL loader. Then the alpha of the glow is modulated. Most of my effort was making the bar continuously grow, even when the download isn’t being updated. Just assuming the download is somewhere just behind the visuals is sneaky, but makes it buttery smooth and makes the user feel like, hey, it’s almost done! :stuck_out_tongue:

M.E.'s exception was in LiveConnectSupport though, which doesn’t seem related to LWJGL or my stuff. libgdx should probably catch the NPE and throw “Hey, your computer really blows!”. :slight_smile: Good point on the error reporting, knowing the OS, Java version, OpenGL, and other info could be very helpful.

Ack, very good good point on the LWJGL version. libgdx is a bit behind. Should have upgraded before bothering anybody! :slight_smile: Will do that soon and see what happens.

Oops, sorry, was looking at the wrong error. LiveConnect has always been a little flaky, although it was fixed/rewritten in Oracles plugin2, the mac implementation is still a little rough, if you’re not using any live connect or accessing javascript from java in any other way then I have no idea how or why its throwing that error. Some info on the OS X and Java version would have been useful here :slight_smile:

[quote=“Nate,post:11,topic:37706”]
Yup, do keep in mind that any LWJGL version older than 2.8.0 will no longer work as an Applet on OS X 10.6+ now due to Apple’s plugin2 changes. If it is older than 2.8, you will indeed just get a blank screen although the applet will be running.

Beauty!

I like those bouncy menu transitions a lot. The interpolation formula adds the illusion of weight and mass.
The glowing progress bar–color & themes matching the lettering: I was hypnotized and forgot how long it took to load.

winXP Home, sp3
Java 6.29
firefox 8.0

You just made many of us look bad! It’s very neat and polished.

It works on Windows 7 on Chrome, FireFox and Opera.

Couldn’t get it working on Mac OS (both Snow Leopard and Lion). After it loads it fades to black and that’s it.
Switched on the java console (Utilities -> Preferences -> Java Settings -> Console on - I had difficulties to find it) but couldn’t get hold of any logging and the servlet reported no error.

I will give it a go on Linux (Ubuntu) too and once these things are ironed out and the game finished I’m sure it will be a great asset for the Chrome Store.

As for the applet loader, I always avoided them but it seems that you did a terrific job to take out most of the pain associated with it.

Kudos!

A truely brilliant and mesmerizing presentation screen… And the sprites seen in the Edit Party section are very promising… We can only ask for more !

Oh god. Mystery solved! ::head desk:: libgdx is still on 2.7.1! I’ll update soon.

Ha! Thanks, but it isn’t a game yet. Not even close!

I’ve done some work on the game and the server is running now:
http://arcanetactics.com/applet/
As soon as two players connect, they are matched up. You can open two tabs if you want to play against yourself. Warning: it isn’t fun yet! :-\ The cleric and wizard are useless until they level up once. Eg, the wizard doesn’t have a fireball and cleric doesn’t have heal until you pick your first talent. Warrior does too much damage. Probably too many hit points (~1000) for units that can only deal 50 damage. The list goes on. I’ll create some more talents before really focusing on balancing gameplay.

I did the work on Scar discussed above. You can easily deploy JWS apps and LWJGL applets with it, see here:

That was really cool. Loved the flip animation when a new game starts. How do you play? I connected against someone and start randomly attacking their players. Unfortunately for the opponent, I was annihilating their players so they quit ;D

Haha… to play you click your guys, and kill the other guys. It isn’t balanced very well now, so unfortunately it isn’t very fun yet. The fun is supposed to come from customizing your guys with tons of different synergistic talents, that is the theory at least.

Neat! I love the style, very polished 8)
In my opinion, tweens are like particles: small details providing a huge extra user experience!

Don’t know if you saw that wip, but it may interest you.