GLBasic forum

Main forum => GLBasic - en => Topic started by: Bluepixel on 2019-Nov-26

Title: Compiling to html5?
Post by: Bluepixel on 2019-Nov-26
Hi there, i am working on a small site and i was planning on releasing some games on there, so i was wondering if i could still export to html5, however, after i compiled the program i only got a dummy html file, and an empty distribute folder.

Is it still possible to export to html5 or am i doing something wrong?
Title: Re: Compiling to html5?
Post by: Kitty Hello on 2019-Nov-28
V16 does a good job for me. GACK compiles and runs fine.
Title: Re: Compiling to html5?
Post by: MrPlow on 2019-Nov-28
I was curious and just extracted HTML.7z to platform folder and got an empty folder and message in compiler window

So I an assuming I missed some steps to install this emscripten thingy?


%EMSDK% is set, or SDK is not installed or can't be found at:
C:\Program Files\Emscripten
Get and install the (prebuilt) SDK from: https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html-----------------------------------------

'emsdk_env.bat' is not recognized as an internal or external command,
operable program or batch file.
'em++.bat' is not recognized as an internal or external command,
operable program or batch file.
Title: Re: Compiling to html5?
Post by: spacefractal on 2019-Nov-28
V16 does a good job for me. GACK compiles and runs fine.

its isent released. plan to release a beta. Steam has a beta labal to do it. Im wish how well its compile Greedy Mouse, which use a lots of Polyvectors in that game.
Title: Re: Compiling to html5?
Post by: Kitty Hello on 2019-Nov-29
Oh. I should do that. I'm sorry.
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Jan-31
i'm getting error when compile in html5 with 16.252:

"%EMSDK% is set, or SDK is not installed or can't be found at:
C:\Program Files\Emscripten
Get and install the (prebuilt) SDK from: https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html"

I need to install SDK of  Emscripten?
Title: Re: Compiling to html5?
Post by: Kitty Hello on 2020-Feb-11
Yes. Do the installers still exist?
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Feb-12
I have to compile sdk and it's not easy. For now I have downloaded it and you have to understand how to proceed
But are you sure there is no easier way?
Title: Re: Compiling to html5?
Post by: dreamerman on 2020-May-04
Which files I need to edit/configure to compile for html5 now, or any tool needs to be in specific path or something? I've installed latest versions of Git, Emscripten, Python (in some custom path to avail possible ProgramFiles and similar issues) they can be launched from system cmd and so on, but whole time I get some errors, either one or another tool isn't supposedly in proper path.. Does this target is configured to use current distributions of needed tools, as for example for emscripten it looks on some bat/exe in main emsdk directory but tools are in corresponding sub directories. ofc. I've tried to edit some *bat's in platform path to force proper working directories but neither of them has impact on result.
Beside that HTML5-WebGl target is working, or more precisely does it have some restrictions, as in previous versions of GLB it wasn't capable of compiling project that use RenderToTexture / PolyVectors stuff.

Title: Re: Compiling to html5?
Post by: dreamerman on 2020-May-23
Those *.bat files in platform/HTML5 are either not used for build or are for building GLB lib itself or something if I understand correctly, proper build file is 'compile_html5.bat' that's generated during compilation in 'temp\glbasic', this can be edited to set proper path for emscripten and that will work.
But there are other issues, first is that 'OUTLINING_LIMIT' setting is deprecated and not used in current emscripten, second thing, prebuilt / included GLB/HTML5 libraries were made with older version of emscripten, if You will try to use them on latest public version an error 'machine type must be wasm32' will appear, and compilation will stop.
Still there are those warning about multi brackets (()) and using == comparison instead of ===, but those can be ignored with some compiler switches.
It would be great if those critical errors could be fixed so HTML5 would be available again.
Title: Re: Compiling to html5?
Post by: Qedo on 2020-May-31
I use version 16, currently 16.508, but I also hold on to version 15.238 which compiles Android (without Android Studio) and Html5 without problems.
Ad maiora
Title: Re: Compiling to html5?
Post by: dreamerman on 2020-Jun-07
Hey, Qedo but what version of Emscripten and Python are You using? That's the issue.
As I mentioned, html5 target in GLB was set to use old versions of those tools (from couple years ago), and it just won't work on their current versions. So in short - You have small chances to get it working on fresh machine, or do a lot of digging to found proper old binaries, and other thing, it would be beneficial to use newest versions with all possible fixes, optimizations and so on.. Do fresh installation of emscripten, latest python and all other tools that are needed and You will see that it just doesn't work, with all issues mentioned in previous my post. :/
I would really like to have this as it's much easier to show possible demos for wider audience.
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Jun-07
Hi dreamerman first of all thanks for the reply.
Forgive me, however, it is not clear what you write or it is I who do not understand.
Do you need the latest versions of Emscripten and Python to make Html5 work?
Or are previous versions needed?
However, when I installed Html5 for V15 of GLB I started by downloading the JavaScript.7z file from the download folder http://www.glbasic.com/platform/v15/ and there is also the whole installation of Emscripten inside.
I copied the unzipped files in the local \GLBasic_v15\Compiler\platform\ folder and that's all I did and it worked.

