Fork me on GitHub

BrightScript 2D API Emulator :: v0.5 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 those.

The solution would be to develop an emulator for the platform, but that 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:

You can also find above, a couple of commercial channels I created for Roku that are available at the Channel Store.

Technology and 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. Starting from v0.5.0 Alpha, in addition to the sample web application, the release also includes a multi-platform desktop application (Windows, Linux & Mac) that uses the same library generated by this project. The desktop app can be dowloaded from the project Release Page, the source code is also available at https://github.com/lvcabral/brs-emu-app.

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. Please check the project documentation to get an updated list of all current limitations.

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.

Documentation and Download

To learn more about the project visit the repository at: https://github.com/lvcabral/brs-emu/

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