Color bug tracked down

After digging through the source, I finally found the source of the color bug that Linux and Mac users have been seeing. It's a known bug in the Java runtime.

I just created a Sourceforge account again, maybe I can try to resolve it soon. I'd like to get the source code into a state where we could make a Linux package... I am certain that having a working package would send a bunch of developers our way to help clean up other bugs.

Re: Color bug tracked down

Nice... what's your username? I can add it to the Sourceforge project as a developer.

Re: Color bug tracked down

I am "brettcoburn" on Sourceforge. I'm in the process of moving at the moment, but once that's done then I'll see if there's an easy way to fix the bug. I can probably test to see if the game is running on a Mac or Linux platform, and if so, use the workaround that was posted in the Java bug comments.

Re: Color bug tracked down

OK I made you an admin. (so I'm not the only one.)

Re: Color bug tracked down

Ok, I wish I had the time to do this in a way that won't break when they fix the bug, but for now I think that this will fix it:

InvadeEarth/src/org/invade/Player.java (replace line 191):

//ugly hack to work around Java bug #6183251 - it WILL break if they eventually fix it
String lcOSName = System.getProperty("os.name").toLowerCase();
boolean MAC_OS_X = lcOSName.startsWith("mac os x");
boolean LINUX = lcOSName.startsWith("linux");
if ( !(MAC_OS_X || LINUX) ) {
byte[][] color_threshold = {red_lookup, green_lookup, blue_lookup, identity};
} else {
//bug makes RGBA into GRAB
byte[][] color_threshold = {green_lookup, red_lookup, identity, blue_lookup};
}

I think that should fix it. I am not familiar with the steps needed to test it, as I've never compiled a Java project that was organized this way... way back when I was learning Java, everything was in a flat directory. I'd love to know how I could test it; if you could give me a quick how-to for compiling and running the project then I'd be grateful.

Re: Color bug tracked down

Get NetBeans, then use the built-in CVS to check out Invade Earth. That's the tricky part. All the project settings and everything are in there, you just have to hit Build and Run.

Re: Color bug tracked down

Ok, thanks. I'll try it out this weekend.

Re: Color bug tracked down

Looks like NetBeans works, but I've been so overloaded with school that I don't have time to test my code... it will happen though.

I managed to get through downloading the project from CVS, but it looks like I need some libraries. Do I need to get those from a website, or can NetBeans download them for me?

Re: Color bug tracked down

All the libraries should be in the CVS repository of Invade Earth under the "web" folder.

Re: Color bug tracked down

Actually, the dualrpc jars in the repository seem to be out-dated. There are a few types that aren't in the jars when you initially checkout and try to build the project, like CallException, that lead to 30-some build errors. The new versions can be obtained easily enough from googling dualrpc and added to your working copy.

Unless of course, I totally missed something.

Re: Color bug tracked down

oops. You're probably right on that one.... I remember upgrading to a more recent DualRPC at one point to fix a bug, and I might have forgotten to update the /web copy. Feel free to replace it in CVS as well.