some java issues for a game


#1

HI, I am currently implementing an applet game in java. I was wondering:

  1. I want to implement the game as an application too: How to I make an executable for a java application.

  2. I load all graphics as gif images. How can i hide to graphics to people downloading the game? How to I compress it? So that users don’t see its there, but it is there on disk and the game loads it from it. (it must still be platform independent game)

thanks. I don’t know much about these stuff.


#2

Read up on Java archives (JAR). I think you can pretty much use something like WinZip and zip up the class files, then change the extension to .jar and it will work. But there’s one other bit, the manifest.mf file which tells the JAR loader what is the main class in that archive.

If you have the Java runtime installed on your computer, simply double clicking on the jar file will launch it up. However, that might not always be the case. What I’ve seen more commonly done with a “standalone” Java app - meaning you run it from the computer, not inside a web browser - is they create a shortcut (like any standard shortcut link in Windows) with the target set as:

java -jar mygame.jar

Replace “mygame.jar” with the actual JAR filename you made.

You can even put your graphics right inside the JAR file and use them from there. But if you remember earlier, JAR files can be opened and extracted using Winzip. So if you’re concerned about protecting your game assets, you might need to build in your own encryption mechanisms.


#3

thanks vertizor

How do I make a java game portable to a system without java installed?


#4

Well packing the installation files for the jre would be the easiest way but if you want to keep it platform independent this would mean you have to pack the installation files for all platforms on it. And I don’t think that you would have much or any space at all left on that disk.
I already saw commercial Java software with its own Java runtime executable but this software was distributed seperately for each platform.
And there also was the GNU Java compiler but I think it had some restrictions (and I don’t think that’ll help you).

If you want to do it somehow perfect I suggest you to pack your custom Java runtimes with only the classes you need available. I don’t know how much space this would take but I can’t think of any other way to let a Java App run without the runtime installed on that System.


#5

thanks for input bigpet


#6

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.