Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (547)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  Applet Demo smooth download and splash (Updated 2007-12-13) : New version  (Read 17636 times)
0 Members and 1 Guest are viewing this topic.
Offline DzzD
« Posted 2007-12-03 21:51:41 »

This is a generic AppletLoader (javascript) Works with all Applet and SUN+MS JVM

No Java splash, no computer freez (not a long one ;-)) , and finally no click to activate control.

http://demo.dzzd.net/JScripts/
http://demo.dzzd.net/JScripts/index2.htm

please let comments and bugs on your platforms as the following:
FF 1.5 Windows XP (SUN1.6) => Ok
FF 2.0 Windows XP (SUN1.6) => Ok
IE 1.6 Windows XP (MS1.1+SUN1.6) => Ok

Need to polish source code a little before releasing

UPDATE:
a different layout with same applets using a single target window http://demo.dzzd.net/JScripts/index2.htm


UPDATE:

A first source code, it may be improved but this is the one currently used. you can view html source code of the above url to see how to use it

UPDATE:
Source code updated (I introduced a MSJVM bugs while trying to resolve a bug appening in safari browser), it is now resolved new version works with MSJVM

UPDATE:
Source code updated, add message when unable to start applet also ask the user to install java if unable to detect any JVM

UPDATE:
Source code updated, now works on Safari 3.0.4 windows XP

UPDATE:
Better Jar and classe file cache enable fast switch between applet once an applet have been loaded it can be started immediatly

