Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (794)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Fast loading files in applet  (Read 3783 times)
0 Members and 1 Guest are viewing this topic.
Offline roland
« Posted 2012-01-05 07:29:01 »

My game is going to be able to be played as an applet, but since there will likely be lots of levels, etc, I don't want to store all the resources inside the jar file. It will just be too big. Instead, I will only load the files that I actually need for the current map/level. But I don't know a fast way of doing this. Can someone tell me a good way? Mostly it will be images and text files that need to be loaded. Possibly sound but then again I might keep the music (atleast a minimal amount) stored in the jar.
I'm using LWJGL if that makes any difference

Offline Damocles
« Reply #1 - Posted 2012-01-05 07:41:28 »

here some random link how to load an asset from the server the applet comes from.

But I never really loaded anything outside the jar yet. But there are many examples on the web.
Offline roland
« Reply #2 - Posted 2012-01-05 08:20:42 »

Thanks for the reply, Damocles

I couldn't use the first link because it is just for AWT images, not LWJGL or anything. And I'm not sure about the second one, lookup returns an Object but I need a stream.

I have found this:
URL url = new URL("")
InputStream is = url.openStream();

Is this a good way, or is there a better one? I'm really trying to make loading times as fast as possible.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ra4king

JGO Kernel

Medals: 508
Projects: 3
Exp: 5 years

I'm the King!

« Reply #3 - Posted 2012-01-05 18:29:57 »

There is no other way Wink

Offline BoBear2681

JGO Coder

Medals: 19

« Reply #4 - Posted 2012-01-05 19:08:46 »

Make your applet able to be hosted on any site using getCodeBase():

URL url = new URL(getCodeBase(), resource);

Also, if stuff is big, you can always store them zip/gzip'd server side, and uncompress them in the applet.  Of course, applets don't lend themselves too well to big data due to memory constraints.  But still, it may help with performance on slower connections since the cost of the download will certainly be greater than the cost of the decompression.
Offline roland
« Reply #5 - Posted 2012-01-06 01:21:55 »

Ok, Thanks  Smiley
Pages: [1]
  ignore  |  Print  

hadezbladez (3114 views)
2018-11-16 13:46:03

hadezbladez (1126 views)
2018-11-16 13:41:33

hadezbladez (3070 views)
2018-11-16 13:35:35

hadezbladez (614 views)
2018-11-16 13:32:03

EgonOlsen (3902 views)
2018-06-10 19:43:48

EgonOlsen (4371 views)
2018-06-10 19:43:44

EgonOlsen (2604 views)
2018-06-10 19:43:20

DesertCoockie (3426 views)
2018-05-13 18:23:11

nelsongames (3547 views)
2018-04-24 18:15:36

nelsongames (4586 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!