Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
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  
  applet downloading media  (Read 1234 times)
0 Members and 1 Guest are viewing this topic.
Offline rouncer

Junior Devvie





« Posted 2010-04-27 08:58:44 »

So once youve got your game done and its online, inside the applet on its startup you can connect to an url and download game media.
(to load levels and graphics and possibly character info.)

I was just wondering is there a way to code this so it happens once only when the user first gets the applet, or do you have to always reload all the media
every time the applet is loaded.
Because it seems like your wasting a lot of server bandwidth (that you might have to pay for) and I was just wondering if you could save send sometimes.

Another way to do this would be to have a dedicated server that also manages the game send the media that the client applet requires. (in the case of maybe an MMO implementation)

Would there be some way to keep media (as long as it never changes ever once during the game, like say a static environment and static model pieces) so next time
you load the applet up it starts faster? (and doesnt resend everything it already sent last time)
Offline rouncer

Junior Devvie





« Reply #1 - Posted 2010-04-27 09:02:17 »

Ive just got an idea, is it possible to have an "external download" where it places in some directory, e.g. "c:\gamename" that the applet then reads out of all the game data so it needent be downloaded every time the applet starts.
Offline princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #2 - Posted 2010-04-27 09:19:32 »

A signed applet can write stuff out to a cache. But otherwise yes you're stuck with reloading every time (like Flash is).

Cas Smiley

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

Junior Devvie





« Reply #3 - Posted 2010-04-27 10:28:37 »

Yeh thanks.
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 835
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #4 - Posted 2010-04-27 11:10:47 »

A signed applet can write stuff out to a cache. But otherwise yes you're stuck with reloading every time (like Flash is).

Cas Smiley

URLConnection caches resources with the JAR extension... yay!

/stuff/tree.jpg.jar
/stuff/sky.jpg.jar

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline jojoh

JGO Knight


Medals: 5
Projects: 7


games4j.com


« Reply #5 - Posted 2010-04-28 09:56:14 »

Cool, didn't know that either.

From http://java.sun.com/j2se/1.4.2/docs/api/java/net/URLConnection.html#setUseCaches%28boolean%29
Quote
If the UseCaches flag on a connection is true, the connection is allowed to use whatever caches it can.

It's a bit vague  Smiley Do you know what that usually is for an applet? The browser cache? What are the other possibilities?

Offline Momoko_Fan

Junior Devvie


Medals: 2



« Reply #6 - Posted 2010-04-28 15:19:01 »

I am pretty sure it just uses the HTTP caching method, so the client sends in the header "If-Modified-Since" and if the server accepts it, the caching should work automatically and jar will get re-downloaded when its updated.
Offline markmistry

Junior Devvie





« Reply #7 - Posted 2010-04-28 15:31:15 »

I may be off the mark when i say this but from my experience i used the approach... players run the applet on thier computers then if its signed you can create a directory for your game and download what you like into it(images,music etc).my sprites were massive 10mb each and i didnt want a player to download them every time they ran it. you can check the date of file creation so if its newer then it will download it off the server if not it skips it, of course all this is done in the background at a time when performance doesnt matter.
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 835
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2010-04-28 15:35:20 »

I may be off the mark when i say this but from my experience i used the approach... players run the applet on thier computers then if its signed you can create a directory for your game and download what you like into it(images,music etc).my sprites were massive 10mb each and i didnt want a player to download them every time they ran it. you can check the date of file creation so if its newer then it will download it off the server if not it skips it, of course all this is done in the background at a time when performance doesnt matter.


The whole idea is to make it cache media without signing. Caching it yourself in signed code is trivial.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #9 - Posted 2010-04-28 15:49:23 »

I seem to recall URLConnection was written by Satan himself.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 835
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #10 - Posted 2010-04-28 15:56:33 »

I seem to recall URLConnection was written by Satan himself.

Cas Smiley

If you mean...
 - It makes a lot of promises.
 - It's hideous.
 - You shouldn't depend on it.
 - It will hurt you where it hurts most.
 - It tends to deadlock around Christmas.
 - Every incarnation breaks your heart.
then: yes.


But... it caches JAR files.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #11 - Posted 2010-04-28 16:31:54 »

Could something be done like giving the user the option to cache resources, having them click a "YES" button, and as the button is clicked a different (signed) JAR is loaded to do the caching?

See my work:
OTC Software
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 835
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #12 - Posted 2010-04-28 16:33:40 »

Could something be done like giving the user the option to cache resources, having them click a "YES" button, and as the button is clicked a different (signed) JAR is loaded to do the caching?

Sure, until 6u19 screwed us over.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (31 views)
2014-11-22 12:13:56

xFryIx (72 views)
2014-11-13 12:34:49

digdugdiggy (51 views)
2014-11-12 21:11:50

digdugdiggy (45 views)
2014-11-12 21:10:15

digdugdiggy (39 views)
2014-11-12 21:09:33

kovacsa (63 views)
2014-11-07 19:57:14

TehJavaDev (68 views)
2014-11-03 22:04:50

BurntPizza (66 views)
2014-11-03 18:54:52

moogie (81 views)
2014-11-03 06:22:04

CopyableCougar4 (81 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org 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‑gaming.org
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!