Jump to content

  • Log In with Google      Sign In   
  • Create Account


Java applet lags on web


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Patriarch K   Members   -  Reputation: 212

Like
0Likes
Like

Posted 13 January 2013 - 12:17 PM

This is my first attempt of making an applet and it runs very smooth when I run it offline. But when I put it up on the web then every 3 seconds it lags and that is very annoying. I don't know if it's programming related or server related or anything since I'm new to applets.

Here is the link to my test game so that you can try it yourself and maybe you've seen similar stuff before and can give a hint since I have no clue.

Server related or programming related?

 

Here is the link:

http://epengweb.se/Rymd/Main.html



Sponsor:

#2 Dan Mayor   Crossbones+   -  Reputation: 1712

Like
2Likes
Like

Posted 13 January 2013 - 03:49 PM

Your question is a bit to vague without prior knowledge of what you are doing.  The immediate guess is that you could be loading resources off the server which take transmission time and that could be causing your lag (as locally it would be reading near instantly from disk).  It could be a particular browser's implementation of Java that is causing the problem (not quite as likely as Java is Java, it runs in the JRE the difference with browsers is that the rendering / input hooks are routed through browser bindings as opposed to direct control).

 

I'm sorry it's not a real answer but you will need to do some debugging of your own and find out what is actually causing the lag.  The easiest way I can think of is to create some logging system that you can record millisecond start and finish times of everything near the slow down.  Compare these start and finish times (giving you an idea of how long something takes) between online and offline versions and this should give you an incite to what is actually taking longer and causing the lag.

 

On a bit of a side note I should warn you that many people refuse to run java applets.  There was actually a recent "smear campaign" of sorts launched by Fox and NPR that warn's computer users to never trust Java applets as they expose security vulnerabilities that can lead to identity theft.  Although this is 100% true and has always been the case, trusting known providers of applets is ok to do.  The problem is your average web user won't trust you, and now that the mighty media has announced "Java is bad" we will see even less people actually allowing java applets to run.

 

My point?  You'r going to want to ditch your online java applet idea as it severely limits your potential audience.  Unless this is simply something you want for you and your friends you are shooting yourself in the foot proceeding down a path that we know most people won't accept and now even more will refuse.  If it's too late or this game simply can not be converted to either HTML 5 / Javascript or stand alone Java app you will want to adapt your design to allow the user to download and run the applet offline, however many browsers even while offline will still warn the user (stopping them from playing) that the applet shouldn't be trusted.

 

Sources:

    http://fox8.com/2013/01/11/homeland-security-warning-to-computer-users/

    http://www.npr.org/blogs/thetwo-way/2013/01/11/169156325/computer-users-should-disable-java-7-due-to-security-flaw-experts-say

    http://blogs.kqed.org/newsfix/2013/01/11/experts-warn-users-to-disable-widely-used-java-software/


Digivance Game Studios Founder:

Dan Mayor - Dan@Digivance.com
 www.Digivance.com


#3 SimonForsman   Crossbones+   -  Reputation: 5972

Like
0Likes
Like

Posted 13 January 2013 - 04:06 PM

<blockquote class="ipsBlockquote" data-author="Dan Mayor" data-cid="5021195"><p>Your question is a bit to vague without prior knowledge of what you are doing. The immediate guess is that you could be loading resources off the server which take transmission time and that could be causing your lag (as locally it would be reading near instantly from disk). It could be a particular browser's implementation of Java that is causing the problem (not quite as likely as Java is Java, it runs in the JRE the difference with browsers is that the rendering / input hooks are routed through browser bindings as opposed to direct control).<br /> <br />I'm sorry it's not a real answer but you will need to do some debugging of your own and find out what is actually causing the lag. The easiest way I can think of is to create some logging system that you can record millisecond start and finish times of everything near the slow down. Compare these start and finish times (giving you an idea of how long something takes) between online and offline versions and this should give you an incite to what is actually taking longer and causing the lag.<br /> <br />On a bit of a side note I should warn you that many people refuse to run java applets. There was actually a recent "smear campaign" of sorts launched by Fox and NPR that warn's computer users to never trust Java applets as they expose security vulnerabilities that can lead to identity theft. Although this is 100% true and has always been the case, trusting known providers of applets is ok to do. The problem is your average web user won't trust you, and now that the mighty media has announced "Java is bad" we will see even less people actually allowing java applets to run.<br /> <br />My point? You'r going to want to ditch your online java applet idea as it severely limits your potential audience. Unless this is simply something you want for you and your friends you are shooting yourself in the foot proceeding down a path that we know most people won't accept and now even more will refuse. If it's too late or this game simply can not be converted to either HTML 5 / Javascript or stand alone Java app you will want to adapt your design to allow the user to download and run the applet offline, however many browsers even while offline will still warn the user (stopping them from playing) that the applet shouldn't be trusted.<br /> <br />Sources:<br /> <a data-cke-saved-href="http://fox8.com/2013/01/11/homeland-security-warning-to-computer-users/" href="http://fox8.com/2013/01/11/homeland-security-warning-to-computer-users/">http://fox8.com/2013/01/11/homeland-security-warning-to-computer-users/</a><br /> <a data-cke-saved-href="http://www.npr.org/blogs/thetwo-way/2013/01/11/169156325/computer-users-should-disable-java-7-due-to-security-flaw-experts-say" href="http://www.npr.org/blogs/thetwo-way/2013/01/11/169156325/computer-users-should-disable-java-7-due-to-security-flaw-experts-say">http://www.npr.org/blogs/thetwo-way/2013/01/11/169156325/computer-users-should-disable-java-7-due-to-security-flaw-experts-say</a><br /> <a data-cke-saved-href="http://blogs.kqed.org/newsfix/2013/01/11/experts-warn-users-to-disable-widely-used-java-software/" href="http://blogs.kqed.org/newsfix/2013/01/11/experts-warn-users-to-disable-widely-used-java-software/">http://blogs.kqed.org/newsfix/2013/01/11/experts-warn-users-to-disable-widely-used-java-software/</a><br /><br /></p></blockquote>


