Preloading Data for Applet Game
Hey all!
I was wondering how I could go about preloading all of the images and sounds I use in my game (applet-form) before the user starts playing. It would be especially helpful to have a bar going across that would show the user their status.
It would be even greater to allow the JAR files (I would assume) that hold this data to be cacheable on the user's computer, so they do not need to redownload the data every time they wish to play. This most likely will be a setting they have to choose, but I'm not sure if anything extra would be needed on my part to enable that capability for my users.
I'm fairly advanced with Java; I simply cannot for the life of me figure out how to preload this data.
Any links, resources or tips would be greatly appreciated! Thanks!
--Andrew
[820 byte] By [
wspnuta] at [2007-10-3 10:20:27]

1. Have the applet load (basically do nothing during construction, init, or run other than get a very basic applet loaded). Have a timer go off to trigger #2 after it is created so it at least loads and the user sees something. A custom class loader might be good, but I don't know anything about them.
2. Then start a thread or threads to load the images and sounds. If you know what file sizes they are you can code a JProgressBar to keep track of how far along you are. (Annoying to maintain, but a good indication of what is left to load.)
3. Definitely use a jar file to bundle everything. The JVM will cache the jar file if the user doesn't modify the defaults.
4. http://sourceforge.net/projects/javoids/
The main problem with Javoids was that I didn't code it in a way so as to observe #1 and 2 above.
Good luck in your project. I hope this gives you some ideas to help you on your project.
I put everything into one jar file (easier for me).
If you want to experiment with more than one jar file I suggest looking at these packages: java.util.jar, java.net. You might have more security concerns (SecurityManager) things to check and handle unless your applet is signed, but that has it's own set of things to look into.
I thought as much. Most "loading" applets I've come in contact with (maybe all, I don't remember) have been signed.Anyone have any tips about how I go about getting an applet signed (and then how I can go about setting up a set of JARs to download?)Thanks :)