Instead for the GLB V16 it seems to me different because in download, at http://www.glbasic.com/platform/v16/, I find HTML5.7z that I unzipped and I inserted in \GLBasic_v16\Compiler\platform\ But there is no Emscripten files. Is this the problem and if so, how can this be remedied?
Is there any further procedure to do? Launch some batch files?
However, I do not find any informstion that helps to understand and it seems a big lack.
Thanks again.
Ad maiora
Title: Re: Compiling to html5?
Post by: dreamerman on 2020-Jun-12
Yeah, I could be more precise and write some background for it as You did :-)
So generally in v15 everything for html5 target was in one package, just unpack, instal some Java SDK and it's ready to go.. emscripten was included, no separate tools.
But v16 package contains only few config and *bat files that from what I understand are configured to work with proper emscripten installation in system - that needs to have python, git and possible other tools installed. Didn't saw any special info about that html5 target so I assumed that now proper way to use that target is to have all those tools installed in normal way as they should be. And here fun begins, as mentioned in previous post various problems appear during that - config files set for older emscripten installations, and GLBasic lib itself built with old commands.
Maybe my assumption was wrong and I need to copying v15 Javascript.zip platform to current v16 directory
and do some reconfiguration or something, really I don't know as I didn't found any info about that, or I missed something :/
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Jun-13
thanks, but the question is: does html5 on v16 work?
and if someone works, how did he do it?
 :x
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Jul-28
Hi all.
update to try to fix the HTML5 problem (missing emscripten for version 16.508).
I downloaded the latest version of emscripten from:
https://emscripten.org/docs/getting_started/downloads.html

and I created a folder C: \ Users \ Qedo \ Desktop \ emsdk-master where I unzipped the zip
then I ran the following three commands from cmd
1) C: \ Users \ Qedo \ Desktop \ emsdk-master> emsdk install latest
2) C: \ Users \ Qedo \ Desktop \ emsdk-master> emsdk activate latest
3) C: \ Users \ Qedo \ Desktop \ emsdk-master> emsdk_env.bat
unfortunately the automatic setting of the 5 Setting environment variables (EMSDK, EM_CACHE, EMSDK_PYTHON, JAVA_HOME) did not work and therefore I added them manually.
At this point I ran "Build Multiplatform - Html5" from GlBasic where the * .js file is generated but not the * .html file with the following output:

compile + link:
Adding directories to PATH:
PATH + = C: \ Users \ Qedo \ Desktop \ emsdk-master
PATH + = C: \ Users \ Qedo \ Desktop \ emsdk-master \ upstream \ emscripten
PATH + = C: \ Users \ Qedo \ Desktop \ emsdk-master \ node \ 12.18.1_64bit \ bin
PATH + = C: \ Users \ Qedo \ Desktop \ emsdk-master \ python \ 3.7.4-pywin32_64bit
PATH + = C: \ Users \ Qedo \ Desktop \ emsdk-master \ java \ 8.152_64bit \ bin

Setting environment variables:
EMSDK = C: / Users / Qedo / Desktop / emsdk-master
EM_CONFIG = C: \ Users \ Qedo \ Desktop \ emsdk-master \ .emscripten
EM_CACHE = C: / Users / Qedo / Desktop / emsdk-master / upstream / emscripten \ cache
EMSDK_NODE = C: \ Users \ Qedo \ Desktop \ emsdk-master \ node \ 12.18.1_64bit \ bin \ node.exe
EMSDK_PYTHON = C: \ Users \ Qedo \ Desktop \ emsdk-master \ python \ 3.7.4-pywin32_64bit \ python.exe
JAVA_HOME = C: \ Users \ Qedo \ Desktop \ emsdk-master \ java \ 8.152_64bit
em ++: error: Attempt to set a non-existent setting: 'OUTLINING_LIMIT'
 - did you mean one of INLINING_LIMIT?
 - perhaps a typo in emcc's -s X = Y notation?
 - (see src / settings.js for valid values)