Currently there is a known and not yet fixed security hole with Java applets so i wouldn't call it a smear campaign, it is very sound advice to deactivate your java browser plugins until it is fixed since hackers are exploiting it very activily at the moment(and often using legitimate sites to do so). I belive both Chrome and Firefox are blacklisting the Java plugin right now (so it is disabled by default).

Once the bug is fixed it will be reasonably safe to reactivate it. (The same goes for all browser plugins, if a serious security hole is found you should disable the plugin until it is fixed since website security tends to be crap and you never know if the site your visiting is safe)

Edited by SimonForsman, 13 January 2013 - 04:06 PM.

I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#4 Dan Mayor   Crossbones+   -  Reputation: 1712

Like
1Likes
Like

Posted 13 January 2013 - 04:22 PM

I may not have been particularly clear enough about what I meant with Java security vulnerabilities.  Java applets run outside the protection of the browser's "sandbox" environment which will give any and all applets access to your entire hard drive.  This is something that is not exactly a "flaw" of the design but can and will always be exploited to steal something.  Be it your contacts list (which is openly available if you have access to the hard drive), message archives, configuration files, personal settings, bookmarks (which can lead to easily finding personal information).  Java applets in themselves are dangerous ground and should never be trusted from sources that you don't know with or without a common or recently discovered "exploit".

 

With that, Simon you are right, this is all mentioning the latest of the security vulnerabilities and to those who understand what the real message is yes we can turn it back on later once the solution has been installed.  To the general public, it is my opinion that they will turn it off and never turn it back on (it's not like any sites they use require it, there's no need to turn it back on for the next potential security risk).

 

Yes I understand those with higher knowledge of the internet, browsers, computer security and what not CAN contradict what I'm saying but I'm not talking about you.  I'm talking more so about the masses, those people who know how to get to a web page and have no clue how it works.  Those people account for the greater majority of the world and trying to think of things that would cater to them opens a lot more potential than relying on the idea that people who know better will know better in time.  That is to say why should we ignore the phobia's of 70+% of potential players because 30% or so of people will know better and reactivate Java later?  This message is more so an idea / personal opinion related to the marketing and potential consumer numbers than it is on the actual technology and it's security (or lack there of).


Digivance Game Studios Founder:

Dan Mayor - Dan@Digivance.com
 www.Digivance.com


#5 Patriarch K   Members   -  Reputation: 212

Like
0Likes
Like

Posted 13 January 2013 - 04:41 PM

Hmm, intresting to hear about that. I've been reading about applets around the web and mostly I see that people don't really use it or like it, but it was worth a try. It has not taken a very long time to make this game (only 1-2 days) so it's not a big deal for me.
But if I wish to put my game on the internet on a web page. Would you suggest HTML5/Javascript then or what is the case? What do people use nowadays to put up stuff on the internet if they use Java? Or maybe they even don't use Java anymore?
And you mentioned Java App. I've only been making Java Apps before and that's why I wanted to try this thing with applet. Can you get a Java App up on the web or what am I supposed to do with that damned .jar-file?
I make a game and then it's finished but I can rarely get any use of the .jar because I can't put it on the net and I cant "sell" it and I can't put it on any web pages or anything. I can only let people download it and so on, but I myself have never downloaded a .jar-file and played it.

Edited by Patriarch K, 13 January 2013 - 04:45 PM.


#6 SimonForsman   Crossbones+   -  Reputation: 5972

Like
1Likes
Like