UPDATE:
Java script refound from scratch

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
  /**
       * 3DzzDAppletScript.js
       *
       * This source code is a part of 3DzzD Web 3D engine you may use it as long as you provide the orignal source author and website and this comment unmodified
       *
       * @author bruno augier
       * @email bruno.augier@dzzd.net
       * @website http://dzzd.net/
       * @version 1.00 2007/12/03
  */

 
  var jvmInited=false;
  var imageLoad=new Image();
  imageLoad.src="INIT.GIF";
  var preloadingJar = new Array();
 
  function loadApplet(targetAppletId,appletName,appletTag,width,height,preloadJarFiles)
  {
    if(document.getElementById(appletName))
      return;  
   
    var msg="Loading Applet "+ appletName;
    window.status=msg;
   var target=document.getElementById(targetAppletId);
   var html="";
    html+="<TABLE ID=\""+targetAppletId+"LOADER\" cellSpacing=0 cellPadding=0 WIDTH=\""+width+"\" HEIGHT=\""+height+"\" STYLE=\"border:0\" >";
    html+="<TR><TD vAlign=\"center\" align=\"middle\">";
   html+="<IMG ";
    html+=" ALT=\""+ msg + "\" ";
    html+=" SRC=\"INIT.GIF\" ";
    html+=" >";
    html+="</TD></TR></TABLE><DIV STYLE=\"visibility:hidden\" ID=\""+targetAppletId+"APPLET\"></DIV>";  
   target.innerHTML=html;
   var nbApplet=document.applets.length;
   
   if(preloadJarFiles!=null && preloadJarFiles.replace(" ","")!="")
   {
      preloadJars(preloadJarFiles);
      setTimeout("showAppletOnceStartedPreload(\""+targetAppletId+"\",\""+appletName+"\",\""+appletTag+"\",\""+width+"\",\""+height+"\",\""+preloadJarFiles+"\","+nbApplet+")",100);
   }
   else
   {
      setTimeout("showAppletOnceStarted(\""+targetAppletId+"\",\""+appletName+"\",\""+appletTag+"\",\""+width+"\",\""+height+"\","+nbApplet+")",100);
   }  
  }
 
  function showAppletOnceStartedPreload(targetAppletId,appletName,appletTag,width,height,preloadJarFiles,nbApplet)
  {
   if(!isJarsPreloaded(preloadJarFiles))
      setTimeout("showAppletOnceStartedPreload(\""+targetAppletId+"\",\""+appletName+"\",\""+appletTag+"\",\""+width+"\",\""+height+"\",\""+preloadJarFiles+"\","+nbApplet+")",1250);
   else
      setTimeout("showAppletOnceStarted(\""+targetAppletId+"\",\""+appletName+"\",\""+appletTag+"\",\""+width+"\",\""+height+"\","+nbApplet+")",250);
  }
 
  function showAppletOnceStarted(targetAppletId,appletName,appletTag,width,height,nbApplet)
  {
    var target=document.getElementById(targetAppletId+"APPLET");
   
   if(target.innerHTML.toUpperCase().indexOf("<APPLET ")==-1)
   {
      target.innerHTML+=appletTag;
      setTimeout("showAppletOnceStarted(\""+targetAppletId+"\",\""+appletName+"\",\""+appletTag+"\",\""+width+"\",\""+height+"\","+nbApplet+")",250);
      return;
   }
   
    if(jvmInited)
   {
      if(document.applets.length>nbApplet)
      {
          var applet=document.getElementById(appletName);
         if(applet!=null)
         {
            if(document.applets[appletName])
            {
               var msg="Applet loaded and started " + appletName;
               window.status=msg;
               setTimeout("showApplet(\""+targetAppletId+"\",\""+appletName+"\",\""+width+"\",\""+height+"\")",250);
               return;
            }  
         }
      }
   }
   setTimeout("showAppletOnceStarted(\""+targetAppletId+"\",\""+appletName+"\",\""+appletTag+"\",\""+width+"\",\""+height+"\","+nbApplet+")",250);
  }
 
  function showApplet(targetAppletId,appletName,width,height)
  {
   var applet=document.getElementById(appletName);
   var loader=document.getElementById(targetAppletId+"LOADER");
     loader.style.display="none";
   applet.width=width;
   applet.height=height;
   applet.style.width=width;
   applet.style.height=height;
   var target=document.getElementById(targetAppletId+"APPLET");
   target.style.visibility="visible";
  }
   
  function preloadJars(files)
  {
   var fileArray=files.replace(";",",").split(",");
   for(var c=0;c<fileArray.length;c++)
   {
    preloadJar(fileArray[c]);  
   }  
  }

 
  function isJarsPreloaded(files)
  {
   var fileArray=files.replace(";",",").split(",");
   for(var c=0;c<fileArray.length;c++)
   {
      if(!fileArray[c])
         return false;
   }
   return true;
  }

  function isJarPreloaded(name)
  {
   if(preloadingJar[name]==null)
      return false;
     
   return preloadingJar[name];  
  }
 
  function preloadJar(name)
  {
     
      if(preloadingJar[name])
      return;
       preloadingJar[name]=false;
       var f=window.frames[name];
       if(!f)
       {
            document.body.innerHTML+="<IFRAME NAME=\""+name+"\" WIDTH=0 HEIGHT=0 STYLE=\"border:0\"></IFRAME>";
            f=window.frames[name];
            f.document.open("text/html");
            var iframeHTML="";
            iframeHTML+="<HTML><BODY onload=\"parent.preloadingJar['"+name+"']=true;\" SCROLL=NO STYLE=\"margin:0\" >";
            iframeHTML+="<APPLET ARCHIVE=\""+name+"\" NAME=\""+name+"\" WIDTH=0 HEIGHT=0 ";
            iframeHTML+=" CODE = \"java.applet.Applet\" ";
            iframeHTML+="</APPLET>";
            iframeHTML+="</BODY></HTML>";
            f.document.write(iframeHTML);
            f.document.close();
       }
  }
  var initJVMCount=0;
  /**
       * Initialise Java JVM, this may hang few seconds
  */

  function loadJVM()
  {
       if(jvmInited)
       return;
       if(initJVMCount>15)
       {
            if(confirm("Java Plugin requiered, do you want to instal Java Plugin ?"))
            window.location.href="http://java.com/";
            jvmInited=true;
            return;
       }
       var f=window.frames["JVMLOADER"];
       if(!f)
       {
            document.body.innerHTML+="<IFRAME NAME=\"JVMLOADER\" WIDTH=0 HEIGHT=0 STYLE=\"border:0\"></IFRAME>";
            f=window.frames["JVMLOADER"];
            f.document.open("text/html");
            var iframeHTML="";
            iframeHTML+="<HTML><BODY SCROLL=NO STYLE=\"margin:0\" >";
            iframeHTML+="<APPLET WIDTH=0 HEIGHT=0 ";
            iframeHTML+=" CODE = \"java.applet.Applet\" ";
            iframeHTML+="</APPLET>";
            iframeHTML+="</BODY></HTML>";
            f.document.write(iframeHTML);
            f.document.close();
       }
       if(f.document.applets.length==0)
       {
            setTimeout("loadJVM()",2000);
            initJVMCount++;
            return;
       }
     
       // Workaround for Safari 3.0.4 embeded code crash windows XP with safari ?!
      if(navigator.userAgent.toUpperCase().indexOf("SAFARI")==-1)
       {
            try
            {
                 if(!f.document.applets[0].isActive())
                 {
                      setTimeout("loadJVM()",500);
                      initJVMCount++;
                      return;
                 }
            }
            catch(e)
            {
                 setTimeout("loadJVM()",500);
                 initJVMCount++;
                 return;
            }
       }
       jvmInited=true;
       f.document.open("text/html");
       var iframeHTML="";
       iframeHTML+="<HTML><BODY SCROLL=NO STYLE=\"margin:0\" >";
       iframeHTML+="</BODY></HTML>";
       f.document.write(iframeHTML);
       f.document.close();
  }
 


Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2007-12-03 21:54:27 »

