AnacondaNet (webstart enabled)

While the issues related to the Webstart version are being resolved you can download the Executable JAR version:

http://www.geocities.com/budgetanime/anacondanet.html

Please let me know if you test the networking with more than one player and if so tell me if the game performed well (i.e. not laggy etc)

It’s a difference between compilation and runtime execution, you seem to use different versions of a class at home and at JGF.

You should check the jars in your classpath.

Hope it helps.

Lilian

I’m actually getting a different error :slight_smile:

But… the GTGE copy to clipboard clearly doesn’t work because copy/paste did nothing. I’ll try again and see if I can manually grab it instead.

re: screenshot changing, I should have that fixed + obvious sometime in the next few hours I hope.

I have re-compiled it… you were correct… it was somehow using an older version of the GTGE library.

Now i have another bug related to the loading of images and other resources.

What is the peferred way in to get the paths of the resources?

At the moment i am using variations to:
System.getProperty(“user.dir”)+FILE_SPERATOR_+“graphics”+FILE_SEPERATOR+“titlescreen.jpg”;

This works correctly as a executable JAR however does not seem to work when used as a webstart…

The new link: http://javagamesfactory.org/jnlp/Anaconda_Net/alpha.jnlp

That’s because you should, officially, never ever load images that way.

If you search on newless cluevies you will find that is the number 1 FAQ in games programming “how do I load images” basically (there are approx 30 different ways you could do it, but only a handful work fully in all situations).

Basically, you need to use getClass().getClassLoader().getResource( “filename.jpg” ); - but check to find out what the current recommended version of that is.

This will work EVERYWHERE in every java program.


Thread.currentThread().getContextClassLoader().getResource("blah");

Kev

Thanks :).

It allows relative requests too, so if you have a JAR with a subdirectory “images”, you can do …

getResource( “images/filename.jpg” );

EDIT: I think I may just drop everything else at some point today and put up a FAQ of things like this that are ultra-common questions, still.

I’m here :slight_smile:
At last, you decide to make it webstartable moogie…

[quote]But… the GTGE copy to clipboard clearly doesn’t work because copy/paste did nothing.
[/quote]
Huh? Are you sure blah3x? What OS do you use?
It use JTextArea.selectAll(); and then JTextArea.copy(); I tried it just now and got no problem…

[quote]What is the peferred way in to get the paths of the resources?
[/quote]
Loading image should be simply getImage(“graphics/titlescreen.jpg”);
And loading resource : bsIO.getURL(“graphics/titlescreen.jpg”); that returns the URL of the resource.
Or bsIO.getStream(…) to return the InputStream.
You should ask this to me instead moogie.

So is the networking bugs solved?

PS: I’m Paupau, GTGE Developer :slight_smile:

Linux. And clipboards on most OS’s are non-trivial (windows, OS X, linux). Most OS’s have multiple clipboards, although most manage most of the time to make something that appears in one appear in all (windows is especially good at this).

Off the top of my head, JTextArea might be the broken gui component that you shouldn’t use (but I can never remember which is the one that Sun waited 5+ years to fix, and then only partially so. It might be the other one … JTextComponent ???).

Anyway, copy/paste requires some effort to get 100% right, and even so you may be dependent upon OS quirks. I have a sneaking suspicion that webstart does something moronic, like preventing all running code from accessing the clipboard, silently (!), or wiping the clipboard when it exits - possibly in an attempt to save themselves from having to fix future security bugs in their code when it is found leaking access to the clipboard.

Can’t help. GTGE seems to wait a few seconds and then terminates the JVM?; AFAICS webstart is delbierately obliterating the clipboard on exit.

Also saw a bug just now, with default params, 800x600, no FS, where the window was instead 800x100 or similar, and not resizable.

I seem to be getting a null returned when using the suggested method:

Thread.currentThread().getContextClassLoader().getResource(str)

where str=“data\graphics\titleimage.jpg”

This only happens when the game is converted into a executable JAR…

i am totally at a loss on the 800x100 bug… i am telling the library to change to the selected resolution… I am not sure whether the library even works on linux… maybe role can help us here…

role: I am trying to get the game webstartable in order for people to try it networked to see if you are an isolated case… so far no one has been able to give me any suggestions as to why you get that message saying you cannot join a multicast group.

doh! /me slaps head

I am still using platform dependant file seperators when the specification asks for “/” seperated!

So i changed that and now it no longer gets a null exception, rather it now gets a java.lang.runtime exception when i use the .getFile() method of the returned URL so i can use the GTGE library to load the images…

here is a stack trace when i tried the game as a self executing JAR:

java.lang.RuntimeException: ERROR: getURL (mode=Working-Directory) from: D:\temp
\temp\file:/D:/temp/temp/AnacondaWebstart.jar!/data/graphics/titleimage.jpg
at com.golden.gamedev.engine.BaseIO.getURL(Unknown Source)
at com.golden.gamedev.engine.BaseIO.getURL(Unknown Source)
at com.golden.gamedev.engine.BaseLoader.getImage(Unknown Source)
at com.golden.gamedev.GameObject.getImage(Unknown Source)
at com.moogiesoft.AnacondaNet.game.MainMenu.initResources(MainMenu.java:
44)
at com.golden.gamedev.GameObject.start(Unknown Source)
at com.golden.gamedev.GameEngine.startGameLoop(Unknown Source)
at com.golden.gamedev.Game.start(Unknown Source)
at com.golden.gamedev.GameLoader.start(Unknown Source)
at com.moogiesoft.AnacondaNet.game.AnacondaNet.main(AnacondaNet.java:94)

    at com.moogiesoft.AnacondaNet.game.SettingsDialog$StartGame.run(Settings

Dialog.java:205)
at java.lang.Thread.run(Unknown Source)