Posted 13 January 2013 - 05:27 PM

<blockquote class="ipsBlockquote" data-author="Patriarch K" data-cid="5021209"><p>Hmm, intresting to hear about that. I've been reading about applets around the web and mostly I see that people don't really use it or like it, but it was worth a try. It has not taken a very long time to make this game (only 1-2 days) so it's not a big deal for me.<br />But if I wish to put my game on the internet on a web page. Would you suggest HTML5/Javascript then or what is the case? What do people use nowadays to put up stuff on the internet if they use Java? Or maybe they even don't use Java anymore?<br />And you mentioned Java App. I've only been making Java Apps before and that's why I wanted to try this thing with applet. Can you get a Java App up on the web or what am I supposed to do with that damned .jar-file?<br />I make a game and then it's finished but I can rarely get any use of the .jar because I can't put it on the net and I cant "sell" it and I can't put it on any web pages or anything. I can only let people download it and so on, but I myself have never downloaded a .jar-file and played it.</p></blockquote><br />Look into Java WebStart instead, it lets your user download and launch a normal java application from the browser, alternativly you can make a .exe launcher for it and distribute your game as a normal downloadable application. (For *nix its normally fine to distribute the jar as it is, its just on Windows that jar files can be problematic (software such as Winrar likes to hijack the .jar extension which makes them a pain to run)
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#7 Marques   Members   -  Reputation: 210

Like
0Likes
Like

Posted 13 January 2013 - 06:34 PM

Hi only recently came across these java exploit when I got "System Progressive Protection - Virus" on my computer a couple of days ago. I suspect it was because I was using one of the version that susceptible to these exploits which btw the are Java version 5,6,7. 

 

However I was also wondering if these exploits also include JavaME and Android. Does anybody know this?



#8 Dan Mayor   Crossbones+   -  Reputation: 1712

Like
0Likes
Like

Posted 13 January 2013 - 08:48 PM

I feel a little bad that this topic seems to have threaded off into a discussion on the security of Java and applets.  Patriarch K has since asked about using HTML and Javascript to get a game running inside a web browser.  I would like to apply my opinion to this question as well and in short say yup that's the answer.  I'm sure many will chime in mentioning Flash being an easier or better alternative however I have to respectfully disagree.  Flash requires browser plugins (granted most people already have it installed and it's not a concern) but this is another one of those things where we are depending on the upkeep of a third party piece of software to power your game.  A third party piece of software that has been riddled with it's own security vulnerabilities, flaws and hassles since it's inception years ago.  Just like with Java, flash goes through many issues where hackers find a vulnerability, exploit it, industry reporters go in to an uproar and try to cause a panic, Adobe fixes the problems and all is ok....  It's not all that much different from java less the difference that it is a different language and vm platform of sorts.

 

Also a key point to note being against Flash is that modern mobile devices do not support it, and although on going talks have been occurring for over a year now on Apple and windows phone building some form of secured support for flash it's not very likely we will see this any time soon (if ever).  The safer alternative is to jump on the HTML 5 and Javascript band wagon.  This extends your portability to pretty much every single device in the world that has a web browser.  Most if not all web browsers that potential players will use have safe and secure javascript implementations and parser's and are constantly working on upgrading it's performance.  Most recently with HTML 5 surface elements being tied to the underlying hardware rendering systems we have seen quite a surge of powerful capabilities on web pages (in my opinion surpassing Flash).  I believe that it would be in your best interests to focus more on HTML 5 and Javascript if you want a browser based game.  It's rare (if ever) that these fear campaigns show the untrained users that there are security vulnerabilities (and in the case of mainstream browsers there simply are NOT javascript vulnerabilities that could ever expose your personal information).  Knowing this you won't have to worry about people being scared out of trying your game because someone else found a weakness in technologies that you use.  However this will require a vastly different approach to your design, the same things that make Javascript safe across all platforms are the same things we as developers have to work around (such as no access to the local file system).  If your game needs to save files for any reason you will also want to look into either Cloud API, web storage service API or learn a bit of a server side scripting language to give you somewhere to actually save and load files from.


Digivance Game Studios Founder:

Dan Mayor - Dan@Digivance.com
 www.Digivance.com


#9 Patriarch K   Members   -  Reputation: 212

Like
0Likes
Like

Posted 14 January 2013 - 05:07 AM

Thank you for a very detailed answer to my question. Though I wonder a little bit about HTML5 and JavaScript. Can I somehow use my existing Java code and apply it to HTML5/JavaScript. I know nothing about those "langugages" so I feel a little bit lost. Or is it more that I have to remake the code from scratch learning a new "langugage" from scratch?

 

Also Java WebStart sounds interesting to me. I have to check it out since I have a relatively "big" game as a .jar that I've made before that I would like to use without changing the code.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS