Author Topic: New version released; v0.6  (Read 28732 times)

SteveOW

  • Guest
Re: New version released; v0.6
« Reply #15 on: August 22, 2013, 08:56:05 AM »
added ability to have an external JS function return multiple values

@Guilect
Please can you elaborate or provide example? e.g. how do I declare external function within BB code?

Also is it possible for  user to code a subroutine/function which changes values of multiple input parameters, e.g.
Code: [Select]
var gA as number =1
var gB as number =2
var gC as number =3

call subTenner (gA,gB,gC)

msgbox(gA + "," + gB + "," + gC)

'=================================

function subTenner (A as number,B as number,C as number)

A = A*10
B = B*10
C = C*10

return A,B,C

endfunction

cheers, SteveOW.

PS Thanks for all the goodies in this new release :D

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: New version released; v0.6
« Reply #16 on: August 22, 2013, 10:18:41 AM »
@Cybermonkey

Yes it is.
Did you recognize the icon?
Yep, so maybe we can keep our fingers crossed for a Linux version one day?

SteveOW

  • Guest
Re: New version released; v0.6
« Reply #17 on: August 22, 2013, 11:02:26 AM »
Yep, so maybe we can keep our fingers crossed for a Linux version one day?

IMO the ideal compiler for BB would be written in BB and runnable (offline if desired) in any standard web browser.
And therefore runnable on any device (windows, linux, android, macOS,...) that supports a standard browser.

It (browser-based compilation) is on my roadmap for Browzic.

cheers, SteveOW.


Guilect

  • Guest
Re: New version released; v0.6
« Reply #18 on: August 22, 2013, 11:07:46 PM »
@ SteveOW

When I mentioned external functions it was in reference to the known external libraries that BB uses such as Box2dWeb.js
On the todo list is to allow users to define external functions and use their own external JavaScript files.

Quote
Also is it possible for  user to code a subroutine/function which changes values of multiple input parameters
I think what you are asking for here is to send in variables by reference rather than by value.  Am I correct.  If so, JavaScript has no means to send primitive variables by reference to a function.  However, objects are sent by reference.  That means Types.  Having a Type as a function input parameter will be available in the next release.

@Cybermonkey

I used RedHat for a very short time a lifetime ago.
So I remember little about *nix.
Here is a build I did for linux.
If you have the time I would appreciate you seeing if it works.
It is just the compiler.  You will need to use some editor and pass the filename of the BB code to this.  The compiler will then spit out an .html file of the same name.

linux version here
« Last Edit: August 22, 2013, 11:38:10 PM by Guilect »

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: New version released; v0.6
« Reply #19 on: August 23, 2013, 11:40:17 AM »
Thanks a lot. I will give it a try at the weekend.

bolbo

  • Guest
Re: New version released; v0.6
« Reply #20 on: August 23, 2013, 01:00:25 PM »

IMO the ideal compiler for BB would be written in BB and runnable (offline if desired) in any standard web browser.
And therefore runnable on any device (windows, linux, android, macOS,...) that supports a standard browser.

It (browser-based compilation) is on my roadmap for Browzic.

Something like this ?
http://www.kevs3d.co.uk/dev/scratchpad/

bolbo

  • Guest
Re: New version released; v0.6
« Reply #21 on: August 23, 2013, 01:42:27 PM »
Guilect, I thought that you might be interested in reading this recent discussion :
http://www.html5gamedevs.com/topic/686-to-box2d-or-not/#entry3619
They talk about performances of different physics engines on mobile devices,  Turbulenz engine and Chipmunk-JS seem to work well unlike  Box2D.
Thanks
 

Guilect

  • Guest
Re: New version released; v0.6
« Reply #22 on: August 23, 2013, 03:23:50 PM »
Hi bolbo,

Thanks for the links.
While the idea being  able to program from any device sounds great, the practicality of it is not.
Who would want to try to code a program on their phone?
Being able to run your code on your phone is great.
Being able to use a full keyboard, a good editor, and saving and loading files from a hard drive is better.
Saving files from different browsers, on different OSes, on different platforms is a big pain.
Security restrictions do not allow access to a local hard drive from the browser.

I looked at a bunch of options for physics. 
One of the most important things that was required was the ability to take the API of the physics engine and make it fit into BASIC syntax.  The other choices for physics engines seemed too javascript-like to port over.
Box2d is slow on mobile devices today.  But, these mobile devices will get faster.
If you need more speed for a mobile device I would also recommend, like they did in the article, that you just code a few small routines to simulate the physics behavior that you want.

bolbo

  • Guest