You can not open up the file, because there is none. The file is an entry in a zip file.

I don’t know how GTGE does it. But there must be a way you can give it a URL or a stream and not a File.

At least the copy to clipboard things works very well in my Windows, it’s only a cosmetic anyway :slight_smile:
Developers (GTGE users) can change it easily to make their custom error notification stuff, perhaps directly send the error to their mail.

[quote]Can’t help. GTGE seems to wait a few seconds and then terminates the JVM?
[/quote]
Nope, it will terminate the JVM if only the error notification dialog is not focused.
To copy the exception manually, why not select the JTextArea manually and copy it with Ctrl+C :slight_smile:

[quote]i am totally at a loss on the 800x100 bug… i am telling the library to change to the selected resolution… I am not sure whether the library even works on linux… maybe role can help us here…
[/quote]
GTGE works fine in Linux and MacOS X, many tester that have tried in Linux, MacOS X and got no problem. Ummm MacOS users have a slight problem, but not too worrying. :slight_smile:

[quote]so far no one has been able to give me any suggestions as to why you get that message saying you cannot join a multicast group.
[/quote]
Too bad, I really want to try it with my friends at work. :frowning:
Hope you can fix it immediatelly.

[quote] java.lang.RuntimeException: ERROR: getURL (mode=Working-Directory) from: D:\temp
\temp\file:/D:/temp/temp/AnacondaWebstart.jar!/data/graphics/titleimage. jpg
[/quote]
Guess the exception is quite clear, the titleimage.jpg can’t be found from… urgh what path is that!?
See the mode (mode=Working-Directory), you still using Working-Directory.
For JAR, you should use either BaseIO.CLASS_URL or BaseIO.CLASS_LOADER, CLASS_URL is the default one, and I use it all for my webstart game.
BaseIO.WORKING_DIRECTORY can’t be used, because now the resources is inside the executable JAR.
To get image simply use: getImage(“data/graphics/xxx.png”); No need fancy things.
This is I used for all my webstart game, and it works in Windows, Linux, and MacOS without problem.
For URL, use bsIO.getURL(“data/graphics/xxx.png”); it returns the URL of the xxx.png
And bsIO.getStream(…) to return the InputStream.
GTGE is very simple to use, you make it complicate by yourself. :slight_smile:
And remember, the resources (images/sounds/etc) now must be INSIDE THE JAR and relatively to the game main-class.
So if the game main-class packaging: com.game.MainClass
And you get the images with getImage(“data/graphics/xxx.png”); the xxx.png must be in com/game/data/graphics/xxx.png and inside the JAR.

Right. and WHAT DO YOU THINK HAPPENS WHEN I SWITCH TO ANOTHER WINDOW TO COPY AND PASTE!?!?!

:stuck_out_tongue:

Sigh. That was NOT a good idea for a “feature”.

Doesn’t work, the app exits, wiping the clipboard.

Well, that’s because when in fullscreen mode, the error notification dialog (JDialog) can’t be selected (I don’t know how to make it get focused).
So if the user trying to click the dialog but the dialog can’t get focused, it will automatically terminate the JVM after sometime by calling System.exit(); instead of hung.
Common user don’t know (I think) pressing Alt+TAB to get back to window and kill the hung game process from task manager.
So I take this solution :slight_smile: If the error dialog not get focused, I guess the player not interested at the exception anymore, then I kill the hung game.
This is not feature, but a workaround :stuck_out_tongue:

[quote]Doesn’t work, the app exits, wiping the clipboard.
[/quote]
Wiping clipboard??? How can??
After you manually copy it with Ctrl+C, the clipboard is wiped by the game? Humm weird…
Okay, now I update GTGE so it waits for 5 seconds of inactivity (not focus) of the error notification dialog before shutting down the game.

Note: I update GTGE, not moogie game (AnacondaNet).

Had a quick look through the webstart docs, since I’m working on webstart stuff and had the window open anyway, and noticed that you never have access to the clipboard if your webstart app is not using “full permissions”. Doesn’t matter what you do, you simply don’t have access (allegedly, not confirmed myself)… unless you use the custom API provided by Sun for doing clipboard access from within webstart ;). I guess, from what you said, you’re not using that? It may be that it “works for you” simply because you’re using windows, and are taking advantage of a bug that gives you clipboard access even when you shouldn’t have it. Shrug.

Have you tried it at your work yet? maybe it is only your home computer having issues with the game?

I have never used JARs before… i find them very annoying (same with Webstart :stuck_out_tongue: ) as most non-java people have issues with both :slight_smile: and some java people like myself have issues as well. But enough of my ranting!

I really did not want to make my data directory deep inside the directory structure of the JAR package but i guess i will admit defeat and attempt to do that.

all i wanted was people to test out the network play! oh well i guess it has been a “learning” experience.

Jar’s are really very very easy to use, and code that breaks on jars was broken already, you just didn’t know it yet.

You don’t need to, and I agree it sounds painful and irritating. I can only suggest that you stop using GTGE or find a way to make it behave “normally” - most of us wouldn’t dream of doing that arrangement, since it’s non-standard and not usually helpful.

If you just plain, ordinary jars the way they were designed to work then it’s no more complex than “zip [directory name]” (funny, that. JAR’s are, in fact, zip files - you can even use zip or winzip to create them if you like…)

Broken you say :wink:

The Executable JARred version works fine locally:
http://www.geocities.com/budgetanime/anacondanet.html

however when it is made webstartable it seems to get borked… however i believe i have resolved the issue but i cannot seem to use the JGF to create the jnlp sue to some sever side issues.