Fork me on GitHub

BrightScript 2D API Emulator :: v0.3 Alpha







About the Project

As a BrightScript developer since 2012, I always wanted a way to test my code without the need of a Roku device, in situations like a long flight or a place without any wireless network available. Then in 2016 I decided to learn about the ifDraw2D API in order to develop games for the platform, so I created a few open source remakes of classic games (see links below on Games and Demos). These projects were very challenging and exciting to develop, but brought me some frustration with it, as very few people outside the USA has access to the Roku platform, so a lot of people could only see videos of my games, but never play it.

The development of an emulator for the platform was, to me, a very complex endeavor to start as a side project, so I shelved the idea in my Brain Dump Trello board, until recently, when I learned about the brs open source project, created by Sean Barag, that consists of a command line interpreter for BrightScript.

I could immediatly see, that this project would be the piece that was missing to turn my emulator project a reality! I forked brs and started sending pull requests to the project, so the interpreter could have the minimum set of components that would make possible for me to work upon it. In the same weekend I could develop a working proof-of-concept using HTML5 Canvas and after a month of nights and weekends studying TypeScript/Javascript, and exploring all sort of options to overcome different challenges, I finally came up with this prototype that is available here.

Games and Demos

You can try the emulator by loading one of the games or demonstration channels, using the clickable icons above or loading your own code, either as a single .brs file or a channel .zip package. Some of the games are available as open source projects at the repositories linked below:

Compatibility

This emulator is bundled as a Webpack Javascript library that runs as a Web Worker in the browser, and it uses features like SharedArrayBuffer and OffScreenCanvas, that are bleeding edge in the browser engines implementation, because of that, at this moment, it can only be executed in Chromium based browsers, like Chrome, Brave, Opera and the new Edge Insider. The BrightScript 2D API Emulator is a full client-side application, nothing is sent or processed in the server side.

Current Limitations

As mentioned above, this emulator is a prototype, this way, there are several features from the BrightScript language and components that are still not supported, some are planned to be implemented, others will stay as mock objects (for compatibility), and some are considered out of scope of this project. Below is the current list of those limitations:

In Scope (to be developed/fixed)

In Scope (to be mocked)

Out of Scope

Note for Developers

You can see the debug messages from print statements in your code using the browser console, just right click anywhere in the page and select Inspect (Ctrl+Shift+i). Exceptions from the emulator will be shown there too. If your code does show an error in some scenario not listed on the limitations above, feel free to open an issue at the project's GitHub repository.

Download

You can download this project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://github.com/lvcabral/brs-emu.git