Sign in to follow this  
m_waddams

[java] getResourceAsStream insanely slow in Applet

Recommended Posts

Hi,

My Applet is a lot slower than my Application. The problem seems to be getResourceAsStream. Any known fixes/workarounds?
Check out the applet: [url="http://java-expert.nl/games/test/applet/LodeRunnerRetro.html"]Lode Runner Retro Applet[/url]
or the Announcement topic [url="http://www.gamedev.net/topic/603300-lode-runner-retro/"]Lode Runner Retro topic[/url]

Share this post


Link to post
Share on other sites
I dont know if tehres a way to optimize getResource in an applet. There might be but applets are slow and cumebrsome in general.

Have you tried using java webstart? its pretty effective. I have a small 2D game here that uses webstart if youre looking for an example. [url="http://www.distantmelody.net/spheres-of-madness"]www.distantmelody.net/spheres-of-madness[/url]

Share this post


Link to post
Share on other sites
[quote name='Wilhelm van Huyssteen' timestamp='1307523288' post='4820843']
I dont know if tehres a way to optimize getResource in an applet. There might be but applets are slow and cumebrsome in general.

Have you tried using java webstart? its pretty effective. I have a small 2D game here that uses webstart if youre looking for an example. [url="http://www.distantmelody.net/spheres-of-madness"]www.distantmelody.net/spheres-of-madness[/url]
[/quote]


I don't really understand webstart? What is the difference between downloading a zip, unzipping it where you like, double clicking the sh/bat file on the one hand,
and webstart on the other?

Share this post


Link to post
Share on other sites
A webstart application starts up after the user clicks the link for it (no downloads no zip files no nothing. just click go). In other words its very convenient for the user. So you would use a webstart application for the same reason you would use an applet. To make the users life easier. Also webstart is just a means to launch a standard java application. So theres no performance issues and no special code required.

Share this post


Link to post
Share on other sites
[quote name='Wilhelm van Huyssteen' timestamp='1307528417' post='4820869']
A webstart application starts up after the user clicks the link for it (no downloads no zip files no nothing. just click go). In other words its very convenient for the user. So you would use a webstart application for the same reason you would use an applet. To make the users life easier. Also webstart is just a means to launch a standard java application. So theres no performance issues and no special code required.
[/quote]

Very well, I added http://java-expert.nl/games/test/webstart/LodeRunnerRetro.jnlp
See if it works please :)

I am a bit weary of just accepting certificates though, same as for an applet...

Share this post


Link to post
Share on other sites
<P>works 100% on my windows 7 pc and my old windows xp laptop.<BR><BR>Just one thing. It asks to install LWJGL. I see youve added it as an extension in ur jnlp file. I take the source of lwjgl and i add it to my application. I then export everything together in one jar and i use pro guard to take out all unused classes. That way the overhead of lwjgl becomes realy tiny and my users dont get another "Install this dodgy software dialoge box".<BR><BR>Nice work on the game btw! </P>

Share this post


Link to post
Share on other sites
[quote name='Wilhelm van Huyssteen' timestamp='1307535192' post='4820903']
<P>works 100% on my windows 7 pc and my old windows xp laptop.<BR><BR>Just one thing. It asks to install LWJGL. I see youve added it as an extension in ur jnlp file. I take the source of lwjgl and i add it to my application. I then export everything together in one jar and i use pro guard to take out all unused classes. That way the overhead of lwjgl becomes realy tiny and my users dont get another "Install this dodgy software dialoge box".<BR><BR>Nice work on the game btw! </P>
[/quote]
Thanks for testing [img]http://public.gamedev.net/public/style_emoticons/default/wink.gif[/img] Now I still need some Linux testers, for some reason that doesn't seem to work (I think it's loading the Windows natives). Update: Wine had associated itself with webstart :) Aaarrrgghhh
LWJGL is a one time install, no big deal. Couldn't get your game to work on my Linux FF/Chrome though, will try Windows XP later.

Share this post


Link to post
Share on other sites
[quote name='Wilhelm van Huyssteen' timestamp='1307536353' post='4820911']
testing it in windows would be apreciated.
[/quote]
I just tested it on Windows XP Home Edition. It restarted my system, as soon as I accepted Run, from the security dialog.

How do you get your certificate to look like it does? Mine is horrible:

[img]http://java-expert.nl/games/test/Security.jpg[/img]



I would like to fill in Name and Publisher... (I filled in all fields in keytool)

Share this post


Link to post
Share on other sites
It restarted your System?! wow thats a first :D. but thnx for testing it.

for name and publisher: I manualy added it to the jnlp file. Note title and vendor.


<!-- test jnlp file -->
<jnlp
spec="1.0+"
codebase="http://www.distantmelody.net/spheres-of-madness/webstart/">
<information>
<title>Spheres of Madness</title>
<vendor>DMStudio</vendor>
<homepage href="http://www.distantmelody.net/"/>
<description>Spheres of Madness</description>
<description kind="short">Spheres of Madness</description>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+" initial-heap-size="256m" max-heap-size="1024M"/>
<jar href="Frost.jar" main="true"/>
<jar href="data.jar"/>
</resources>
<resources os="Windows">
<j2se version="1.6+"/>
<nativelib href="native-windows.jar"/>
</resources>
<application-desc main-class="spheres_of_madness.SpheresOfMadness">
</application-desc>
</jnlp>

Share this post


Link to post
Share on other sites
[quote name='Wilhelm van Huyssteen' timestamp='1307644749' post='4821427']
for name and publisher: I manualy added it to the jnlp file. Note title and vendor.
[/quote]
Yeah, I have that too, but this is not the certificate info. Remove your own certificate (with jcontrol) and see how your Security dialog looks.

Share this post


Link to post
Share on other sites
[quote name='Milton Waddams' timestamp='1307704253' post='4821660']
[quote name='Wilhelm van Huyssteen' timestamp='1307644749' post='4821427']
for name and publisher: I manualy added it to the jnlp file. Note title and vendor.
[/quote]
Yeah, I have that too, but this is not the certificate info. Remove your own certificate (with jcontrol) and see how your Security dialog looks.
[/quote]

Sorry im not 100% sure how the certificate works. However i can tell you the only other thing i did apart from setting the parameters in my jnlp file was use Jarmaker to create my keystore and sighn the jar.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this