This site requires JavaScript, please enable it in your browser!
Greenfoot back
davmac
davmac wrote ...

2017/7/26

Javascript (HTML 5) conversion of scenarios

davmac davmac

2017/7/26

#
(Previous discussion on this here). As many of you are aware we have been working on automated translation of scenarios from Java to HTML5/Javascript. Although I've been quiet about this for a number of weeks this is still progressing. We have now added a "HTML5 version" link below all scenarios for which the translation process was able to produce Javascript - although in many cases the HTML 5 version may still not work correctly. At some point soon, we plan to show the HTML 5 version of scenarios by default. The original Java applet version will still be accessible via a link (or will be shown when no Javascript version was able to be created for whatever reason). So, if you haven't tried out the new functionality yet, now would be a good time to do so - in particular, it would be good if you can check that your scenarios work and report any that you think should be working but which aren't. As per the previous post on this topic there are some known issues, so please check this list before reporting anything:
  • sounds do not stop playing when scenario resets
  • some scenarios cannot be reset properly
  • UserInfo isn't working at all, yet (but an imminent update will fix that)
Also be aware that:
  • if you report a problem we need to know exactly what is causing it. Either the source code should be available (you can send it to us privately rather than publishing it, if you prefer) or you should be able to identify precisely what is not working.
  • use of AWT/Swing/JavaFX in scenarios is not supported at all (and won't be).
  • not all of the Java API is available. If you need particular classes/methods that don't seem to be available, you can request it here. The full API will probably never be supported, but a good subset should be available.
  • some browsers are not supported. Older versions of Internet Explorer will likely not work (use 10 as a minimum). Firefox, Chrome and Safari are the primary targets - they should work well.
  • some browsers may not be able to play all sound formats. In particular, mobile browsers might not play MP3 files. Internet Explorer does not appear to play WAV files.
Thanks!
davmac davmac

2017/7/31

#
UserInfo should now be working. With the exception of the minor issues listed above, and some missing parts of the Java API, most scenarios should now work fine. Once again, please speak up if you find issues! At some point soon the HTML 5 version of a scenario (if available) will become the one that is shown by default.
Super_Hippo Super_Hippo

2017/7/31

#
It looks pretty similar already, good job! What I noticed in my Pac Man Game is that 1. Points are showing in the highscore table, level aren't. The list is there, but the field where the level should be is empty. 2. Fading in/out doesn't work (maybe something is wrong with displaying transparency?). It is opaque (= screen is black) when it should be changing from one state to the other. 3. I can see dots through ghosts. I didn't explicitly set the paint order for them (only the Fade.class should be above all others), but the dots are created first and the ghost don't have transparent parts in their images (other than at the border of the image), so the dots should be invisible while a ghost is moving over them. Tested with Edge and IE 11, both look the same (I think). And there is no link in the HTML5 page to go back to the "normal" version. Another issue is that one can manually change the speed of the scenario even if it was not allowed when exporting. This could affect some scenarios especially ones with high scores.
davmac davmac

2017/8/1

#
Thanks for the feedback!
Points are showing in the highscore table, level aren't
Ok, I've found the bug which causes this. It will be fixed soon. I'm looking into the other issues, too. Technically:
I didn't explicitly set the paint order for them (only the Fade.class should be above all others), but the dots are created first
You are not supposed to be able to rely on order of creation to define which objects get painted over which. However, in this case it appears that the ghost (and the pacman) have some transparency due to the way lines are rendered in a HTML 5 canvas. I'm trying to figure out how to adjust that.
davmac davmac

2017/8/3

#
All of the three main issues are solved now, and I've added a link back to the applet version of the scenario from the HTML5 version. It looks like there's a minor glitch with how the "lives" are drawn, which I still have to investigate, and the speed slider is still active, which I can correct soon.
dnishchhal dnishchhal

2017/8/7

#
Stuck on Initializing
davmac davmac

2017/8/7

#
dnishchhal wrote...
Stuck on Initializing
As per above:
davmac wrote...
if you report a problem we need to know exactly what is causing it. Either the source code should be available (you can send it to us privately rather than publishing it, if you prefer) or you should be able to identify precisely what is not working
As an absolute bare minimum, we'd need a link to the problematic scenario.
dnishchhal dnishchhal

2017/8/7

#
davmac wrote...
dnishchhal wrote...
Stuck on Initializing
As per above:
davmac wrote...
if you report a problem we need to know exactly what is causing it. Either the source code should be available (you can send it to us privately rather than publishing it, if you prefer) or you should be able to identify precisely what is not working
As an absolute bare minimum, we'd need a link to the problematic scenario.
http://www.greenfoot.org/scenarios/13572?js=true Here is the Link
davmac davmac

2017/8/7

#
Thanks. I'm looking into it now!
davmac davmac

2017/8/21

#
Super_Hippo wrote...
Another issue is that one can manually change the speed of the scenario even if it was not allowed when exporting
Fixed.
dnishchhal wrote...
http://www.greenfoot.org/scenarios/13572?js=true Here is the Link
Also fixed.
AuroraGamer AuroraGamer

2017/8/22

#
If awt isn't supported doesn't that render the ability to use the pre-made counter useless? Since it uses import java.awt.Font?
davmac davmac

2017/8/22

#
AuroraGamer wrote...
If awt isn't supported doesn't that render the ability to use the pre-made counter useless? Since it uses import java.awt.Font?
The Counter class included with Greenfoot 3.1.0 does not use java.awt.Font. It uses the greenfoot.Font replacement.
Yehuda Yehuda

2017/8/22

#
The greenfoot.Font class uses java.awt.Font.
AuroraGamer AuroraGamer

2017/8/22

#
The Counter class included with Greenfoot 3.1.0 does not use java.awt.Font. It uses the greenfoot.Font replacement.[/quote wrote...
Okay, I haven't updated in awhile
davmac davmac

2017/8/22

#
Yehuda wrote...
The greenfoot.Font class uses java.awt.Font.
The greenfoot.Font class is re-implemented for the HTML5 conversion and does not use java.awt.Font.
You need to login to post a reply.