XP SP2 / Opera 9.22 / Sun 1.6: works.

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

JGO Knight


Medals: 2
Projects: 10


I'm Dragonene on IRC.


« Reply #2 - Posted 2007-12-03 22:02:17 »

XP SP2, Opera 9.5 beta - works. Cool stuff.

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

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #3 - Posted 2007-12-03 22:57:45 »

Very nice.

Works on IE7 on Windows XP SP2 with SUN JRE 1.6

Offline DzzD
« Reply #4 - Posted 2007-12-03 23:01:08 »

An other layout, same applets but only one display window

http://demo.dzzd.net/JScripts/index2.htm

Offline brackeen

Junior Member





« Reply #5 - Posted 2007-12-04 00:20:43 »

Looks good in IE, Firefox.

No go on Safari: TypeError: Undefined value (http://demo.dzzd.net/JScripts/3DzzDAppletScript.js line 136)

On Firefox it looks like it might have the same "white flash" issue that the pulpcore.js loader has (it's obvious if the page background is black). I've been trying to find a workaround, but haven't found one yet.

Offline jojoh

JGO Knight


Medals: 5
Projects: 7


games4j.com


« Reply #6 - Posted 2007-12-04 00:43:07 »

Very nice <2sec. freeze on ff 2.0 first load and instant thereafter.
IE6 got some repaint problem when I clicked "Click to start applet 1" (after the initial load and before the spinning loading image).Problem gone second time around.

Win XP, Java 1.6

Just about as good as the milpa loader and way better than the normal loader. Wish something like that this would be a part of the normal java applet.
So it looks like this could be a generic "wrapper" around any applet. What Java versions does it support?

Nice particle effects as well  Smiley

Offline DzzD
« Reply #7 - Posted 2007-12-04 00:43:13 »

Looks good in IE, Firefox.

No go on Safari: TypeError: Undefined value (http://demo.dzzd.net/JScripts/3DzzDAppletScript.js line 136)
Hum i have done some improvments if possible please give it another try with safari as now the line number is no more valid :-(, also I will add a "fallback" if any problem happen in loading applet it will first be loaded old way but still at the right pos and if it doesn't works it will be opened in a popup in a way even more older without dynamic html inside.

Quote
On Firefox it looks like it might have the same "white flash" issue that the pulpcore.js loader has (it's obvious if the page background is black). I've been trying to find a workaround, but haven't found one yet.
hum doesn't come from applet itself ? dont really see what you mean could you give me more info ?

PS: I also add a fourth applet

Offline DzzD
« Reply #8 - Posted 2007-12-04 00:46:30 »

Quote
What Java versions does it support?

all JVM version including Microsoft JVM,

It is full JavaScript and does not requiere applet modifications (the only requierment is that applet dont crash with a width and height equals to zero and take care of resizing)

Offline brackeen

Junior Member





« Reply #9 - Posted 2007-12-04 02:17:18 »

Hum i have done some improvments if possible please give it another try with safari as now the line number is no more valid :-(
Same issue, still on line 136. In Safari it just says on the loading pacifier. Happens in both Mac and Windows versions of Safari.

As for the Firefox "white flash" issue, i've been this on Windows. It is more obvious If your page is black and your applet is painted black. You will see a "white flash" where the applet is a split-second before Firefox shows the applet. It doesn't always happen on my machine - about 1 out of 5 times - so you have to reload a bunch of times to see it. I found a workaround for pulpcore.js but it inserts a 1-second delay before showing the applet, and I want to try to avoid that extra delay.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline JonathanC

Senior Newbie





« Reply #10 - Posted 2007-12-04 03:26:03 »

Works great here. Good job.
Offline DzzD
« Reply #11 - Posted 2007-12-04 03:39:34 »

Quote
Same issue, still on line 136. In Safari it just says on the loading pacifier. Happens in both Mac and Windows versions of Safari

I tried a fix, you may give it another try , hop it will works this time... Undecided

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #12 - Posted 2007-12-04 06:11:59 »

This stuff doesn't really fix anything. It still hangs, its not even a loader.
Don't get me wrong, I appreciate your efforts, but showing an animated gif while an applet is being loaded hardly solves anything.

The real fix is installing an applet splash screen loader as soon as possible, and doing some fancy smancy stuff. However this doesn't fix the orangy java loader thingy (which you have "replaced" with a gif).

Offline thijs

Junior Member




Lava games rock!


« Reply #13 - Posted 2007-12-04 08:03:26 »

Quote
This stuff doesn't really fix anything. It still hangs, its not even a loader.
Don't get me wrong, I appreciate your efforts, but showing an animated gif while an applet is being loaded hardly solves anything.

The real fix is installing an applet splash screen loader as soon as possible, and doing some fancy smancy stuff. However this doesn't fix the orangy java loader thingy (which you have "replaced" with a gif).

It might not really solve any technical issues (we have to wait for the new lightweight JVM for that), but as the previous comments show, it's all about the user expirience. Because the JVM is initted with a small class it hangs only for a very brief period... which is better than the 10 seconds+ I'm getting at the average applet. Dynamically loading a new applet without leaving / refreshing the page is a welcome feature too. Hiding the hideous Java splash may be a no brainer, but it is something you need to take care of... Hopefully using a "standarized" little JS lib all applet developers will adopt this. Maybe making Java applets (initial) appearance on the par with Flash.

<a href="http://www.dzzd.net">3DzzD!</a>
<a href="http://www.arcazoid.com">Arcazoid!</a>
Offline brackeen

Junior Member





« Reply #14 - Posted 2007-12-04 08:59:52 »

Quote
The real fix is installing an applet splash screen loader as soon as possible, and doing some fancy smancy stuff.
So, you're talking about making, say, a tiny Bootstrap.jar which would show a fancy shmancy splash, with a progress bar, while the main game jars are downloaded? Unfortunately that requires creating a custom classloader, or doing other classloader tricks that you can't do with the default applet permissions.

You can, however, keep game assets (not classes) in an external jar and show a fancy shmancy splash while those are loading.

Offline DzzD
« Reply #15 - Posted 2007-12-04 11:00:38 »

The real fix is installing an applet splash screen loader as soon as possible, and doing some fancy smancy stuff. However this doesn't fix the orangy java loader thingy (which you have "replaced" with a gif).
?? dont really understand what you think...  are you sure you know what you are talking about ??

basically it load JVM in memory using an applet with code=java.applet.Applet as

1  
2  
3  
<APPLET WIDTH=0 HEIGHT=0 
 CODE = "java.applet.Applet"
</APPLET>


this is the faster way to make JVM initialisation as low as possible

than once JVM is initialised, It allow loading Applet with another splash screen than the default one (grey area for MS and different animation fo SUN (an animated gif in my case a we dont know about time that would be spent), once applet is activated it resize and show it.

What it help in is to make a "near smooth" loading of applet that look a lot better than a simple applet tag, also it is full JavaScript and doesn't requiere applet modifications.

It also help as there is no need to "click to activate control" ....

EDIT:
It also try to load jar and class in browser cache using JavaScript.....

so basically it help a lot ?! dont really understand your comment...

Offline thijs

Junior Member




Lava games rock!


« Reply #16 - Posted 2007-12-04 11:06:11 »

Quote
You can, however, keep game assets (not classes) in an external jar and show a fancy shmancy splash while those are loading.

Another tip when using that approach: For downloading jar files this would mean they wont get cached (the plugin seems to refuse to cache any other extension than .class). A workaround is to rename your .jar to .class, download it over an urlconnection with setUseCache(true) and read its contents at runtime as zip file. It's a bit hairy and unfortunatly it doesn't allow you to read progress while downloading a .class file (due to a crappy implementation from Sun)

<a href="http://www.dzzd.net">3DzzD!</a>
<a href="http://www.arcazoid.com">Arcazoid!</a>
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #17 - Posted 2007-12-04 11:59:56 »

The problem with this approach - though it improves the user experience and is generally usable - it still hasn't fixed anything. It's all smoke and mirrors to hide the issues.

A proper solution requires the following:
1 - JVM initialization must not lock down the browser
Will be fixed by sun in the new Plugin architecture, afaik

2 - JVM Initialization must allow control over the 'Java Loading' process instead of showing generic Java logo
Somewhat fixed with special attributes - this is a chicken and egg issue since Ideally we'd like to run custom code - which isn't loaded yet...

3 - Fast loading of JVM
"Solved" with the new Java Quickstart - available in Update N

4 - Run code as early as possible
This should run the bootstrap stuff that will create a nice splashscreen and transition to the actual content. Ideally this is pluggable, but currently this isn't possible due to security reasons. Due to this security issue, we now have to wait for all of the code to load before running any code at all.

1,2,3 can be fixed by Sun.
4 is a bit more tricky. Maybe it should be possible to specify bootstrap jars or something like that.

Offline DzzD
« Reply #18 - Posted 2007-12-04 12:20:58 »

Quote
....Will be fixed by sun in the new Plugin architecture, afaik...
.... Fast loading of JVM...
yup but there will still be some user who dont have the lastest JVM with the lastest CG card and the lastest computer.... etc...

Quote
JVM Initialization must allow control over the 'Java Loading' process instead of showing generic Java logo
logo are always differents depending on JVM vendor and version, this tool help you put your own

Quote
Run code as early as possible
already possible, depend on how your make your applet.... you can simply load the smalest part you need than do dynamic loading for all others...

anyways, this script allow custom splash ans quite smooth loading looking as flash) without applets modification and works with all JVM, and I dont want to wait for JVM version 12.... and have to make different Applet implementation depending on user JVM version.

Quote
it improves the user experience and is generally usable

this is the most important !!! every programmers have to keep it in mind! and if you can do that with most user including user that dont upgrade there JVM every day so it is the way to go.

NB: the animated gif is 2k so it is imediatly load even with a 56k modem

Offline jojoh

JGO Knight


Medals: 5
Projects: 7


games4j.com


« Reply #19 - Posted 2007-12-04 14:49:08 »

It's all smoke and mirrors to hide the issues.

Well, what do you suggest? What is the best approach if you want to compete with your applet games against a flash site? Applets have a bad rep (compared to flash) because of browser freezing, ugly/non customized splash screen, and ofter ugly looking games. The last one can naturally only be fixed by constantly creating nice looking applet games. The first two only seems possible to fix with this/milpa approach. This approach also seems generic which is great. I agree that it would be great if sun would eradicate the problems, and it seems like there is some good progress, but it will still be some time until we can take advantage of that.

... hardly solves anything...

Agree with Thijs response. This example pretty much could have fooled any browser gamer into not realizing that it is an applet starting and that means that the major issue actually is solved. Replace the rotating image with a game co logo and anyone would be fine with starting a game like that. Unfortunately we still pretty much have to hide the fact that it is a java game for ppl to test them. If this is simple enough to use and works well, then maybe enough devs will use it and applet will become more mainstream and it will be easier for us to get our applet games out there.

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #20 - Posted 2007-12-04 14:55:38 »

Well, what do you suggest?
I suggested 4 things already...

Agree with Thijs response. This example pretty much could have fooled any browser gamer into not realizing that it is an applet starting and that means that the major issue actually is solved.
How do you fool someone when the applet you're delivering is 2-3MB, try his stuff with that... You will be looking at a boring gif for a long time...

Offline DzzD
« Reply #21 - Posted 2007-12-04 15:11:26 »

Source code updated (I introduced a MSJVM bugs while trying to resolve a bug appening in safari browser), it is now resolved new version works with MSJVM

anyone able to test Safari browser ?

Quote
I suggested 4 things already...
Your suggestion sounds like saying everybody all over the world to "download & intall lastest JVM" ?

Quote
How do you fool someone when the applet you're delivering is 2-3MB, try his stuff with that... You will be looking at a boring gif for a long time...

3DzzD Applets use ressource up to 10 meg... and it works... it just load them at runtime...(as JOGL>1meg, or textures or 3D files) what append if you try to insert a 4gb picture or HTML source code in your website ? it hang.... same for applets, you should not start with a too big class, this is true in any program and any language.

How you can make applet with a 2MB size ? if so you are includiing ressource files in jar wich is for me a wrong way, you should load it at runtime than you are able to show whatever you want while loading. as said above main/base classes must be as little as possible, same for html same for everythings.... an html is first loaded and once loaded image are loaded, Web software should not be made as CD software.

I will put a quake level applet sample able to use JOGL ( about 6meg for the whole stuff 5meg for 3d & 1meg for jogl) online showing that the system is able to not hang even with big downloads.



Offline thijs

Junior Member




Lava games rock!


« Reply #22 - Posted 2007-12-04 15:39:01 »

How do you fool someone when the applet you're delivering is 2-3MB, try his stuff with that... You will be looking at a boring gif for a long time...

Well an applet that big has probably many resource files, which like Brackeen and I pointed out can be downloaded at runtime. Unfortunatly using the caching trick its not possible to display actual progress but at least you'll be able to show something different and more interactive than an animated gif.

EDIT:
In Dzzd we can also stream certain resources, so the applet can start earlier while loading resources not needed right away in the background

<a href="http://www.dzzd.net">3DzzD!</a>
<a href="http://www.arcazoid.com">Arcazoid!</a>
Offline DzzD
« Reply #23 - Posted 2007-12-04 16:51:21 »

Source code updated, add message when unable to start applet also ask the user to install java if unable to detect any JVM

next step will be to make the whole stuff configurable (LOGO,message,...), please continue to feedback about bugs or other ...

Offline DzzD
« Reply #24 - Posted 2007-12-04 19:01:26 »

Source code updated, now works with Safari 3.0.4 windows XP

anyone able to test:
Mac + IE ?
Linux ?

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #25 - Posted 2007-12-04 19:26:10 »

you can easily have a big jar file without resources - and then this doesn't really work. It mitigates it a bit, but it doesn't really fix it.

Offline brackeen

Junior Member





« Reply #26 - Posted 2007-12-04 19:37:05 »

Works on Safari/Mac, too.

I agree, there is no way to get the ideal solution given the current restrictions. Best you can do within the limits of the sandbox is have the two-stage load:

Stage 1: show animated gif while the JVM and jar is loaded. (note, the Java plugin- "image" attribute splash isn't shown until the JVM is loaded, and it can't be animated)
Stage 2: show fancy shmancy loading splash while assets are downloaded.

This solution is best if your code isn't too big, and you've got a sizable chunk of assets.
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #27 - Posted 2007-12-04 19:47:03 »

So, you're talking about making, say, a tiny Bootstrap.jar which would show a fancy shmancy splash, with a progress bar, while the main game jars are downloaded? Unfortunately that requires creating a custom classloader, or doing other classloader tricks that you can't do with the default applet permissions.

You can, however, keep game assets (not classes) in an external jar and show a fancy shmancy splash while those are loading.

Do you really need a custom classloader?  Can't you just use the URLClassLoader?  I made a post on GameDev about this.  Can you read and tell me what you think?

http://www.gamedev.net/community/forums/topic.asp?topic_id=474026

Offline brackeen

Junior Member





« Reply #28 - Posted 2007-12-04 20:17:41 »

Do you really need a custom classloader?  Can't you just use the URLClassLoader?  I made a post on GameDev about this. 

Yeah, just to instantiate URLClassLoader requires the "createClassLoader" permission, not given to applets. If you did have the permission, though, a custom class loader would be better because you could track the progress of the download, for the sake of a progress bar.
Offline thijs

Junior Member




Lava games rock!


« Reply #29 - Posted 2007-12-04 20:45:42 »

you can easily have a big jar file without resources - and then this doesn't really work. It mitigates it a bit, but it doesn't really fix it.

Maybe an applet that big should really be an application. Like brackeen mentioned it's not really possible given the sandbox restrictions. The only solution would be to have the applet signed and download / cache the files when / where needed.

Do you really need a custom classloader?  Can't you just use the URLClassLoader?  I made a post on GameDev about this.  Can you read and tell me what you think?

http://www.gamedev.net/community/forums/topic.asp?topic_id=474026

Anything that touches classloaders needs privileges outside of the sandbox. It is however possible to make an minimal bootstrap applet (unsigned) that loads up quickly using a JS loader like Bruno & brackeen presented, and have it load a signed class at runtime. The advantage would be you'd have a quick booting applet in which you can show progress and also tell the user about the security message it's about to see (for example to tell them why its required). Then have the user click ok and start the signed class which will start the actual downloading of the (big) applet. Something similar as I posted here:
http://www.java-gaming.org/forums/index.php?topic=16911.msg135173#msg135173

<a href="http://www.dzzd.net">3DzzD!</a>
<a href="http://www.arcazoid.com">Arcazoid!</a>
Pages: [1] 2
  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.

atombrot (23 views)
2014-08-19 09:29:53

Tekkerue (22 views)
2014-08-16 06:45:27

Tekkerue (21 views)
2014-08-16 06:22:17

Tekkerue (12 views)
2014-08-16 06:20:21

Tekkerue (19 views)
2014-08-16 06:12:11

Rayexar (57 views)
2014-08-11 02:49:23

BurntPizza (37 views)
2014-08-09 21:09:32

BurntPizza (29 views)
2014-08-08 02:01:56

Norakomi (36 views)
2014-08-06 19:49:38

BurntPizza (66 views)
2014-08-03 02:57:17
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!