In-browser BBC BASIC for SDL 2.0

New releases of BB4W and BBCSDL, and other updates, will be announced here
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

RichardRussell wrote: Fri 04 Sep 2020, 13:46 This allows you to run a program that needs resource
Note that you don't need to repeat the full URL for each file, if just a filename is specified &load= and &chain= will assume the rest of the URL is the same as before.
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

I have updated the in-browser edition of BBC BASIC for SDL 2.0 to version 1.14y. The differences in this version are:
  • Fixed a performance issue caused by yielding to the browser too often, which throttled graphics output.

  • Added the sortlib and eventlib libraries, compatible with those supplied with the other editions.

  • Added sorttest.bbc, in the examples/general/ directory, to test the sortlib library.

  • Added multitouch.bbc, in the examples/general/ directory, to demonstrate the eventlib library (needs a touchscreen).

  • Restored aliens.bbc to animate 80 sprites, to demonstrate the improved graphics performance (I get about 30 fps on my Core i7 laptop and 48 fps on my fastest desktop, both in Microsoft Edge).
Users of 32-bit Windows please note that a few of the supplied programs do not work properly, seemingly because of a bug in the 32-bit WebGL.
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

The in-browser edition of BBC BASIC for SDL 2.0 now runs in Firefox as well as Edge and Chrome (desktop versions).
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

I've updated the in-browser BBC BASIC for SDL 2.0 so that the @usr$ folder is now 'persistent', i.e. files stored there will not be discarded when you close the page and should still be there the next time you run BBC BASIC (in the same browser). That directory is typically where custom settings or game state (e.g. high score) are stored; you may save your own programs there too.

It's possible that performance may be adversely affected if there are many and/or large files stored there, but that will need to be ascertained by experience. If you don't have need of persistent storage, save files in @tmp$ instead.
mikeg
Posts: 101
Joined: Sat 23 Jun 2018, 19:52

Re: In-browser BBC BASIC for SDL 2.0

Post by mikeg »

I've updated the in-browser BBC BASIC for SDL 2.0 so that the @usr$ folder is now 'persistent'
If there was any project that stood out as ground breaking, this project would be it. I am testing it on my devices. If a person could provide a link to a finished program to anyone, to execute in the browser and interact, you would be become famous, even if it only allowed you to provide demonstrations.

Have you tried anything on Safari browser?

Say I type a program inside the editor. How do I store it in the @usr$ directory?
Focus is on code subject. Feel free to judge the quality of my work.
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

mikeg wrote: Tue 15 Sep 2020, 01:57 Have you tried anything on Safari browser?
There's no sign of Apple wanting Safari to support the advanced WebAssembly features that BBC BASIC needs, unfortunately. My understanding is that they are not keen on 'web apps' because they can't claim their 30% cut as they do for App Store apps. I suppose that's how they became the richest company in the world!

There's a table at the bottom of this page which lists the current state of support. It's limited to (desktop) Chrome (v68 or later), Edge (v79 or later), Firefox (v79 or later) and node.js (8.10 or later).
Say I type a program inside the editor. How do I store it in the @usr$ directory?
Upload the program to somewhere on the web then enter this in the address bar of your browser:

Code: Select all

https://www.bbcbasic.co.uk/bbcsdl/wasm/bbcsdl.html?dir=/usr&load=<myURL>
where <myURL> is where your program can be found. That's the only way to penetrate the browser's sandbox, as far as I know.
michael
Posts: 43
Joined: Mon 02 Apr 2018, 17:13

Re: In-browser BBC BASIC for SDL 2.0

Post by michael »

So with such a link would I use a Dropbox link for my code? Would One Drive link work?

It appears that this runs in my browser but does your site use up more band width for the above link? It seems to be hosting the sand box app.
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

michael wrote: Sat 19 Sep 2020, 01:04So with such a link would I use a Dropbox link for my code? Would One Drive link work?
I doubt that Dropbox or OneDrive would work because I don't think their shared links take you directly to the file. Your ISP may provide a little web space, mine does and that's what I'm using.
It appears that this runs in my browser but does your site use up more band width for the above link? It seems to be hosting the sand box app.
Yes, bbcbasic.co.uk has to serve about 5.5 Mbytes each time (bbcsdl.html and the associated files), that's inevitable. This is somewhat more than it needs to be because the example programs are included. We will have to see if that threatens to exceed the bandwidth limit.
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

To my considerable surprise (because it says here that it shouldn't) the latest version of Opera successfully runs the in-browser BBC BASIC. However the speed seems not to be very good compared with the others, running Tyoob at only about half the frame rate of Firefox here. Still, if you use Opera it's worth knowing.

Here's another little online demo, David Williams's kaleidoscope program.
michael
Posts: 43
Joined: Mon 02 Apr 2018, 17:13

Re: In-browser BBC BASIC for SDL 2.0

Post by michael »

I doubt that Dropbox or OneDrive would work because I don't think their shared links take you directly to the file. Your ISP may provide a little web space, mine does and that's what I'm using.
Ok so how did you arrange this? Is this with your web site using port forwarding or did you somehow arrange a location with your ISP to place the info? How did you do that? (also the kaleidoscope program works well on Edge.