GLBasic forum

Main forum => Announcements => Topic started by: metzzo on 2012-May-05

Title: 123 basic - HTML5 for GLBasic
Post by: metzzo on 2012-May-05
GLBScript (now called 123basic)

Hey!

I proudly present the first video preview of the new GLBasic to HTML5 compiler, GLBScript! The compiler is fully self hosting
and works awesome. The compiler produces high quality JavaScript code which runs amazingly fast! Surprisingly
the JavaScript compiler runs even faster than the native GLBasic compiler, isn't that great?

Further I want to say, that EVERY GLBasic syntax element is now fully working. PROTOTYPEs, "FUNCTION in TYPEs",
CALLBACK or even GOTO is doing its job wonderfull!

History!
2 years ago, I wrote the first post about GLBScript (formerly GLScriptBasic) in the german forum
http://www.glbasic.com/forum/index.php?topic=4524.0. Originally it was just considered as a scripting language
for GLBasic with the exact syntax of GLBasic. Development was rapid and with no minor problems. UNTIL there
was a bug - I call it "THE BUG". This little bastard stopped the whole development. I spent hours or hours
hunting the bug... But after two weeks I gave up and suspended development of GLScriptBasic...
One year passed and finally I got myself together and started working on "GLBScript". This time there
was no big surprise... I knew what went wrong and how to avoid this again. So I programmed until september.
I had a lot of syntax elements of GLBasic running in GLBScript and it was quite usable. ALIAS and BYREF
were implemented and some extra goodies! But then school started...

Development slowed down a lot. I had only 5 hours a week time for GLBScript. But i didn't give up and continued
steadily. I tried to make the compiler self hosting (compiles its own source code), which was a hard taks to achieve.
Finally in the end of march I've implemented enough functions and fixed bugs to get this working. I was really happy about this,
because this meant the compiler is stable, fast and the features are also working together. Then easter holidays began and I
was very procuctive... I've implemented the last missing syntax element - goto and I have also reprogrammed the whole filesystem
API. After easter holidays I just started to port some of the included samples of GLBasic... during that I fixed a lot of bugs.


GOTO!
Yep! I've managed to get this beast working in JavaScript and it's quite stable. To get this monster working
in JavaScript I had to reimplement all flow control structures (IF, WHILE, FOR, FOREACH, REPEAT, ...) in a
more machine code like structure. Of course as soon as you use a single GOTO in a scope the whole scope gets
transformed into this, but I think that's quite reasonable.

Filesystem!
The next monster I had to kill was the low level filesystem API of GLBasic. The main problem is, in HTML5
there is no filesystem alike API available (except for Google Chrome, but this was no choice, because I want
GLBScript running in every browser!). There is only a Key - Value storage available in every browser. So I
had to implement a beast I call "Virtual File System". It basically wraps the whole Filesystem into an abstract
persistent file storage across every browser. Even old browsers with no "Localstorage API" this works fine (just
representation in JavaScript. When a file gets saved, I simply serialize this into a string and voilá we have
with less available memory), because as a second choice it uses cookies to save the data. Quite flexible i think!

So all Filesystem functions are available (WRITE... READ... INI... and many more)

I've also ported ALL String and Math functions to JavaScript. And of course a lot of minor problems were fixed (see changelog).
I also spent some time on improving the 2D engine of GLBScript. It is fully capable of converting the "Blocks", "Arkanoid", "FourInARow",
"Pong" and "JumpFrog" samples to HTML5 with literally no changes in the source code (except the GLB_ON_LOOP modification)


Self hosting!
As already mentioned, the compiler is fully self hosting. That means it is capable of compiling itself and produce executable
JavaScript within JavaScript

So what's the goal of this?
 - It's a good self test whether the compiler compiles accurate code. Compiling a compiler is not a trivial task.
 - EVAL() would be a possible function, and maybe I will include it.
 - Online development enviroment is possible. Developing your GLBasic Apps on the web. I already started a simple online IDE!

 One thing I want to mention is, that suprisingly the JavaScript compiler compiles _faster_ than the native one. I have no idea why,
 but I am quite happy about this.


Improved Debugging!
If an error occurs you see the current line of execution, a detailed stacktrace and of course the error message. The whole API does a lot more
saftey checks. You are able to get the current stacktrace in GLBasic with the new command "STACKTRACE$".

Google Closure is also used. In release mode Closure optimizes and minimizes the output code and in debug mode it cleans the code and indents. Google Closure is
a really nice tool and it's quite lightweight!

Inheritance!
Yeah that's right! GLBScript supports inheritance and ABSTRACT methods. That means you can program in basic OOP. But I want to keep it simple and not too overloaded.
Implementing this feature was not that difficult. But of course I had to reimplement FUNCTION in types to get "late binding" working.

Automatic media management!
As you know, audio is a pain when trying to be cross platform... Of course in HTML5 it's the same problem. Different browsers support different sound formats. So I wrote an automatic converter for this issue. It takes your audio file and converts it automatically into .ogg and .mp3 files. You have to do nothing as a programmer. GLBScript takes care and converts - a pretty handy feature I think. For converting to mp3 I use LAME and for .ogg SOX.

