This seemed like a foolish dream until the development of emscripten. Emscripten is a cool technology driven by Mozilla that will allow you to compile c++ code into javascript which will then run in a web browser. How it works is that it uses the Clang/LVVM compiler c++ compiler, which itself first compiles c++ to a 'low-level virtual machine' code. Emscripten takes the LLVM code and compiles it into javascript, with options for optimizing speed that supposedly can be close (i.e., maybe 200% of) native speed. Because we aren't number crunching, this should be fine for PEBL, so I have started looking at what it would take to port PEBL to emscripten.
The real kicker is that emscripten supports SDL by default, which means that most of the display and hopefully even keyboard stuff will be transparent.
There are a number of obstacles that will need to be overcome. I'll make a list of a few here:
- Will PEBL really compile and run, with its use of the many complex libraries, templates, flex/bison generated code, a fairly low-level counted-pointer reference system, hardware interactions, etc.?
- How can we make PEBL asynchronous? The recursive evaluator which steps through a PEBL experiment provides no easy way to cede control to the browser. This will likely be the obstacle that prevents success.
- How can we handle file I/O? Javascript has limited support of file operations. Will it be possible to save data after an experiment runs?
- How can we easily support running/selecting experiments for users
No comments:
Post a Comment