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 »

michael wrote: Sun 20 Sep 2020, 01:19 Ok so how did you arrange this?
I didn't "arrange" anything, the web space came as standard with my broadband subscription (I'm with Zen).

I can see that this is potentially a bigger problem than I thought, so I have hacked my downloading process so that it will now accept shared Dropbox links. For example you can try this:

https://bbcbasic.co.uk/bbcsdl/wasm/bbcsdl.html?chain=https://www.dropbox.com/s/67im9j08gn5g2yh/omitlastpoint.bbc

Make sure that you omit the '?dl=0' which Dropbox may append to the link.
michael
Posts: 43
Joined: Mon 02 Apr 2018, 17:13

Re: In-browser BBC BASIC for SDL 2.0

Post by michael »

I have hacked my downloading process so that it will now accept shared Dropbox links
Ok thanks. I just need to get a Dropbox account..
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

Here's another of David Williams's games which runs nicely in a suitable browser: Rainbow Snake.

Something to note: if you use SYS "SDL_SetWindowTitle" ensure that you include @memhdc% as the last parameter; that's necessary anyway for it to work reliably in MacOS but the in-browser edition crashes if you don't!
mikeg
Posts: 101
Joined: Sat 23 Jun 2018, 19:52

Re: In-browser BBC BASIC for SDL 2.0

Post by mikeg »

I improved my program using the Task Manager and got between 0.2 and 0.9% and then used a drop box link to use the web version and it worked awesome.

https://bbcbasic.co.uk/bbcsdl/wasm/bbcs ... 202020.bbc

I am still working on isolating the draws, but 0.9 % of CPU usage is a big improvement.. I didn't try the task manager on this link yet but I will try it.

UPDATE: when running this program in the web the trading app takes 9% of CPU. Compared to the Forum that uses around 2% on EDGE

The program DEFINITELY needs to be improved further for efficiency.. I am working on your suggestions to suppress the redraws.
*Thankfully I used the most inefficient version of the stock trader on my gaming computer* i7 ROG gaming laptop. Had I known how bad it was I would have started modifications earlier.

Question though. With a drop box link, would I link a folder for this if I had other files that the program needed? Have you tried that yet?(for drop box)
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: Thu 24 Sep 2020, 03:48With a drop box link, would I link a folder for this if I had other files that the program needed?
There's no way of loading an entire folder. If you've got more files than can conveniently be loaded individually, I suggest you adopt the same approach as I did for Tyoob (which uses more than 500 resource files - no I'm not kidding!) which was to pack them into a single data file which you unpack after loading. That's why there's tyoob_loader.bbc which does the unpacking: each of the dots it prints is a separate file. Rainbow Snake uses the same technique, except that David Williams built it into the program itself, so no explicit loader/unpacker is required.
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

The latest program to be ported to the in-browser edition of BBC BASIC is mandel which displays the Mandelbrot Set and allows you to pan and zoom it. This runs best in Firefox, in the other browsers it occasionally crashes with a 'WebGL context lost' error (as it works in Firefox I assume this is not my fault!).
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

The in-browser edition currently starts up at the immediate-mode prompt if no URL parameter is specified; to run the supplied example programs you must change directory (e.g. *cd examples/graphics) and then CHAIN the program you want. Would it be better for it instead to run the 'touch IDE' at start-up, as do the Android and iOS editions (despite its name it can be used with a keyboard and mouse)?
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

RichardRussell wrote: Thu 24 Sep 2020, 22:37Would it be better for it instead to run the 'touch IDE' at start-up, as do the Android and iOS editions?
There's been disappointingly little feedback, but what I have received has been positive so I've made the change experimentally. Here is the revised version, let me know what you think (if you're not familiar with the Touch IDE there's a brief description here). I can easily switch it back to how it was if necessary.
DDRM

Re: In-browser BBC BASIC for SDL 2.0

Post by DDRM »

Hi Richard,

I like it! I think it's much more friendly.

Best wishes,

D
RichardRussell

Re: In-browser BBC BASIC for SDL 2.0

Post by RichardRussell »

DDRM wrote: Sat 26 Sep 2020, 09:01 I like it! I think it's much more friendly.
I've never considered the in-browser edition to be a platform on which you would develop BBC BASIC software, not least because there's no way of exporting or backing up what you've written! Rather it's more of a run-time engine, giving you an option for deploying programs that you've written and tested conventionally on a desktop platform. As such it seemed to me that 'user friendliness' wasn't really an important attribute.

So whilst I'm pleased that you like the new interface, my view is that it's really only of value for browsing and running the supplied examples rather than as a practical IDE. I intend to add more examples, but they will be downloaded 'on demand' rather than supplied with the package, to keep it small. In the latest update 'snake' (in the games directory) and 'clock' (in the graphics directory) are in that category.