Videos!
Programming a little game:
Part1 (http://www.youtube.com/watch?v=_613padk3BU)
Part2 (http://www.youtube.com/watch?v=MrslDiMYjWE)
Deep look into the compiler itself! (http://www.youtube.com/watch?v=8xzaKL0Ci0w)

Demos!
Debug mode is on in every demo, so it's probably a little slow. But at the moment it just matters THAT it works...
My programming philsophy is "First make it run, then make it run fast".

Self hosting compiler (http://www.programming-with-design.at/files/GLBScript/compiler/File.html) (wait a few seconds until it has compiled itself. After waiting you see the code of GLBScript in
JavaScript. This was compiled a few weeks ago so the actual code of the compiler looks different!
Arkanoid sample (http://www.programming-with-design.at/files/GLBScript/Arkanoid/GLBFile.html)
Blocks sample (http://www.programming-with-design.at/files/GLBScript/Blocks/GLBFile.html)
FourInARow sample (http://www.programming-with-design.at/files/GLBScript/FourInARow/GLBFile.html)
JumpFrog sample (http://www.programming-with-design.at/files/GLBScript/JumpFrog/GLBFile.html)
Memory sample (http://www.programming-with-design.at/files/GLBScript/Memory/GLBFile.html)
OneMore sample (http://www.programming-with-design.at/files/GLBScript/OneMore/GLBFile.html)
Pong sample (http://www.programming-with-design.at/files/GLBScript/Pong/GLBFile.html)
SPRCOLL Test (http://www.programming-with-design.at/files/GLBScript/SprColTest/GLBFile.html)
XML reader (http://www.programming-with-design.at/files/GLBScript/XMLReader/File.html)

BIG Changelog:
Code: (glbasic) [Select]
Fixed: FOR had strange behaviour in recursion
Fixed: "FOR i = 0 TO 0" executes correctly
Fixed: "4 - 5 + 6" or "TRUE OR FALSE AND FALSE" do not throw a syntax error
Fixed: i% = 4; STDOUT i% works (the %)
Fixed: Line numbering is now (almost) correct
Fixed: (multidimensional) arrays are more robust
Fixed: Type cloning works with references properly (JavaScript)
Fixed: floats like ".5" implemented
Fixed: Some problems with references fixed
Fixed: Uninitialized arrays have now correct default values
Fixed: TRY - CATCH works in GOTO scope properly
Fixed: "GETTIMERALL" returns milliseconds since page loaded instead of unix timestamp
Fixed: "NOT" returned a boolean instead of an integer
Fixed: GETFILELIST: uses the filter$ parameter
Fixed: Hex values fixed
Fixed: RGB returned incorrect number
Fixed: Now the compiler seperates the generated html file from the javascript file (one big JavaScript file vs. one small html file). So it's easier to distribute your program.
Fixed: 2D uses context.save() and context.restore()
Fixed: Unexpected "gotocounter exception" fixed.
Fixed: Unnecessary unref(), tryClone() and CAST2INT()/CAST2FLOAT() calls are removed, in the generated JavaScript file. => Execution is faster
Fixed: Compiler error messages display correct line number, path and character where the error happened
Fixed: KEY uses GLB Scancodes
Fixed: REPLACE$ works as expected (uses own implementation instead of the native JavaScript one)
Fixed: Some safety checks in the file API
Fixed: Codefolding is supported properly
Fixed: Array position screwed up in 3 or 4 dimensional arrays...
Fixed: Wrong dereferencing when calling a NATIVE function
Fixed: CONSTANT with multiple identifiers (CONSTANT IS_A = 0, IS_B = 1, IS_C = 2)
Fixed: Width and Height from the .gbap file
Fixed: Sound in Opera and IE
Fixed: RGB returned sometimes wrong value
Fixed: SETTRANSPARENCY: Implementation is a weird hack, please use only if there are no other possibilities
Fixed: STRETCHSPRITE stretches the sprite properly
Fixed: Wrong behaviour when performing "IF" with floats
Fixed: STRETCHSPRITE with width = 0 or height = 0 does not crash Firefox anymore
Fixed: Implicit defintion of arrays if there is a []
Fixed: No infinite loop while trying to load a non existing image or sound
Fixed: Array access optimized.
Fixed: Preprocessor screwed around with ?ELSE...
Fixed: \f in strings are not compiled into \n anymore
Fixed: CAST2INT() cuts decimals correctly
Fixed: Numbers beginning with 0 does not throw a syntax error anymore (040 for example)
Fixed: STARTDATA data:\n DATA functCall()\n ENDDATA <- Works now with function calls
Fixed: RND should work as expected
Fixed: CALLBYNAME("10") throws no syntax error when executed...
Fixed: Touch support for Android
Fixed: No context menu on right click onto the canvas
Fixed: Callbacks and function in types are functioning together
Fixed: MOUSEAXIS with mouse wheel support!

Added: FOREACH with multidimensional arrays
Added: ?BLACKLIST "file" - For Blacklisting Files/Folders (are not included in the final .html file), "?BLACKLIST ALL" blacklists all files => no file is included!
Added: "_" symbol for ignoring the newline token
Added: BOUNDS(array, dimension)
Added: Fully functional GOTO - still needs some debugging
Added: "GOTO on demand" overhead reduction: goto overhead (a big switch - case monster) is only inserted when it's really necessary
Added: "Virtual File System" Engine: Flexible managing of your (persistent and non persistent) data in a nice filesystem like enviroment.
Added: MIN/MAX
Added: DEBUG
Added: ASSERT
Added: ABS
Added: SWAP
Added: SGN
Added: SIN
Added: COS
Added: TAN
Added: ASIN
Added: ACOS
Added: ATAN
Added: ASL
Added: ASR
Added: bOR
Added: bXOR
Added: bAND
Added: bNOT
Added: FMOD
Added: LOGN
Added: POW
Added: SQR
Added: STDERR (calls STDOUT with "Error: " prefix)
Added: CALLBYNAME
Added: SORTARRAY
Added: ADDRESSOF
Added: PLATFORMINFO$
Added: STDCOLOR*
Added: END
Added: GETTIMER
Added: LIMITFPS
Added: GETLASTERROR*
Added: SHELLCMD (executes javascript - eval)
Added: SLEEP
Added: SHELLEND (calls SHELLCMD and END)
Added: LCASE$
Added: UCASE$
Added: DECRYPT$/ENCRYPT$: does not use blowfish...
Added: SETCURRENTDIR
Added: FILESEEK
Added: FILEPOSITION
Added: READSTR
Added: READBYTE
Added: READLONG
Added: READULONG
Added: READWORD
Added: READUWORD
Added: READSHORTIEEE
Added: READIEEE
Added: WRITEBYTE
Added: WRITEUBYTE
Added: WRITEWORD
Added: WRITEUWORD
Added: WRITELONG
Added: WRITEULONG
Added: WRITEIEEE
Added: WRITESHORTIEEE
Added: KILLFILE
Added: GETCURRENTDIR$
Added: DOESFILEEXIST
Added: DOESDIREXIST
Added: GETFILESIZE
Added: COPYFILE
Added: CREATEDIR
Added: FILEREQUEST$*
Added: PUTENV (just a key - value storage)
Added: GETENV
Added: FORCEFEEDBACK (basic support, api is not very flexible...)
Added: SETSHOEBOX*
Added: GETCOMMANDLINE (returns the url parameter)
Added: INIOPEN
Added: INIPUT
Added: INIGET$
Added: SPLITSTR
Added: URLENCODE
Added: URLDECODE
Added: NETWEBEND
Added: PUSHLOOP loop$ (new command: pushes a new Renderloop onto the stack)
Added: POPLOOP (new command: pops the last renderloop from the stack)
Added: GETCURRENTLOOP$ (new command: returns the current name of the renderloop)
Added: RETURNTOLOOP: loop$ (new command: "walks" through the loopstack until it gets to the given loopname)
Added: ANYKEY: (new command: instead of KEYWAIT, returns true if a key is pressed if not it returns false)
Added: USEASBMP
Added: LOADBMP
Added: Google Closure compatibility (compilation_level = ADVANCED_OPTIMIZATIONS): Now the JavaScript code is perfectly optimized by Google Closure (a wonderful JavaScript Optimizer) It optimizes the file size but the code gets a little slower...
Added: Useful debug information (if a error occurs) in debugmode: Stacktrace (prints the complete function call history and its parameters) and the current line of execution
Added: ?OPTIMIZE NONE | SIMPLE | AGGRESSIVE - How much should be optimized? None does nothing, Simple does very little optimzation and aggressive does nearly everything (problem with aggressive is, that it runs sometimes slower than the other techniques)
Added: Implicit variable declaration (Use variables without their declaration)
Added: STACKTRACE$ (new command: returns the current stacktrace in debug mode)
Added: LOADSOUND
Added: PLAYSOUND
Added: SOUNDPLAYING
Added: HUSH
Added: Automatic audio converting to the common HTML5 audio formats (.mp3 and .ogg) - A very handy feature!
Added: ALPHAMODE
Added: SEEDRND
Added: Improved lexing speed: Uses now Hashmaps (In future I will rewrite the "identifier search engine" to use hashmaps, at the moment the native GLB arrays are used for this...)
Added: GRABSPRITE
Added: "Compile to HTML5" macro for GLBasic IDE - compile to HTML5 easily from the IDE.
Added: GOTO checks are now performed: You are only able to jump to defined labels.
Added: IIF(condition%, onTrue%, onFalse%)
Added: GLB_ON_LOADING: As long as GLBScript is loading data, this sub is callen... to check whether a sprite is loaded or not, use GETSPRITESIZE!
Added: SPRCOLL
Added: GETMOUSECOUNT (mult touch support, need some bugfixing on Android/iOS...)
Added: SETACTIVEMOUSE
Added: Experimental inheritance feature, FUNCTION in types reprogrammed...
Added: Experimental ABSTRACT feature

* This function is just a dummy, because it is not possible to implement this feature and/or it's not worth it.

Download!
Not yet available... but soon you are able to test it on your own!

Future goals!
 - Optimize compiler speed (At the moment the compiler is really slow...)
 - Implement missing functions!
 - Bug fixing!
 - Fix all TODOs in code
 - Compile every 2D game and execute it properly (after the GLB_ON_LOOP change)
 - Get 3D commands working and implement a WebGL driver (that will take a lot of work...)
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Ruidesco on 2012-May-05
WOW
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Hark0 on 2012-May-05
HYPE!

 :D
Title: Re: GLBScript - HTML5 for GLBasic
Post by: kaotiklabs on 2012-May-05
Amazing work!!
Cant wait to test it!
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Hark0 on 2012-May-05
I tried demo Four in a Row on iPad with Atomic Web Browser... and LOAD!

GOOD JOB...

I want my game project "online"  ;)

CONGRATS!
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Moru on 2012-May-05
Great work! I want this! What are the terms? :-)
Title: Re: GLBScript - HTML5 for GLBasic
Post by: mentalthink on 2012-May-05
 :blink: :blink: :blink: :blink:

Awesoming... this it´s another great quantum leap in GLbasic, firts iPhone, after the others devices now this... GLbasic don´t have end?¿....

wohooooooooooooooooouuuuuuuuuuuuuuuuuuuuuuuuuu!!!!!!!!!!!!!!!!

 :'( :'( :'( :'( :'( de alegría XDXD
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Ian Price on 2012-May-06
 :booze: :good: :nw:
Title: Re: GLBScript - HTML5 for GLBasic
Post by: MrTAToad on 2012-May-06
Its looking good!
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Moebius on 2012-May-06
 :nw:
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Falstaff on 2012-May-06
When do we get to play with it :D
Title: Re: GLBScript - HTML5 for GLBasic
Post by: erico on 2012-May-06
gasp! cough! outstanding!  :booze: :good: :nw:
Title: Re: GLBScript - HTML5 for GLBasic
Post by: bigsofty on 2012-May-06
Some one buy this man a drink! :booze:
Title: Re: GLBScript - HTML5 for GLBasic
Post by: matchy on 2012-May-06
 :nw: :booze: :good: :-* :happy:
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Jonás Perusquía on 2012-May-06
REALLY! impresive!   :nw:
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Schranz0r on 2012-May-06
 <3 it!
Title: Re: GLBScript - HTML5 for GLBasic
Post by: djtoon on 2012-May-06
3d?
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Schranz0r on 2012-May-06
no
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-May-06
Thanks for your replies!!

3d?
As Schranz0r already said: Not yet. But when 2D commands are implemented I will of course implement 3D via WebGL (WebGLBScript  =D). WebGL is OpenGL ES 2.0 for the web. I will offer this as an Add-on for GLBScript.

Great work! I want this! What are the terms? :-)
GLBScript won't be free / open source. Mainly because I spent so much of my time into this project - and I will continue spending time ;). I think the online version (with limited lines of code) will be free and the 2D version will cost in the first month around 30€ and then I will increase the price).
Please understand, I've spent a lot of time into this project and the price is quite reasonable I think.

When do we get to play with it :D
Soon! I think in around 2- 3 months a first test version of GLBScript is available.
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Moru on 2012-May-06
Great work! I want this! What are the terms? :-)
GLBScript won't be free / open source. Mainly because I spent so much of my time into this project - and I will continue spending time ;). I think the online version (with limited lines of code) will be free and the 2D version will cost in the first month around 30€ and then I will increase the price).
Please understand, I've spent a lot of time into this project and the price is quite reasonable I think.
That's perfectly understandable, that's why I asked about the terms :-)
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Schranz0r on 2012-May-06
about 50 Euro per license could be OK :)
I like the idea and if there are no major bugs... why not :P
Title: Re: GLBScript - HTML5 for GLBasic
Post by: TI-994A on 2012-May-07
Very interesting; good job!

How do you handle the libraries and dependencies? I'm assuming that these must be included as distributables.
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-May-07
HTML5 is an all in one thing. You have all 2d commands included and all the other stuff. So on the JavaScript side there won't be any problems, because I also don't use any third party libraries (jQuery, Prototype, ...). So there are no "real" dependencies.

On the GLBScript side: GLBScript only compiles used functions, so your "executable" keeps small.
Title: Re: GLBScript - HTML5 for GLBasic
Post by: MrTAToad on 2012-May-07
How will you deal with IMPORT and INLINE stuff ?
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-May-07
INLINE throws a syntax error and IMPORT simply imports javascript files instead of c++/mm files.

I could implement INLINE with JavaScript instead of C++, but this would not be very useful, because variable/function names are changed by the compiler (so they don't interfere with JavaScript keywords).

If you don't want a function to be changed you can use "EXPORT" which basically says the compiler "hey dude, I want this function untouched!"
Title: Re: GLBScript - HTML5 for GLBasic
Post by: mentalthink on 2012-May-07
It´s possible know aproximately when launch the "Plugin" Coolo?¿...

Thanks in advance...
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-May-07
Nope sorry... GLBScript is a freetime project and so it's very unpredictable when it's done. Especially when it's about something as big as a 3D engine with WebGL...

Currently making the 2D part up and running has a much higher priority than 3D stuff...
Title: Re: GLBScript - HTML5 for GLBasic
Post by: spacefractal on 2012-May-08
not all examples works with IE10, but works in Firefox. But its look awesome and its kind like that there is NO problemos as its would cost some money, its fully acceptable and should been sold throught glbasic.com of course, so do a license with Gernot about it.

Same could do that if GlBasic got ported to C# of course.

I wonder if its can run Greedy Mouse, which I have used 2d layeres and scaling very much (but some graphics can been disabled eventuelly).
Title: Re: GLBScript - HTML5 for GLBasic
Post by: hardyx on 2012-May-08
This is a very cool project!! I can't believe. :blink:
Title: Re: GLBScript - HTML5 for GLBasic
Post by: MrTAToad on 2012-May-10
From those examples given it does look as though there is little, if any, speed loss too, which is good...
Title: Re: GLBScript - HTML5 for GLBasic
Post by: spacefractal on 2012-May-10
Greedy Mouse is one of the game that require a lots and using POLYVECTORS, shadows and such thing (but I did avoid using problem commands like GRABSPRITE and other typical OS limit issues) as well I also using GOTO as well.

So its could been fun to checkout how its really perform with this game. Also I can change resoulution, details as well as well removing scaling to save cpu time.

Would been fun to do a light version of this game in html5 (even the game got delayed around a month throught).

So all in all this is a pretty cool project to show on as Flash is also not required to do a internet game, hehe.

Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-May-10
Changelog:
Code: (glbasic) [Select]
Fixed: Negative width/height with STRETCHSPRITE work on Firefox
Fixed: SYSTEMPOINTER TRUE works
Fixed: Castings are much faster
Fixed: Some memory improvement (less micro freezes in Firefox) hard to find these memory "leaks"
Fixed: WHILE 0.1 WEND <- Was never executed... same with REPEAT - UNTIL
Fixed: More Unnecessary CAST2FLOATs are removed from the source code => faster execution
Fixed: Array access in 3 or 4 dimensional array was incorrect
Fixed: TYPE TFoo; f AS TFoo; ENDTYPE <- throws syntax error, because of a cyclic references!


Added: LOADANIM
Added: DRAWANIM
Added: STARTPOLY (experimental!)
Added: ENDPOLY
Added: POLYVECTOR
Added: POLYNEWSTRIP
Added: ZOOMANIM
Added: ROTOZOOMANIM
Added: ROTOANIM
Added: STRETCHANIM
Added: SETSPRITEANIM
Added: EXPORT (exporting functions to JavaScript)
Added: REQUIRE (includes source code)

Greedy Mouse is one of the game that require a lots and using POLYVECTORS, shadows and such thing (but I did avoid using problem commands like GRABSPRITE and other typical OS limit issues) as well I also using GOTO as well.

So its could been fun to checkout how its really perform with this game. Also I can change resoulution, details as well as well removing scaling to save cpu time.

Would been fun to do a light version of this game in html5 (even the game got delayed around a month throught).

So all in all this is a pretty cool project to show on as Flash is also not required to do a internet game, hehe.

POLYVECTOR: does work but no tinting is performed, not sure whether it will ever work...
GRABSPRITE: should work.
GOTO: works 100%

Basically it _should_ work but there are some (hidden) problems at the moment. For example: ddgui is compiling and executing but it doesn't work properly yet.
Title: Re: GLBScript - HTML5 for GLBasic
Post by: MrTAToad on 2012-May-11
It might be advisable to (aside from some sort of demo), to release 2D and 3D parts separately.

That way any major problems for the former can be found and dealt with before any work starts on the latter - after all, you wont want to stop anything in order to fix problems...
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-May-17
It might be advisable to (aside from some sort of demo), to release 2D and 3D parts separately.

That way any major problems for the former can be found and dealt with before any work starts on the latter - after all, you wont want to stop anything in order to fix problems...
Yes that's what I'm aiming for.

Changelog
And of course the current changelog since last post:
Code: (glbasic) [Select]
Fixed: GETFILELIST infinite loop under mysterious circumstances...
Fixed: INI parser (for the INI... commands) can handle comments properly.
Fixed: STARTPOLy now with optional parameter and colored polygons (no gradients)
Fixed: Some array speed improvements

Added: EXPORT now with custom name: EXPORT MyAwesomeFunction, "FunnyName" <- generates function called "FunnyName" in JavaScript
Added: Case insensitivity (optional)
Added: Very very very experimental C# target (compiles but does not execute because no library function is ported...) basically it was just a test whether the abstract syntax tree is generic enough...
Added: POLYVECTOR with image tinting (no gradients possible...)

Very experimental C# generator
This was just a test. I wanted to see whether the compiler can also generate valid code for statically typed languages (since they are much stricter in terms of type system) and the test was very successful. In around 5 hours of programming the compiler generated valid C# code (it was bootstrapping itself - I have now GLBScript compiled into C# :D). Of course the code is not runnable because I didn't port the standard library of GLBasic. As i mentioned this is just a test, so I won't port the library, but maybe in future? C# is a much simpler target than JavaScript because it has all the missing features I had to emulate in JavaScript (pointer for BYREF and ALIAS; goto; ...)

Image tinting with POLYVECTOR
HTML5 does not support image tinting per se. There is a wonderful trick to do so (http://www.playmycode.com/blog/2011/06/realtime-image-tinting-on-html5-canvas/ (http://www.playmycode.com/blog/2011/06/realtime-image-tinting-on-html5-canvas/))

Gradients with POLYVECTOR does not function, because this technique does not allow this. Soon I will try to find a solution.

Some other minor changes are implemented. For example: optional case insensitivity and a few bugs were also fixed.

bye!
Title: Re: GLBScript - HTML5 for GLBasic
Post by: okee on 2012-May-17
What payment methods will you be accepting ? as "Throwing money at the screen" doesn't seem to work  =D
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-May-17
What payment methods will you be accepting ? as "Throwing money at the screen" doesn't seem to work  =D
Stones :D

Just kidding. I think I'll use PayPal.
Title: Re: GLBScript - HTML5 for GLBasic
Post by: diceless on 2012-May-18
You are mother flipping awesome! I haven't used this yet but you're saving me the trouble of learning how to do a lot of web stuff myself!
Title: Re: GLBScript - HTML5 for GLBasic
Post by: MrTAToad on 2012-May-30
I wonder, with a suitable manifest file, the resulting HTML 5 file could be published in the Chrome web store ? :)
Title: Re: GLBScript - HTML5 for GLBasic
Post by: erico on 2012-May-30
Excellent idea Mr.T!
Title: Re: GLBScript - HTML5 for GLBasic
Post by: MrTAToad on 2012-May-30
According to Google, all that is needed is a manifest file and the HTML file zipped up :)
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-May-30
I think this is perfectly possible!

Code: (glbasic) [Select]
Improved: Faster compilation: Instead of tokenizer -> preprocessor -> tokenizer -> analyser ->... it's now tokenizer -> preprocessor -> analyser!
Fixed: Some bugs due to the new preprocessor
Fixed: Array bug (DIM had wrong behaviour when passed a float)
Improved: CAST2INT much faster when casting to integers (uses ~~ in JS)
Fixed: LEN() on uninitialized arrays (LOCAL arr[]; STDOUT LEN(arr[])) failed
Fixed: TYPE TGameObject; ABSTRACT FUNCTION Test:; ENDTYPE <- Failed (needed second function)
Fixed: XML parser can handle now tabs!
Fixed: DOESFILEEXIST / DOESDIREXIST function better
Improved: code cleanup
Fixed: ?IF works better (more robust, can handle NOT and much more)
Improved: Some optimizations compiler side - faster compiling (still too slow...)
Added: New Targetsystem - 100% extensible with XML files - no platform/target specific stuff is hardcoded.
Removed: ?BLACKLIST command - now configurable with XML
Improved: Compile time MUUUUUCH faster - One bootstrap (= compiles its own source code) takes 25s instead of 110s on my pc :) but still: GLBScript is not the fastest compiler...
Fixed: String prototypes in JavaScript
Improved: Ressource handling much (is not embedded into the  JavaScript file -> much slimmer!)
Fixed: Really strange compiler crash (did some weird assignments to get rid of the crashes in "CreateExpression")
Fixed: DOESDIREXIST/DOESFILEEXIST returned sometimes wrong results
Added: Little HTTP Server to test your games easily
Fixed: GLOBAL myGlobal = myConstant; CONSTANT myConstant = 100 <- works now (use constants before they are defined)
Fixed: GLOBAL myGlobal = MyFunc(); FUNCTION MyFunc: .... <- works again (use of functions in GLOBAL definitions before they are defined)
Improved: Casting faster
Added: FOR i = 0 UNTIL 10 <- syntactical sugar for: FOR i = 0 TO 10 - 1, useful for things like: FOR i = 0 UNTIL LEN(MyArray[])
Fixed: Late binding with ABSTRACT methods
Added: SPRITE2MEM
Fixed: INC/DEC with floats/strings function now (INC a, 0.5 <- with out cast to integer internally)
Improved: OOP system cleaned up -> more rubust
Added: super.MyFunction() in methods.
Added: MyBaseClass(myDerivedClass) <- Casting!
Fixed: INTEGER(1)/INTEGER(2) returned in JS 0.5 instead of 0
Fixed: If FILESEEK goes beyond the file size it does not throw an error but it sets the position of the file to the last byte!
Fixed: STARTPOLY without POLYNEWSTRIP and mode = -1 works!

In the mean time I was of course spending my time on GLBScript. There are several topics I want to highlight:

Bug fixing and some other improvements!
I fixed tons of bugs and did a lot of debugging.  I have also rewritten the whole  file management under the hood. Before every file got embedded into the JavaScript file and was put into an array. Now there is for every writable/readable file a ".GLBSCRIPT_DATA" file which contains all the bytes of your file as a string representation. This is because JS does not allow a synchronous file access with byte data, so I had to workaround this. Because of this system there is no need of the "?BLACKLIST" preprocessor command anymore, which basically said that the compiler should not embed this file.

Compiling time much improved
Initially compiling of 7000 lines of code took around 130 seconds. I optimized a lot (I even wrote my own HashMap implementation) and was fixing a lot of bottle necks. Now compiling of 7000 lines of code take around 30 seconds. Not the fastest compiler on the world, but much better than the previous time...

Target system
I have rewritten the whole target system and now it's 100% extensible without changing code. So if you want for example running GLBScript via node.js you can write your own target. GLBScript uses XML for defining the targets.

Currently the "settings.xml" looks like this:
Code: (glbasic) [Select]
<target name="html5" lang="js">
<template path="HTMLTEMPLATE_CONSOLE" name="GLBFile.html" mode="console" />
<template path="HTMLTEMPLATE_GRAPHICS" name="GLBFile.html" mode="2d" />

<lib path="lib.js" mode="console 2d 3d" />
<lib path="array.js" mode="console 2d 3d" />
<lib path="math.js" mode="console 2d 3d" />
<lib path="string.js" mode="console 2d 3d" />
<lib path="file.js" mode="console 2d 3d" />
<lib path="ini.js" mode="console 2d 3d" />

<lib path="2d.js" mode="2d 3d" />
<lib path="sound.js" mode="2d 3d" />
<lib path="input.js" mode="2d 3d" />
<lib path="sprite.js" mode="2d 3d" />
<lib path="collision2d.js" mode="2d 3d" />
<lib path="screen.js" mode="2d 3d" />

<extension name="exe" action="ignore" />
<extension name="png" action="ignore" />
<extension name="bmp" action="ignore" />
<extension name="tga" action="ignore" />
<extension name="jpeg" action="ignore" />
<extension name="mid" action="warning" />
<extension name="ac3" action="mp3 ogg" />
<extension name="wav" action="mp3 ogg" />
<extension name="png" action="ignore" />
<extension name="mp3" action="ogg" />
<extension name="ogg" action="mp3" />
<extension name="ddd" action="ignore" />
<extension name="ddw" action="ignore" />
<extension name="DIR_DATA" action="ignore" />
<extension name="GLBSCRIPT_DATA" action="ignore" />

<file name="GLBScript.js" action="ignore" />
<file name="GLBFile.html" action="ignore" />
<file name="GLBScript_opt.js" action="ignore" />
<file name="GLBScript_unopt.js" action="ignore" />
<file name="GLBScript_beautiful.js" action="ignore" />
<file name=".svn" action="ignore" />

<action type="embeddata" />
<action type="appbeforelibs" />
<action type="optimize" name="closure" />
<action type="save" name="GLBScript.js" />
<action type="run" command="$COMPILERDIRTools/GLBServer/GLBServer.exe '$PROJECTDIRGLBFile.html'" />

</target>

During this I also removed the definition of the built in commands (DRAWSPRITE, SETCURRENTDIR, ...) into an extra file called "Header.gbas" which basically is included into every project you compile with GLBScript.

Improved OOP
Now it's much more robust and has many features. "super.myClass()" works in methods. You are able to cast between classes: "(MyClass(DerivedFromMyClass).hello". You can also define ABSTRACT methods. Quite cool I think!



Here is a little demo I've ported to GLBScript: http://programming-with-design.at/files/GLBScript/Isometric/GLBFile.html (http://programming-with-design.at/files/GLBScript/Isometric/GLBFile.html)
Title: Re: GLBScript - HTML5 for GLBasic
Post by: MrTAToad on 2012-May-30
Yes, thats just as fast as the standard executable :)
Title: Re: GLBScript - HTML5 for GLBasic
Post by: MrTAToad on 2012-May-31
Yes, I saw that IE didn't like it.  In addition, the Dolphin webbrowser on Android doesn't either :)
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Darmakwolf on 2012-Jun-01
That 3dish one runs smooth on chrome and choppy on firefox. Chrome seems to be the best bet for HTML5 performance, really. I still prefer firefox though.... will their HTML5 performance improve over time??? Also... what's the word on this project? Not to rush - I'm just excited!   :D
Title: Re: GLBScript - HTML5 for GLBasic
Post by: MrTAToad on 2012-Jun-01
Hopefully Firefox will improve things - but you just don't know :)
Title: Re: GLBScript - HTML5 for GLBasic
Post by: pinete on 2012-Jun-03
Amazing!!!!!! I cannot believe it!!!!!!
Title: Re: GLBScript - HTML5 for GLBasic
Post by: theprotocol on 2012-Jun-14
Very impressive. Well done!

I must say though, a huge credit should go to Gernot for designing the GLBasic API in such a straightforward way. It's abstracted just the right amount, such that it's similar to native OpenGL conceptually, but much easier.
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-Jun-14
Thanks.

But I'm not (yet) using OpenGL at all ;). HTML5 provides its own drawing functions, which are "similiar" to GLB 2D command set, but not equal. Sadly HTML5 does not provide a lot of drawing functions that GLB does. For example: Drawing of textured polygons is a pain in the ass in HTML5 - same with image tinting.

 And on the language side, there are a lot of language features that are very difficult to port to other languages (ALIAS, All types on the stack, Not static dimension count at compile time, ...).

Don't get me wrong, the API of GLBasic is awesome, but the only reason why it runs on the browser is my hard work and "perfection" :D
Title: Re: GLBScript - HTML5 for GLBasic
Post by: theprotocol on 2012-Jun-15
Don't get me wrong, the API of GLBasic is awesome, but the only reason why it runs on the browser is my hard work and perfection :D

Of course! I'm just commenting that the GLBasic API is so nicely structured - not to discount the work that you've done.  =D
Title: Re: GLBScript - HTML5 for GLBasic
Post by: mentalthink on 2012-Jun-15
Coolo!!! when we can purchase about the "plugin" for GLbasic, you are thinked about lauch a pre - release and when 3D it´s done, launch this module?¿...
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-Jun-15
Coolo!!! when we can purchase about the "plugin" for GLbasic, you are thinked about lauch a pre - release and when 3D it´s done, launch this module?¿...
When it's done!

I don't want to rush. I want GLBScript to be stable and working well. So it will take its time. And the plugin will also be its own "chapter". So please don't expect it too soon.

Code: (glbasic) [Select]
Fixed: LOCAL E; FOREACH E IN Arr[]; NEXT <- reused variable "E" instead of declaring a new one.
Fixed: Default seed is not 0, it is the unix timestamp
Fixed: LOCAL a; ...; LOCAL a <- does not generate buggy JavaScript code
Improved: Lexer is much faster* (8000 lines in about 8 seconds instead of 16 seconds)
Improved: Parser parses in less than 1 second
Improved: Precompiler precompiles in less than 1 second
Fixed: RND returned sometimes values out of range
Fixed: GLOBAL foo; FUNCTION Bar: LOCAL foo[]; ENDFUNCTION <- threw syntax error
Fixed: Compiler shows correct character position in errors
Improved: Again! The lexer is much optimized and does its really fast! Compiling of the compiler itself takes now around 7 seconds (from 150 seconds to 7 seconds, a huge step forward :D) - GLBScript compiling time is now as fast as GLBasic's
Improved: Type creating much faster.
Improved: Function calls much faster (unref() calls are reduced) -> needs some debugging
Fixed: GOTO works again!!
Fixed: myArray[0.5] works
Fixed: ROTOSPRITE / ROTOANIM works as expected - rotates in the middle.
Fixed: Internal array cloning works again
Fixed: FOR has variable declaration is correct
Fixed: LEN with Kerning works (but no "real" kerning is performed...)

Faster Compiling
I made the compiler now as fast as the native GLBasic compiler. It compiles 8000 lines of code in around 6 seconds on my PC. I'm quite happy about this, because a few weeks ago, compiling of 8000 lines of code took around 140 seconds.

Further I also fixed a lot things and optimized the HTML5 code!

I'm working on a little "present". I don't want to spoil too much, but GLBScript will then the first time being usable for the first time!!

Next week, I am not at home, so I can't really work on GLBScript :(
Title: Re: GLBScript - HTML5 for GLBasic
Post by: mentalthink on 2012-Jun-15
ok Coolo, don´t care when it´s done, it´s done...
I hope stay finished before 2013, I don´t want see the world finish whitout using Html5 in GLbasic  =D =D
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Darmakwolf on 2012-Jun-16
Maybe you should make a GLBasic game about the world ending and dodging meteors or something, Mental Think.
Title: Re: GLBScript - HTML5 for GLBasic
Post by: erico on 2012-Jun-16
There should be any problem. As long as our missile commanders are put, there is nothing to fear... :-[
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-Jul-19
Hey guys!

(Un)fortunatly Gernot has decided to make his own HTML5 target for GLBasic(would have been nice if he mentioned it before...). So I can't take the name "GLBScript" anymore, the confusion wouldn't be very good... So I have to find a new name...

In the meantime I was very busy and was not able to continue GLBScript development as far as I wanted, but I continue stadily!

Code: (glbasic) [Select]
Version: 0.4
Improved: Google Closure update
Fixed: Charset problem
Added: Experimental bitmap font system - kerning is missing!
Added: Font Kerning
Fixed: "Super" in methods functions again
Fixed: Compiler crash when using ABSTRACT
Fixed: CREATESCREEN threw "Image not yet loaded", but it was already loaded!
Added: DRAWRECT x,y,w,h,TransparentColor <- "clears" the pixel of the Screen - useful for terrain destruction in worms style!
Added: GETPIXEL - slow as hell...
Fixed: Transparency with fonts
Added: INKEY$
As you can see just minor things...

Don't wonder: The samples are not available anymore - I have to restructure my whole concept.
Title: Re: GLBScript - HTML5 for GLBasic
Post by: diceless on 2012-Jul-19
Nice, the demo worked in Opera without a hitch. I'll take that at meaning that there aren't compliance issues. Congrats!
Title: Re: GLBScript - HTML5 for GLBasic
Post by: spacefractal on 2012-Jul-19
I have not seen any post as gernot have ported to html5? Mightbeen he found a good compiler recently?
Title: GLBScript - HTML5 for GLBasic
Post by: Kitty Hello on 2012-Jul-19
Hi,

sorry for the silence. I was not sure this would be possible at all, so I didn't want to look like giving empty promises. I'm using Emscripten which translates the whole C++ engine to JavaScript. It results in pretty big html pages (4MB) currently.
Feel free to use GLBScript as a name, though. Your project has a quite different target audience, I think: Mobile development in a browser.
Also GLBasic as a scripting language is something really great, that I will never be able to provide.

As for those who don't know what this is about, see my youtube account.

I apologize if I did not treat you fair here. I should have PMed you about it, earlier. But I do think your work is of great value, anyway.



Title: Re: GLBScript - HTML5 for GLBasic
Post by: spacefractal on 2012-Jul-19
Yes, if glscripts produce much smaller files, most people would use that for hold traffic download size down. 4mb is for me quite too large for most online use (which is alfa omega when using online).

But It's a really nice way to use its as dev (as example) and then finally or later produce with glscripts. Howover it's have it's own use of course.

So it's seen that gernot and coolo html5 uses is very different each their use, and they seen suit together very nice.

Dont forget glscripts could later compile to c#.

So I'm pretty sure both would been nicely used.

Nice effort from both :-).
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-Aug-02
I've made a little video about the IDE of the BASIC compiler: http://www.youtube.com/watch?v=1o2IIBZOEFA (http://www.youtube.com/watch?v=1o2IIBZOEFA)
Title: Re: GLBScript - HTML5 for GLBasic
Post by: erico on 2012-Aug-03
It is really pretty! very simple IDE.
Quite a long video though, most people will struggle to follow up.

Great work nonetheless, keep it up :good:
Title: Re: GLBScript - HTML5 for GLBasic
Post by: bigsofty on 2012-Aug-03
It looks great Robert, your little script language has came a long way!   :good:
Title: Re: GLBScript - HTML5 for GLBasic
Post by: MrTAToad on 2012-Aug-03
Yes, it's looking rather good!
Title: Re: GLBScript - HTML5 for GLBasic
Post by: spacefractal on 2012-Aug-03
why change the name? Gernot did not even have issues to keep the name and its use the same syntax with glbasic..... video is very long and few would play it to the end wihout skipping.
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-Aug-03
Thanks guys! I will make soon some "short" videos where I show you the features of 123basic.

why change the name? Gernot did not even have issues to keep the name and its use the same syntax with glbasic..... video is very long and few would play it to the end wihout skipping.
It is too much confusion, if there are two languages that does compile the same source language into the same target platform. Further: The "GL" in GLBasic stands for "OpenGL", but 123basic does not even yet use WebGL at all (so it runs on a much wider range of devices, escpecially mobile devices).

Last but not least: I like "123basic" more than "GLBScript".
Title: Re: GLBScript - HTML5 for GLBasic
Post by: matchy on 2012-Aug-03
Firstly, it's does look. The name "123Basic" implies that another new dialect of BASIC is being used rather than GLBasic commands. To answer, highlight these issues, for example the editor, compiler, viewer used, in a 30 second video!

Title: Re: GLBScript - HTML5 for GLBasic
Post by: MrTAToad on 2012-Aug-03
Have you thought of a pricing structure yet ?
Title: Re: GLBScript - HTML5 for GLBasic
Post by: Hark0 on 2012-Sep-23
Any new?

 O_O
Title: Re: GLBScript - HTML5 for GLBasic
Post by: metzzo on 2012-Sep-25
I'm working on it. Don't worry!

My time is limited at the moment, so progress is slow :(
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: MrTAToad on 2012-Sep-25
Something we all suffer from :)
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2012-Oct-12
Hello!

Because my time is very limited and I am not able to support and develop everything of 123basic on my own anymore, I decided to open source "my baby" :D. It is MIT licensed, so I think everyone can use this piece of code in his/her project.

Because I originally didn't plan to open source 123 basic, the comments are rarely written, in german and cryptic as hell. I hope this will improve in future.

Here is the URL: https://github.com/metzzo/123-basic (https://github.com/metzzo/123-basic)

To use it: Get the source code from git, compile the compiler and "install" the macro in /GLBScript.app/Tools/compile.bat (set the path to the executable properly)

So please don't get me wrong: 123basic is not dead, but I am not able to maintain everything on my own, so I think making it open source is a good thing for everybody.

If you want to contribute, I would be happy :)
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Slim on 2012-Oct-12
Wow, that is mighty generous of you.
Thanks coolo.
I am looking forward to giving it a spin.
 =D
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Slim on 2012-Oct-12
Coolo, could you give a brief explaination of how/when to use GLBServer?

Thanks.
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2012-Oct-12
Coolo, could you give a brief explaination of how/when to use GLBServer?

Thanks.

This is a little HTTP server that is used to test 123 basic apps that load images/sounds/... from disk locally. Some browsers (Chrome, Firefox, ...) do not allow loading data with an url without an http server (Doing this would throw a DOM Security Exception). So using a lightweight HTTP server was the best solution for this problem.

Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: mentalthink on 2012-Oct-12
Hi Coolo I sorry you can finalize the project... but a lot of thanks for sharing the code... very very generous... I hope you can finalize something like this in the future...

Thanks a lot!!! for learning If I understand something I think can be a very good source for understand a lot of complex things...

Regards,
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Hemlos on 2012-Oct-12
 
this poor baby!  :O

Im so surprised you dropped the ball here!
Your time invested "as is" would have been totally worth any reasonable price to me, regardless if future updates had only been, say 1 or 2 years apart. Heck ive bought software that never gets updated.


PS. a great oversized, thank you.  :coke:

PPS. Did you do this for a grade at MiT?
Because my time is very limited and I am not able to support and develop everything of 123basic on my own anymore, I decided to open source "my baby" :D. It is MIT licensed, so I think everyone can use this piece of code in his/her project.
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2012-Oct-12
Nice to see that you like this step :)


this poor baby!  :O

Im so surprised you dropped the ball here!
Your time invested "as is" would have been totally worth any reasonable price to me, regardless if future updates had only been, say 1 or 2 years apart. Heck ive bought software that never gets updated.
Nice to hear, but I think making it available to everyone makes everyone happier - the best thing that can happen is to see people actually using 123basic :)

PPS. Did you do this for a grade at MiT?
Nope, this is just the license of the 123basic compiler & library. MIT is a very liberal license that allows basically everything :D http://opensource.org/licenses/mit-license.php (http://opensource.org/licenses/mit-license.php)
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Kitty Hello on 2012-Oct-19
Aw, very sad to hear this.
I hope someone tries to continue working on it. Especially towards using GLBasic as a scripting language.
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Moru on 2012-Oct-19
Thankyou, I will surely have a play with this the first free moment I get!
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Poetronic on 2012-Nov-08
Aw man, so sorry to hear that you discontinue the project. This is something I would really have liked to get out of GLBasic! Hopefully the open source version will find some skilled developers (I'm surely not one of them, sorry...).

Anway, please keep it up, I will definitely be one of the first people to buy it!  :good:
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Marmor on 2012-Nov-08
ich weiß shice sagt man nicht  :offtopic:
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Hemlos on 2012-Nov-08
haha, you just did, now pickup that medicine ball with moru ;P
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-11
Hey guys!

Recently I've started working on 123basic again and I think it's ready to show it to you guys.
First of all the Changelog:

Code: (glbasic) [Select]
0.5
Fixed: INIGET$ returns "NO_DATA" if data does not exist
Fixed: NETWEBEND redirects properly
Fixed: ALPHAMODE behaves more like GLB (but not quite the same)
Fixed: PRINT with unknown characters does not crash - ignores them
Fixed: SMOOTHSHADING works properly
Fixed: MEM2SPRITE works again on newer browsers
Fixed: SOX with libmad
Fixed: MUSIC playback & looping
Added: MUSICVOLUME
Added: PAUSEMUSIC
Fixed: ALPHAMODE 0.5; SHOWSCREEN did cause weird graphical gliches


0.4
Fixed: NOT fixed.
Fixed: ROTOSPRITE/ROTOANIM/ROTOZOOMSPRITE/ROTOZOOMANIM use correct image handle when rotating
Changed: New file structure of project
Fixed: Default Font is now loaded properly - even if its not in the /Media directory
Added: GETNUMJOYSTICKS()
Added: GETJOYX, GETJOYY, GETJOYZ
Added: GETJOXRX, GETJOYRY, GETJOYRZ
Added: GETJOYNAME$
Added: GETJOYBUTTON
Added: GETDIGIX/GETDIGIY
Fixed: "FOR i = 0 TO 0 STEP 0" had wrong behaviour
Fixed: SETSCREEN does not ignore Fullscreen parameter anymore and the width/height is set properly
Fixed: TYPE Foo; Bar; FUNCTION Asdf: Bar; RETURN Bar; ENDFUNCTION // this returned the value of self.Bar instead of the value of the parameter
Fixed: TYPE asdf; Foo; FUNCTION Bar: FOR Foo = 0 TO 10; NEXT; STDOUT Foo; ENDFUNCTION; ENDTYPE // Implicit self in For should create new local variable to maintain compatibility
Fixed: ZOOMSPRITE 0,0,0,-1,1 // position of image was not correct
Fixed: "settings.xml" with more than 1 target didnt function properly
Fixed: VIEWPORT sets origin properly
Changed: Began to work on VM - does not run yet
Fixed: Float in array access bug
Fixed: LEN("\n", TRUE) crashed
Fixed: SPLIT returned wrong array length
Fixed: POLYVECTOR with mode == 1 and no POLYNEWSTRIP crashed
Fixed: POLYVECTOR messed up VIEWPORT
Fixed: "Hugo" < "Manfred" evaluates as expected (<,>,>=,<= are overloaded properly)
Fixed: Arrays with ref that were not initialized with DIM/REDIM had wrong defaultval (caused to problems with strings for example)

I have mainly fixed a lot of bugs... I mean a _lot of_ bugs. Stuff like ddgui compiles and executes properly (but because it is not adapted to the GLB_ON_LOOP it freezes sometimes - but this is not the fault of 123basic :D). Things like Joystick support are also implemented (but not yet tested enough). The only demo that is not working properly is "Scramble", because it heavily uses POLYSPRITE which can not be executed properly in HTML5 without WebGL, because it lacks proper support for drawing textured and tinted polygons.

Personally, Id say 123basic should be capable of running every GLB game that does not use POLYSPRITE with tinting and is modified to not use a mainloop (GLB_ON_LOOP instead).

Use it?
The repository of 123basic is https://github.com/metzzo/123-basic (https://github.com/metzzo/123-basic), so everyone can view the compiler and the library and maybe even contribute.

Currently there are two possibilities to code in 123basic:

Online is surely easier to use, because it is directly available with no installation. The macro is not as easy to set up, but you can compile your GLB project directly from the IDE. Compile 123basic from the IDE, than set up the macro (see "Macro.txt") and voilá you can directly compile to 123basic from the GLB IDE.

If you do so, 123basic will start a local server, because it needs it to access certain media without causing a DOM security exception.

Demos?
My testing suite consists primarly of:

All samples are only tested with current Chrome version. Firefox is likely to function properly. IE/Opera/Safari not so much. EDIT: I've just tested some demos on FF - a lot of them are crashing. Im currently trying to fix this problem. EDIT2: The problem is caused by a Firefox bug (https://bugzilla.mozilla.org/show_bug.cgi?id=867594).

What's next?
I would like you to use 123basic, show me bugs, maybe suggestions for improvement and so on. If you find any bug, it would make it much easier for me, if you send me some snippet so i can debug it.

I would also expand the IDE, library (NET..., X_..., GUI, other funny stuff), continue implementing VM, ... There is a lot to do!

Also in regards of tutorials, some YT videos and a proper website is also on the ToDo list.

If you have any questions, feel free to ask them :)
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: DaCarSoft on 2013-Nov-11
Oh my god!!! This is really "Cool..."

Congratulations!!!!   Your work is impressive...

It appears to work ok under Safari and Firefox at first attempt.

I've just downloaded all the stuff on GitHub to see how it should be used and start playing with it.

Please, don't forget this project!!!

Cheers.

Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Marmor on 2013-Nov-11
looks cool !

 :good:
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: mentalthink on 2013-Nov-11
This are really good news Coolo!!! I hope you continue with this Html5, I think the GLBasic version and yours, are very diffferent, I try a couple of examples and it's really nice the speed them are loaded into the browser...

Thanks a lot for continue this Huge project...  :booze: :booze:
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: erico on 2013-Nov-11
Nice come back Coolo!
Looking good! :good:
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-11
Will have to give this a go too!
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-11
Thanks guys! Id love to see 123basic being used!

I just fixed the FF problem - which seems like only occured to me (it was a result of getImageData returning inaccurate pixel data which was needed for LOADFONT to determine the width/height of cells)
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Hark0 on 2013-Nov-12
 :O

OH MY GOD!

WORKS ON MY IPAD1, SAFARI... AND CHROME!!!

 :good:

Very good job @coolo, this its a REAL implementation of html5 with GLB!

Don't stop the project! ;)

Melange IDE works too on iOS 5.1.... BRAVO!!!
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-12
Nice to hear! I did no tests on iOS (do not own a device) and Android was also quite untested (but as I can see Touch, Screen adjustment and Sound does not work yet properly, which will be fixed soon).
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-12
The web compiling is starting to work well.  The loading/save bits do need to be implemented (as well as being able to paste text).

The only thing missing is INLINE/ENDINLINE - I get a compiler error for those - does the offline version support that ?
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-12
INLINE / ENDINLINE will never work. This is compiled directly to JS+HTML5, no C++ compiler is involved. I personally consider injecting "foreign code" into a language via syntax elements like "INLINE / ENDINLINE" as bad code, because it hinders the language itself and causes lots of problems, especially in regards to compability and encapsulation. This is something I want to avoid as much as possible.

Saving/Loading in the IDE is currently done in localStorage, when compiling source code, which is a temporary solution. Pasting text should work though.
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-12
Yes, got copying and pasting to work now - odd it didn't before...
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Moru on 2013-Nov-12
Great news that you continue with this project! Does network socket commands work?
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-12
No, the socket commands do not work yet.
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Moru on 2013-Nov-12
Is it possible to ever get them to work in html5?
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-12
Theoretically WebSockets are a thing that most current browsers support. I personally already have written an application with WebSockets and I have quite some experience with them. I do not know for sure if it is possible to emulate all the NET... / SOCK... commands of GLB with them, because you do need a server inbetween connections.

How I'll implement them, I am not sure yet, as these features (like 3D) are very far in the future. Getting the current state bugfree and usable is a challenging job, that will surely take some time.


btw: I moved my todo list (https://github.com/metzzo/123-basic/issues?milestone=1&state=open) from a local file to GitHub. So you always know which bugs/enhancements/... I'm going to work on in future.
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Qedo on 2013-Nov-15
@Coolo:

First of all thank you for sharing your program 123Basic.
I tried to compile something but I found it difficult to do so.

1) On line can not compile applications that have files in the Media folder (fonts jpg, etc.)
2) Locally instead I can not properly set the macro and compile everything.

Could you explain in more detail how to proceed in both cases?

Ciao
Qedo

Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-15
hi!

1) To get you assets online (sound, sprites, ...), go to the "Asset" tab on the top and drag'n drop your files.
2) Download the data from github, then compile 123basic with GLB (open die gbap file).
Code: (glbasic) [Select]
::Compile to HTML5 via 123basic
set OTTBASIC_PATH=C:\Users\Robert\Documents\GitHub\123-basic\123basic.app
"%OTTBASIC_PATH%\123basic.exe" -N\"%GLB_PROJ_NAME%.gbap\"" -P\"%GLB_PROJ_PATH%\\\"-G"HTML5"
Adjust the OTTBASIC_PATH to the directory where the compiled EXE of 123basic is. Then copy the Macro to the macro you desire (Tools -> Macros -> Edit -> Blue for example). Now you should be able to compile your GLB project from the IDE with 123basic.
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-15
It does have some interesting problems with Android's Chrome browser and default settings - it seems to work, except for text : There is none (or you just get one line).  Using the "Get desktop version" does seem to solve it though
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-15
Yes this problem has been fixed, but not all demos were recompiled. Try the "JumpIt" demo, that one has been recompiled. I'm currently trying to automate uploading new demos onto the server, so i do not have to do this manually everytime I fix something.
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-15
I'll try that!
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Qedo on 2013-Nov-16
Coolo, Thanks for the explanation.

