Applet works on some computers but not on others, seems random.

Started by lainmaster, August 14, 2009, 23:58:57

Previous topic - Next topic

lainmaster

Basicly, what the title says. I can run my game fine from FF or IE. I can do it too, from my other computer. (which doesn't have any lwjgl on it or anything). It works fine for 3 friends of mine, too. But it fails for other 4 friends. I really don't know what to do, but I kinda have an idea of where the problem might be. Then game actually starts fine, because I can see from my server that it connects fine and sends some messages, and downloads the needed files. But the client never shows anything, either the screen is black or it isn't redrawn at all. I think the error is caused by the first line that calls any lwjgl thing. Everything before that, works fine. I think it may be that it doesn't find the native libraries? But it works fine with other computers. Tried both in different OSs and different navigators, it works fine with FF and XP in one computer, and fails with FF and XP in another computer. So neither the OS nor the explorer may be the problem. What can this be? They do accept the certificate warning thing, and it's properly signed. One of the computers it worked in, was even just formated, so no cache or anything. What to do? =/

Matzon

You need to get the exception that is thrown in the console. It's most likely an OpenGL drivers issue. Also, which browser are they using and which Java version do they have installed?

lainmaster

Browser: both IE and FF. As for the rest, I don't know, but I'm guessing it's being caused by whatever line of code tries to get access to the native libraries, which aren't found, for some reason. That's what I thought, though, but your idea seams more reasonable. I think that the line that causes the error is probably Display.create();
Should there be some problem with drivers, what could it be? And how could I fix this? I want as much compatibility as I can get, I don't want to have to tell people to upgrade or update drivers. RuneScape works fine in one of the computers in which my game didn't run.

kappa

this is most likely a driver issues, usually caused by the java graphics pipeline conflicting with the lwjgl one.
since java2d can use opengl, directdraw, direct3d, etc, for some drivers its just too much to do that + allow lwjgl to access opengl.

easy way to get round it is disable the hardware acceleration on the java2d pipeline.

try this parameter to disable all java2d acceleration.
<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">


lainmaster

I'm a bit confused, if I do that, will I sill get hardware acceleration for my game?

kappa

yes you will get hardware acceleration, the java2d pipeline is separate from lwjgl's opengl pipeline and you won't be using it.

lainmaster

Well I'll try that as soon as I can. Thanks a bunch : D

lainmaster

Well a friend tried it on her Mac, and it didn't work. I couldn't get the java console log. I'll test it on the computer with WinXP in which it failed, too, as soon as my friend comes around. In the meanwhile, any ideas?

This is the html, see anything weird?

  <applet code="org.lwjgl.util.applet.AppletLoader" archive="lzma.jar, lwjgl_util_applet.jar" codebase="." width="1024" height="768">
	<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">

	<!-- <param name="al_version" value="0.4">-->
    <!-- The following tags are mandatory -->

    <!-- Name of Applet, will be used as name of directory it is saved in, and will uniquely identify it in cache -->
    <param name="al_title" value="appletloadertest2">

    <!-- Main Applet Class -->
    <!-- <param name="al_main" value="org.lwjgl.test.applet.GearsApplet"> -->
	<param name="al_main" value="ecl.client.MainApplet">

    <!-- logo to paint while loading, will be centered -->
    <param name="al_logo" value="appletlogo.png">

    <!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done -->
    <param name="al_progressbar" value="appletprogress.gif">

    <!-- List of Jars to add to classpath -->
    <param name="al_jars" value="lwjgl_applet.jar.pack.lzma, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma, res.jar.lzma, Ex_Calce_Liberatus_Client.jar">

    <!-- signed windows natives jar in a jar -->

    <param name="al_windows" value="windows_natives.jar.lzma">

    <!-- signed linux natives jar in a jar -->
    <param name="al_linux" value="linux_natives.jar.lzma">

    <!-- signed mac osx natives jar in a jar -->
    <param name="al_mac" value="macosx_natives.jar.lzma">

    <!-- signed solaris natives jar in a jar -->
    <param name="al_solaris" value="solaris_natives.jar.lzma">

    <!-- Tags under here are optional -->

    <!-- Version of Applet, important otherwise applet won't be cached, version change will update applet, must be int or float -->
    <!-- <param name="al_version" value="0.1"> -->

    <!-- background color to paint with, defaults to white -->
    <!-- <param name="al_bgcolor" value="000000"> -->

    <!-- foreground color to paint with, defaults to black -->
    <!-- <param name="al_fgcolor" value="ffffff"> -->

    <!-- error color to paint with, defaults to red -->
    <!-- <param name="al_errorcolor" value="ff0000"> -->

    <!-- whether to run in debug mode -->
    <!-- <param name="al_debug" value="false"> -->

    <!-- whether to prepend host to cache path - defaults to true -->
    <param name="al_prepend_host" value="false">

    <!-- main applet specific params -->

    <!-- <param name="test" value="org.lwjgl.test.opengl.awt.AWTGearsCanvas"> -->
	<!-- <param name="separate_jvm" value="true"> -->

  </applet>


Tried both wtih <param name="separate_jvm" value="true"> and <param name="separate_jvm" value="false">, both got the same result.

I just noticed in NetBeans I have -Djava.security.policy=applet.policy, but I don't have that in the applet. Still, the applet runs fine for some computers. What does -Djava.security.policy=applet.policy do? Should I add it to the applet?


kappa

if its a mac its probably running java 1.5, for the parameters to work you need at least java 1.6.0_u10+.

Do other lwjgl applets work on those computers?

if so we can narrow the problem down to your code as opposed to all lwjgl applets.

lainmaster

She updated to the latest java and it still won't work =/

I don't know any other LWJGL applets. Any links?


lainmaster

She tried minecraft, it worked fine but throwed some exceptions. And she found the console's log for my game, from the error I guess it's my code's fault.

this is the log she got for my game:

2
Client attempting to connect to ecl-play.no-ip.biz/201.235.2.157:9095
Accepted connection
Loading image: "/ecl/graphics/fonts.png"
:::9
Loading image: "/ecl/graphics/tilesets/009-CastleTown01.png"
Exception in thread "Thread-24" java.lang.ArrayIndexOutOfBoundsException: -81
	at java.awt.image.IndexColorModel.getRed(IndexColorModel.java:722)
	at ecl.client.Texture.loadTexture(Texture.java:65)
	at ecl.client.Texture.<init>(Texture.java:20)
	at ecl.client.Main.initializeGame(Main.java:162)
	at ecl.client.Main.run(Main.java:97)
	at java.lang.Thread.run(Thread.java:613)


I had never got that error. Since she's in a Mac, and I have never used a Mac myself, the error may be related to my game saving the files it downloads from the server in the top-most directory. I use the following code to chose where I will save downloaded files:

String sCachePath = new java.io.File("").getAbsolutePath();
while(true){
	if(new java.io.File(sCachePath).getParent() == null)
		break;
	sCachePath = new java.io.File(sCachePath).getParent();
}
sCachePath = sCachePath + "ecl/";


Under Windows, this sets sCachePath to "drive:/ecl/", where drive is the letter of the drive under which my game is being ran.
In mac, though, it seems to be set to "/ecl/". Is it ok to save files in "/" in mac? I really have no idea, but I'm guessing no.

kappa

not usually a good idea to use the top most directory or drive

better to use System.getProperty("user.home"); or System.getProperty("java.io.tmpdir); and store files in those directories as access maybe restricted to other places on the system.

but the error looks like the image loader is failing to parse the image it has found but I could be wrong.

lainmaster

Hmmph, will those directories be available in all supported OSs by LWJGL? Will the files be kept after the user turns off the computer?

kappa

Quote from: lainmaster on August 15, 2009, 18:10:28
Hmmph, will those directories be available in all supported OSs by LWJGL? Will the files be kept after the user turns off the computer?

yes they are available on all the supported lwjgl OS's and yes files are kept there after the computer is turned off.