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

2022/8/20

Export HTML5 conversion of a game locally..?

shoe shoe

2022/8/20

#
I would like to export the HTML5 which is normally created when I upload a game, locally? I would like to have a look at the Javascript. How is the conversion Java->HTML5 done? Is this functionality homegrown Greenfoot from the ground up, or do you use some libraries doing most of the complex stuff in the background?
RcCookie RcCookie

2022/8/20

#
From what I have observed, the JavaScript conversion takes place on the Greenfoot Server. Because, if you upload your scenario it will not be available immediately because the conversion is not yet done. You can of course inspect the JavaScript from the debug console in your browser, but you may as well download the whole js file directly. Greenfoot uses a tool called „TeaVM“ for conversion, it’s not self-written.
shoe shoe

2022/8/24

#
Thanks. It would be great if the people behind Greenfoot could open source that conversion code, so people could use it locally.
RcCookie RcCookie

2022/8/25

#
TeaVM itself can be used pretty easily with Maven. If you want to get the script they use in Greenfoot, I guess you can write them an email (support@greenfoot.org is the only one I can think of). I have personally never received a reply, but at least once they did seem to take action after an email. You can also hope they read this but I highly doubt it.
rdFx rdFx

2022/8/25

#
Here you go: TeaVM Website: http://www.teavm.org/ GitHub Project: https://github.com/konsoletyper/teavm GitHub Repo: https://github.com/konsoletyper/teavm.git
nccb nccb

2022/8/25

#
We do read the forums, we're just busy with many projects :-) The commenters here are correct, we use TeaVM. The source code for our part is not currently public, and it's a library used by our webserver rather than a standalone program. If I remember right the main extra bit beyond just calling TeaVM is that we have to have a Javascript implementation of the full Greenfoot API to implement the graphics and keyboard/mouse input. I think at the time we didn't worry much about making this tool available standalone because we didn't really want to directly support it, and the same effect can be achieved by uploading it to the website then downloading the scenario or embedding it elsewhere. That doesn't cover the case where you don't want the scenario public, admittedly. I'll make a note about releasing the source if we get time.
tmhscs tmhscs

2022/8/25

#
If you do get the chance, I would really love the ability to make private scenarios and to see the source code and fully understand that it isn't cleaned up or fully supported. Please find a little time for it if you can!
RcCookie RcCookie

2022/8/29

#
Nice to see that these are actually some people active ö behind the scenes
You need to login to post a reply.