I did some tests and 123basic has compiled for all programs except for the app whose gbap have encoding = "utf-8"
For these apps, including FontTest, which is among those tested, when compiling locally with the macro I get the following error:

XML Error - Expecting '<'


I seem to have overcome this problem by loading the gbap with Texpad (a text Exitor) and resaving always with the "utf-8".
After i can also compile FontTest.
But in a my program, even after having the procedure declared before does not work (see screenshot, on the left 123basic, on the right HTML5 of GLB).
It seems that the fonts are not loaded from the "Media" folder even if the server messages apparently appears so.

Any idea?
thanks
Ciao
Qedo

messages from the server:

123basicServer active and listening on port 421337
1> HTTP Server active and listening on port 53664
1:1> GET D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/123File.html (200 OK)
1:1> GET D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/123Script.js (200 OK)
1:1> GET D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/DIR_STRUCTURE (200 OK)
1:1> GET D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/Media/smalfont.png (200 OK)
1:2> 404 Not Found: D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/favicon.ico
1:1> GET D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/Media/35_56_ARIAL_BOLD_ROSSO.png (200 OK)
1:2> GET D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/Media/35_56_ARIAL_BOLD_BIANCO.png (200 OK)
1:3> GET D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/Media/35_56_ARIAL_BOLD_BLUE.png (200 OK)
1:4> GET D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/Media/35_56_ARIAL_BOLD_ARANCIO.png (200 OK)
1:5> GET D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/Media/10_16_ARIAL_BOLD_BIANCO.png (200 OK)
1:2> GET D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/Media/14_22_ARIAL_BOLD_BIANCO.png (200 OK)
1:1> GET D:/appoggio/basic/glbasic12/ETA_HTML5_123/ETA.app/Media/MaleRoadStd2010.csv.123SCRIPT_DATA (200 OK)
1:6> Close!
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-16
Hey!
Thanks for the bug report. I've been hunting the bug down and the origin for this problem was that the engine messed around if two fonts were loaded (smalfont.png is always implicitly loaded) - causing the second one not being displayed. Then there was also an issue with the character height of the fonts). This is now fixed.