Re: New version released; v0.6
« Reply #23 on: August 23, 2013, 04:46:37 PM »
Guilect, thanks for sharing your design decisions with us. It is not my intention to put pressure, just to notice that Box2d does not work well on mobile devices currently (nor in many desktop pcs apparently). Besides, Turbulenz's physics engine is said to mirror Box2D's APIs so you may want to consider supporting it in the future if Box2D keeps being slow in quite a few cases.   

SteveOW

  • Guest
Re: New version released; v0.6
« Reply #24 on: August 24, 2013, 11:43:23 AM »

IMO the ideal compiler for BB would be written in BB and runnable (offline if desired) in any standard web browser.
And therefore runnable on any device (windows, linux, android, macOS,...) that supports a standard browser.

It (browser-based compilation) is on my roadmap for Browzic.

Something like this ?
http://www.kevs3d.co.uk/dev/scratchpad/
@ Bolbo,

Yes indeed I am thinking of something like that but with the user seeing Browzic code instead of Javascript.
I have not seen this particular app before, I have seen several others which as I recall are based on something called CodeMirror.
The idea is that a user can program inside the browser without the need to access a remote server.

It is not easy for browser based apps to exchange data with the local hard drive but it can be done.

One way is using cookies but this is a bit crude.

Another way which I have recently come across is by using the HTML5 Local Store facility but I presently am a bit vague on this.

Another way is by the user cutting and pasting text or data into and out of html form fields (from and to text files opened by the user on the desktop).
(I demo this technique in my Pond and PongGoneWrong demos (http://www.zen226082.zen.co.uk/ 
This is rather crude of course.

Another way is by use of image files with the user selecting hard-disk files for the browser to read and write to and the browser (somehow) coding and encoding between meaningful data format and image data format.

SteveOW

  • Guest
Re: New version released; v0.6
« Reply #25 on: August 24, 2013, 12:00:41 PM »
@ SteveOW

When I mentioned external functions it was in reference to the known external libraries that BB uses such as Box2dWeb.js
On the todo list is to allow users to define external functions and use their own external JavaScript files.

Quote
Also is it possible for  user to code a subroutine/function which changes values of multiple input parameters
I think what you are asking for here is to send in variables by reference rather than by value.  Am I correct.  If so, JavaScript has no means to send primitive variables by reference to a function.  However, objects are sent by reference.  That means Types.  Having a Type as a function input parameter will be available in the next release.

Re:external functions ...ah  I see, thanks.

Re:function input parameters...yes "by reference rather than by value" is effectively what I mean. 
I didnt realize that JS doesnt handle this. 
Forcing use of typed objects might be a bit harsh on a novice programmer?
I can see a way of doing it in javascript using global variables which could be invented by the BB compiler at compile time.
Not elegant but it could be hidden from the BB user. Probably would hobble performance if over-used.

SteveOW

  • Guest
Re: New version released; v0.6
« Reply #26 on: August 24, 2013, 12:19:59 PM »
Who would want to try to code a program on their phone?
Do you remember programmable hand-held calculators with their one-line displays?
I think if a phone can run a spreadsheet then it could also let you write off-the-cuff programs.
In my line of work having a pocket device that you can program geometric and iterative algorithms on is quite nice to have.

I certainly want to be able to program on my tablet.
I realize not many other serious programmers might want to.
But with schoolkids increasingly using tablets these days I think it is a great way to get kids into programming.
I'd like to see Browzic one day having one front end similar to the MIT Scratch tool allowing novices to start with iconic/sprite-based animation programming and then move on if they desire to monolithic line-by-line textual code.


Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: New version released; v0.6
« Reply #27 on: August 25, 2013, 04:42:50 PM »
@Cybermonkey

I used RedHat for a very short time a lifetime ago.
So I remember little about *nix.
Here is a build I did for linux.
If you have the time I would appreciate you seeing if it works.
It is just the compiler.  You will need to use some editor and pass the filename of the BB code to this.  The compiler will then spit out an .html file of the same name.
Ok, I tried it. From what I can say all examples compile correctly. Only the physics example does not work. It compiles but the scenery comes up for some ms and then there is a grey background. But this is the same with Windows. Tested with Firefox and Chrome. Maybe I did anything wrong?

Guilect

  • Guest
Re: New version released; v0.6
« Reply #28 on: August 25, 2013, 07:12:02 PM »
Quote
physics example does not work
That would be because I forgot to include an image file in the release.
I will update the release download package.
But, if you want, just download the attached image and place it in the 'examples\img' folder.

Thanks for testing it by the way.
I will try to produce a linux version as well from now on.

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: New version released; v0.6
« Reply #29 on: August 25, 2013, 08:13:06 PM »
Yep, that was it. Now it works! If I have a bit free time I'll try to port one of my simple games to BrowserBasic.
(Just uploaded the first book on CreateSpace - not written by me but as a publisher - so time is rare at the moment.)