distribute HTML5 to: D: / GLBASIC / appname/ distribute / HTML5
exit
success


The question I ask you is:
has anyone already had the following problems (lack of html) and has already solved it? how?
Thank you
Ad maiora
Title: Re: Compiling to html5?
Post by: SnooPI on 2020-Jul-29
GLB and HTML5...  an old old question/problem never really solved.

Personally, I think Emscripten was never the solution, a true GLB to HTML5 translator would be the best solution.
I think SP agreed with me on this (to be confirmed).
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Jul-31
anyone use html5 with GLB steam version?
Title: Re: Compiling to html5?
Post by: erico on 2020-Aug-01
I haven´t tried yet, did a bit a long time ago, before STEAM version, and I could get some basics going on certain browsers, I´m not sure how they fare today.
Title: Re: Compiling to html5?
Post by: dreamerman on 2020-Aug-04
GLB and HTML5...  an old old question/problem never really solved.
Yes, at least for me, I wasn't able to compile something more complicated than basic tutorials/projects, not sure what was problem, PolyVector, RenderToTexture or maybe something else, but just alywas were some errors. Now new standard gains popularity - WebAssembly, maybe this would be possible with GLB..

@Qedo
those errors like:
Code: (glbasic) [Select]
em ++: error: Attempt to set a non-existent setting: 'OUTLINING_LIMIT'mean that command line arguments for compiling are specified for older version of emscripten, current version (that You have installed) doesn't support them. Even if You will fix proper batch files/commands new issues will appear, related to same thing - html5 target configured for old emscripten. I one of my previous post I mentioned that, but I didn't play with it further, just because it has no point for me (putting to much time in that), and not sure if all GLB stuff will work in html5 target (as mentioned above) and hm.. let's finish on that :-) But it would be very appreciated to have html5 fully working.

Title: Re: Compiling to html5?
Post by: Qedo on 2020-Aug-04
in fact Html5 on V16 is a bad mess
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Aug-04
for now both in Html5 and android I compile with v15  :giveup:
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Aug-27
Hey you
has anyone tried in html5 to go directly to full screen bypassing the initial emscripten screen?
Furthermore it seems to me that in full screen the management of the mouse reports false values. does anyone confirm?
Title: Re: Compiling to html5?
Post by: SnooPI on 2020-Aug-28
I don't use Emscripten (I use my own GLB->HTML5 translator), but I think you can change that in "Bin/glbasic_template.html"

About the mouse I don't know  :(
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Aug-28
in fact i think i will write my GLB-> HTML5 translator too if i feel like it. at least for 2d.
From your experience how long will it take?
Also I'll look back at Metzzo's GLBScript / 123basic.
Title: Re: Compiling to html5?
Post by: SnooPI on 2020-Aug-28
My translator is based on the old (but very good) Metzzo's 123basic.

I fixed some bugs, optimized the code, reduced the size of the translated file and added some stuff.
But on this date, 3D doesn't work  :'(
For 2D it works very well in SD (640x480 or 800x480) but is a bit slow in HD.
But this is normal because it doesn't use WebGl. Later, I plan to make a WebGl version.
The advantage of not using WebGl is better compatibility, but the best would be to create 2 versions and detect if WebGl is enabled or not (I'll work on it when I have more time).

I don't recommend starting from scratch for your translator.
Use Metzzo's translator as a basis -OR- make a small demo that uses the functions you use in your games, I will test this demo with my translator and if it works, I will make a small standalone version of my translator for you (and of course also for others who would be interested) to allow you to easily translate your games into H5.

My message was a bit long, I hope I was clear even in English  ;)

Ps: The 123basic site is offline but apparently there is still a very old version on Github.

Ps2: It's a pity not to see Metzzo on this Forum anymore, he was a very good GLB programmer  :(
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Aug-28
Great.
thanks SnooPI for the help.
In the meantime, I downloaded 123basic from Github and will try to work on it. I consider your proposal for the future; certainly it would be interesting to develop the Webgl version to speed up the applications.

ad maiora
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Aug-29
but sorry am the only one who is trying to compile html5 with v16?
Possible?
I would like to solve this (only for me?) problem because looking on the internet Emscripten seems to be a really good solution.
We try to make it work for GLB too.
Title: Re: Compiling to html5?
Post by: Qedo on 2020-Sep-26
toc toc......
is there anyone?  :bed:
Title: Re: Compiling to html5?
Post by: erico on 2020-Sep-30
I will be interested on it in a little while, don´t have time to mess with it yet(probably only later this year).
I did try it a long ago with a non-steam version and it kinda worked but I just ported a project instead of making one specific for it, so it had some problems.