Your issue with loading gbap files is weird though, I do not encounter any of these problems. Would it be possible if you would send me an example.

Here is the changelog since last changelog:
Code: (glbasic) [Select]
Changed: All "GLBasicScript" / "GLBScript" / "GLB" renamed to 123basic/OTT
Changed: Tested all samples in Firefox/Chrome/Opera/Safari (latest versions) and created issues for stuff that didnt work
Fixed: Touch on mobile browsers working again
Fixed: Font rendering on mobile platforms
Fixed: Firefox supports PLAYMUSIC
Fixed: SETSCREEN works again
Fixed: LOCAL sx, sy; GETDESKTOPSIZE sx, sy; SETSCREEN sx, sy, FALSE // no ugly scroll bar is visible
Fixed: ALPHABLEND 0 really resets alphablending
Changed: Made some tests ready for mobile (resolution is set according to DESKTOPSIZE): JumpIt, IsometricDemo (still very slow), JumpFrog, ...
Fixed: PRINT ignores unknown characters (0-26 charcode)
Fixed: SPRITE2MEM had wrong color format (ARGB instead of ABGR)
Fixed: CALLBYNAME rewritten and returns correct return value
Changed: Optimized Shadow Stack implementation in Debugging mode - should run now much faster
Fixed: SETSCREEN Fullscreen parameter functions now (does not use the HTML5 fullscreen API anymore, because it requires to be callen in a click/key event, which SETSCREEN is usually not -> sets the canvas size to innerWidth/innerHeight instead)
Added: IE 11 support
Added: Automatic test compilation and upload
Added: Audio system rewrite, uses now additionally Web Audio as playing Backend
Added: New demo (ParticleSystem)
Fixed: Multiple LOADFONT did not work
Fixed: Character height of some fonts was not set properly
Fixed: MUSICVOLUME works with new sound system
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Qedo on 2013-Nov-16
Now compile but there are still problems with the fonts.
Look at the links, as it is and as it should be.
Ciao
Qedo

http://web.tiscali.it/edoardobianchi/STUFF/HTML5/ETA.html

http://web.tiscali.it/edoardobianchi/STUFF/HTML5/123basic/123File.html
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-16
Thanks for reply, I've managed to fix the offset problem, well, at least I think (characters were moved by 1 on x/y which caused this graphical gliches), but this does not solve the color not being set properly (btw: you got a private message).
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-18
Hey, I've managed to fix the bugs that caused your application to not run properly. The problem was mainly caused by a problem with ALPHAMODE and font kerning. Now it looks pretty much the same.

Thank you for sending me code, it really helped :)

Changelog
Code: (glbasic) [Select]
Fixed: If no channel is available in audio, the first one is taken and problems with playing multiple PLAYSOUNDS fixed with both sound systems
Fixed: WebAudio supports "pan" parameter in PLAYSOUND
Fixed: Font characters were moved by x+1, y+1 (caused some graphical gliches)
Fixed: Kerning is more robust & Font rendering less blurry
Fixed: ALPHAMODE +X works as expected
Fixed: Font kerning works with more different fonts (I hope all) and whitespaces have correct size
Title: Re: 123 basic (formerly GLBScript) - HTML5 for GLBasic
Post by: Qedo on 2013-Nov-19
 :good:
The program work !!!!
Qedo
Title: Re: 123 basic - HTML5 for GLBasic
Post by: mentalthink on 2013-Nov-20
Hi Coolo I leve here the .rar I comment.
Thanks.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: spicypixel on 2013-Nov-20
How are any of you testing it with no download link available?
Title: Re: 123 basic - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-20
Hey!

Project is open source on GitHub  (https://github.com/metzzo/123-basic).
Title: Re: 123 basic - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-20
How are any of you testing it with no download link available?
Online compiler!
Title: Re: 123 basic - HTML5 for GLBasic
Post by: kanonet on 2013-Nov-21
Online compiler!
That one is not working for me I always get the error message "Index or size is negative or greater than the allowed amount" on compile (using FF 25.0.1).
Title: Re: 123 basic - HTML5 for GLBasic
Post by: mentalthink on 2013-Nov-21
HI Kanonet don't worry about this it's only when you satrt the ide, if you delete and make something like draw a Sprite equal tahn GLBasic works. (I think any kind of program have to run), but really this it's a bug in the ide of Coolo.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-21
Online compiler!
That one is not working for me I always get the error message "Index or size is negative or greater than the allowed amount" on compile (using FF 25.0.1).
Even with the default example ?
Title: Re: 123 basic - HTML5 for GLBasic
Post by: kanonet on 2013-Nov-21
Online compiler!
That one is not working for me I always get the error message "Index or size is negative or greater than the allowed amount" on compile (using FF 25.0.1).
Even with the default example ?
Yes I can not compile or run anything. Tried the default example and even a more basic Hello World - nothing works. Since it works for you, I guess it must be something with my many AddOns or changed settings in FF.

@mentalthink: sorry not sure what you mean, I cant get it working.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-21
Might be worth having a look at.  It's worth it :



Edit by kanonet: fixed youtube link.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: mentalthink on 2013-Nov-21
@kanonet sorry... I said for me works, I don't touch nothing in Firefox (I have the last Update)...
I comment I only delete the code and put a code for draw a only one sprite, and for me works.

After I try to record a video... ok?¿.  :good:
Title: Re: 123 basic - HTML5 for GLBasic
Post by: kanonet on 2013-Nov-21
I fixed your link.

Haha of cause I do it like this - I get the error posted above, feels a bit strange to get a video that explains how to do such a basic thing, but thank you for trying to help.

@mentalthink I think a video wont change anything since Im sure I dont use it wrong - see MrTs video.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-21
The only extension I have in Firefox is AdBlockPlus
Title: Re: 123 basic - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-21
Yes, it was a bug and it has been fixed now, at least it works here.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: erico on 2013-Nov-21
Finally gave it a go!

Runs fine on Chrome and Explorer on desktop win7.
Tried one other program here and assets don´t seem to upload, program complains about load failure upon starting but works.

Really great work there! I particularly like the IDE visuals.
It works diamond perfect together with a Note II on android and chrome.

The way the IDE accommodates around is just spot on, and so when you type. I can finally put auto-complete on android on, so I can code on the go zx spectrum way. :P
It feels like a portable GLB. Super potential this has!
Title: Re: 123 basic - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-21
So what did you say wasn't working/isn't available ?

I think it was :

Title: Re: 123 basic - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-21
INLINE does not work.
POLYVECTOR partly works (tinting is limited though)
File I/O is 100% supported
3D does not work.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-21
I'm finding this code :

Code: (glbasic) [Select]
// --------------------------------- //
// Project: Test1
// Start: Tuesday, April 10, 2012
// IDE Version: 11.001

TYPE T3DStar
        xPos
        yPos
        zPos
        zVel

        FUNCTION Initialise%:
                self.xPos=RND(1000)-500.0
                self.yPos=RND(1000)-500.0
                self.zPos=RND(900)+100
                self.zVel=0.5+RND(5)
        ENDFUNCTION

ENDTYPE

TYPE T3DStarProcess
        screenWidth%;screenHeight%

        stars[] AS T3DStar

        FUNCTION Initialise%:screenWidth%,screenHeight%
        LOCAL s AS T3DStar

                self.screenWidth%=screenWidth%
                self.screenHeight%=screenHeight%

                DIM self.stars[500]

                self.Reset()

                RETURN TRUE
        ENDFUNCTION

        FUNCTION Finish%:
                DIM self.stars[0]
        ENDFUNCTION

        FUNCTION Display%:
       
        ENDFUNCTION

        FUNCTION Process%:speed
       
        ENDFUNCTION

        FUNCTION Reset%:
        ENDFUNCTION
ENDTYPE

GLOBAL stars AS T3DStarProcess

stars.Initialise(640,320)

SUB GLB_ON_LOOP:
    stars.Process(1.0)
    SHOWSCREEN
ENDSUB

Is hanging the compiler
Title: Re: 123 basic - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-21
weird, does not happen to me. What browser are you using?
Title: Re: 123 basic - HTML5 for GLBasic
Post by: erico on 2013-Nov-21
...
File I/O is 100% supported
...

Strange, I can carry stuff to the IDE, it shows there. I can´t delete them on the X.
But they don´t seem to load in code and I get a ´can´t load image 2´ error.

I´m trying to run this code here:
http://www.glbasic.com/forum/index.php?topic=8822.0
Title: Re: 123 basic - HTML5 for GLBasic
Post by: kanonet on 2013-Nov-21
Yes, it was a bug and it has been fixed now, at least it works here.
It works now, thanks everyone that helped.

BTW NET_ and SOCK_ commands are not fully implemented yet, right?
Title: Re: 123 basic - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-21
weird, does not happen to me. What browser are you using?
Firefox 25...
Title: Re: 123 basic - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-21
MrTAToad: Strange, Everything works OK here, have you tried refreshing?
kanonet: NET_ and SOCK_ is currently unimplemented, yes.
erico: I'm trying to fix it, seems to be either a problem with DRAWANIM or GRABSPRITE. The demo does load the images when compiled with the macro, but still is buggy when executed - I'm on it.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-21
Hey!

The problem is now fixed - dragging multiple file at once into the field was buggy.

Secondly, remove the SETCURRENTDIR, because all the assets are put into the / directory instead of /Media.

Title: Re: 123 basic - HTML5 for GLBasic
Post by: erico on 2013-Nov-21
Nice, will give it a go later today! Thanks Coolo!
Title: Re: 123 basic - HTML5 for GLBasic
Post by: mentalthink on 2013-Nov-22
Hi Coolo I test the "AS" when you do a TYPE and now works fine.
A little problem now  .jpg don't works..
If in the folder you have a .jpg then compiler hangs saying only "this can take a bit of time", but if the same image convert to .png, it's practically auomatic... I think you have something buggy when compile the .jpg.

Really this it's very very faster...  :happy: :nw:
Title: Re: 123 basic - HTML5 for GLBasic
Post by: mentalthink on 2013-Nov-22
HI Coolo I think I found another little problem Static variables makes the broser appears in Blanck...
Title: Re: 123 basic - HTML5 for GLBasic
Post by: erico on 2013-Nov-22
Strange, I still get "Image not available ´1´".
Even if I intend the loading routines.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: mentalthink on 2013-Nov-22
HI Erico I speaking into Computer in Local with the Compiler of Coolo all I put this night is about PC Compiler...
If you are in the online editor, take in mind you have to Upload the files in Assets, I think you have to avoid Setcurrentdir, but runs fine, for me runs without problems...

I make a "bit serious test" so , near A coleague and me launch a Zombie Game, very simple, but we want a Html5 tool, and the test I do, the Coolo's Html runs very very faster, it's awesome, I'm only thinking in 3D , three.js can be the best choice, the problem it's different to the 3d of GLbasic, but extremelly more powerfull.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-22
MrTAToad: Strange, Everything works OK here, have you tried refreshing?
Indeed - I'll try it on a different browser soon.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: Qedo on 2013-Nov-24
Coolo,
This simple code don't compile (in local), with error:
-----------------------------------
Error: 'Expecting type, got primitive datatype 'float' (parse error)'
in line '21' at character '33' near '+'
in file '\bug.gbas'
         'RETURN check_point_polygon[0].w+check_point_polygon[0].h'
-----------------------------------


It seems that do not accept the passage as parameter of array of structure.

Could you verify?
Thank you
Qedo

Code: (glbasic) [Select]
TYPE cp
w%
h%
ENDTYPE

GLOBAL check_point_polygon[] AS cp
DIM check_point_polygon[1]

check_point_polygon[0].w=12
check_point_polygon[0].h=122

SUB GLB_ON_LOOP:
PRINT stretch_y(check_point_polygon[]),0,100
SHOWSCREEN
ENDSUB


FUNCTION stretch_y:check_point_polygon[]
RETURN check_point_polygon[0].w+check_point_polygon[0].h
ENDFUNCTION
Title: Re: 123 basic - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-24
Yes because this is syntactically incorrect.

Here is the correct version:
Code: (glbasic) [Select]
TYPE cp
        w%
        h%
ENDTYPE

GLOBAL check_point_polygon[] AS cp
DIM check_point_polygon[1]

check_point_polygon[0].w=12
check_point_polygon[0].h=122

SUB GLB_ON_LOOP:
        PRINT stretch_y(check_point_polygon[]),0,100
        SHOWSCREEN
ENDSUB


FUNCTION stretch_y:check_point_polygon[] AS cp // "AS cp" otherwise it is an double array
        RETURN check_point_polygon[0].w+check_point_polygon[0].h
ENDFUNCTION
Title: Re: 123 basic - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-24
It compiles okay now.

It does seem to have trouble with this :
Code: (glbasic) [Select]
c=((255-((s.zPos*255.0)*0.001))*s.zVel)*0.2
It seems assignment using types is a problem, eg :

Code: (glbasic) [Select]
a=s.zPos (with s defined, of course)

This is in a FOREACH loop

Full routine :

Code: (glbasic) [Select]
       FUNCTION Display%:
        LOCAL s AS T3DStar
        LOCAL c
        LOCAL a

            ALPHAMODE -1.0
            FOREACH s IN self.stars[]
                PRINT s.zPos,0,0,TRUE
                    //a=s.zPos // *255.0
                    //c=((255-((s.zPos*255.0)*0.001))*s.zVel)*0.2
                        //SETPIXEL 0,0,0
                        //((s.xPos/s.zPos)*100.0)+(self.screenWidth%*0.5),((s.yPos/s.zPos)*100.0)+(self.screenHeight%*0.5),RGB(c,c,c)

                NEXT     
        ENDFUNCTION
Title: Re: 123 basic - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-24
Cannot reproduce this bug, would you mind sending me an example code that causes the same issue or something comparable?

Please, before sending bug requests test whether it runs properly with the original GLBasic compiler, because if it does not, it is likely to be a problem with the code itself and not with 123 basic. 123 basic has already successfully a lot of very complex code samples (including ddgui, various samples and 123basic itself - which is around 10000 lines of code that uses every language feature of GLB) and check out the issue tracker (https://github.com/metzzo/123-basic/issues?direction=desc&milestone=1&sort=updated&state=open) on github, a lot of bugs are already known and will be fixed when I've got time
Title: Re: 123 basic - HTML5 for GLBasic
Post by: MrTAToad on 2013-Nov-24
Message sent!
Title: Re: 123 basic - HTML5 for GLBasic
Post by: Qedo on 2013-Nov-24
Coolo,
can you try the program attached?
seem that GETSPRITESIZE don't work.
Qedo
Title: Re: 123 basic - HTML5 for GLBasic
Post by: spicypixel on 2013-Nov-24
Downloaded the 123-basic-master.zip, have compiled the gbap file. Changed the macro.bat to reflect the location of the 123basic.app compiler. However the first post says that it can be compiled from the IDE yet gives no outline how? Also within the Marcro.bat we have these variables %GLB_PROJ_NAME% %GLB_PROJ_PATH% but no outline whether we set them per project and if so then how can we compile from the ide as these can't be fixed variables then either???

Confused?
Title: Re: 123 basic - HTML5 for GLBasic
Post by: metzzo on 2013-Nov-25
Qedo: HTML5 is async, which means the sprite size of image is known when it has properly loaded (GLB_ON_LOOP is then executed). If you want a loading screen use GLB_ON_LOADING and check whether the sprite has loaded with GETSPRITESIZE (which returns the proper size when it has sucessfully loaded the image)
spicypixel: Put the macro.bat into the IDE (blue one for example), when using the macro from the IDE GLB sets the specified variables automatically. For more information read the GLB help file which describes how to set macros in the IDE.
Title: Re: 123 basic - HTML5 for GLBasic
Post by: Qedo on 2013-Nov-25
Quote
Qedo: HTML5 is async, which means the sprite size of image is known when it has properly loaded (GLB_ON_LOOP is then executed). If you want a loading screen use GLB_ON_LOADING and check whether the sprite has loaded with GETSPRITESIZE (which returns the proper size when it has sucessfully loaded the image)

coolo: strange but the same program without modification works with HTML5 GLB (emscripten).



http://web.tiscali.it/edoardobianchi/STUFF/HTML5/bug/bug.html
Title: Re: 123 basic - HTML5 for GLBasic
Post by: Hark0 on 2013-Dec-03
Hi @coolo, triing my game....

First I make a simple Hello world and works without problems on Win64-Chrome...  :good:

Now... Go for compiling my game to html5! It's very huge...

I have this error:

Code: (glbasic) [Select]
-----------------------------------
Error: 'RESTORE label 'datos_Puertas' unknown. (parse error)'
in line '112' at character '0' near 'NEWLINE'
in file '\Variables.gbas'
         'RESTORE datos_Puertas'
-----------------------------------

And for all RESTORE parts...

Sample of code:
Code: (glbasic) [Select]
Datos_Puertas_Cantidad=4
DIM Datos_Puertas_Descripcion$[Datos_Puertas_Cantidad]
DIM Datos_Puertas_Llaves[Datos_Puertas_Cantidad]

RESTORE Datos_Puertas
FOR n=0 TO Datos_Puertas_Cantidad-1
READ Datos_Puertas_Descripcion$[n]
READ Datos_Puertas_Llaves[n]
NEXT

STARTDATA Datos_Puertas:
DATA "null",0
DATA "Puerta 1 llave",1
DATA "Puerta 2 llaves",2
DATA "Puerta 3 llaves",3
ENDDATA

TIA,  ;)
Title: Re: 123 basic - HTML5 for GLBasic
Post by: DaCarSoft on 2013-Dec-04
Hi Hark0!

mmm...   May be that could be a "typo" only in your message here...   But, have you seen that the error is showing "datos_Puertas" with a "D" in low case and your declarations appears to have "D" in upper case???    O_O
Title: Re: 123 basic - HTML5 for GLBasic
Post by: mentalthink on 2013-Dec-04
I have problems again for compile anything... included the samples files.  :O
Title: Re: 123 basic - HTML5 for GLBasic
Post by: Hark0 on 2013-Dec-05
Hi Hark0!

mmm...   May be that could be a "typo" only in your message here...   But, have you seen that the error is showing "datos_Puertas" with a "D" in low case and your declarations appears to have "D" in upper case???    O_O

I try renaming var name... and I post results here ;)
Title: Re: 123 basic - HTML5 for GLBasic
Post by: Hark0 on 2013-Dec-24
Don't work for me... :(
Title: Re: 123 basic - HTML5 for GLBasic
Post by: hardyx on 2013-Dec-25
Don't work for me... :(
Try to put the block STARTDATA...ENDDATA before the RESTORE instruction.
I have to make this sometimes in GLBasic, because the label is defined later.
In classic BASIC, DATA instructions are often put after the RESTORE.