Pages: [1]
|
|
|
Author
|
Topic: Porting to the web with emscripten: Removing threads? (Read 6886 times)
|
quux
Zebranky food
Offline
Posts: 10
I love YaBB 1G - SP1!
|
Hi All,
I've started the project of porting UQM to the web using http://www.emscripten.org, a C/C++ compiler that emits javascript which can be run in a web browser at a fairly high speed. Emscripten also includes an implementation of a C runtime and standard libraries, SDL, SDL_Image, OpenGL and more, all in javascript
I started with UQM 0.7.0 have the project building now, with the build set to a minimal config. But when I try to run it, the app immediately cleanly quits because threads, mutexes, etc aren't supported in javascript. I was fully expecting this, the emscripten website has a doc describing that threads aren't supported because js just doesn't have them at https://github.com/kripken/emscripten/wiki/CodeGuidlinesAndLimitations. JS has web workers, but they can't share state, they're more like a block of code that can run concurrently and return a result I think.
I know there has been an effort to remove threading from UQM, but never a good enough reason to finish the job, but I think this may be a good reason. Is there any documentation on what's been done and what needs to be done? Should I focus my work on the devel version of the code currently in SVN? Does anyone know of a C library I can use to emulate threads in a single thread that would work with UQM? This may be the easiest way to get the app running.
My major motivation for doing this is to be able to eventually play UQM on my iPhone/iPad. The GPL isn't compatible with the app store, because the app store imposes addition restrictions beyond the GPL. But if you can just play the game by loading a website in Safari, then who cares about the app store? Another option that I think would work around the GPL would be publishing an app in the app store that is nothing more than a "player" for a js compiled version of UQM, which is automatically downloaded from the web. This little hack would, I think, work around the GPL because the downloadable UQM would not have any additional restrictions imposed on it that are incompatible with the GPL. Users would still be free (and encouraged) to download the JS version directly and do whatever they want with it.
|
|
« Last Edit: May 10, 2013, 03:29:00 pm by quux »
|
Logged
|
|
|
|
quux
Zebranky food
Offline
Posts: 10
I love YaBB 1G - SP1!
|
Forgot to add, I'm doing this work in a local git repo right now, but I can put my work in progress and the current compiled output up on github for people to look at.
|
|
|
Logged
|
|
|
|
quux
Zebranky food
Offline
Posts: 10
I love YaBB 1G - SP1!
|
Ok, here's a link to my progress in github : https://github.com/mikeakers/UQM-emscripten
I put a compiled version of the current progress in there. If you clone and open uqm.html in a browser (only tested in firefox and chrome so far) you'll see the game try to start up and then abort when the SDL mutexes can't be created.
I'll see about hosing the html file somewhere for people who don't want to mess with git.
|
|
|
Logged
|
|
|
|
superbutcherx
*Many bubbles*
Offline
Posts: 116
|
Hi, quux! I'm the lead programmer guy of the UQM HD version and I just wanted to say that it's a great thing what you're doing!
Unfortunately I don't understand jack-squat about the threading part of the code. But if you wanna try to emscripten the UQM-HD code some time in the future and want to know more about the HD specific stuff, I'm willing to tell you all about it .
|
|
|
Logged
|
|
|
|
|
quux
Zebranky food
Offline
Posts: 10
I love YaBB 1G - SP1!
|
Thanks guys, next time I get a string of rainy weather here in NYC i'll be doing some more work on it. I'll get on the IRC channel next time I do some hacking
superbutcherx, is UQM-HD based on the same codebase? Or is it a rewrite of some kind. I wasn't immediately sure and haven't looked at the code.
|
|
|
Logged
|
|
|
|
|
quux
Zebranky food
Offline
Posts: 10
I love YaBB 1G - SP1!
|
Hi All, No progress to report, but I've set up a website for my personal projects, and have made a page for this port here http://runway12.com/projects/UQM-emscripten/ .
There's a link on there to play the latest build, but the game still doesn't start due to lack of threads.
I'm currently working on other projects (see http://runway12.com/research/) but I do intend to finish my work on UQM. SC2 is one of my favorite games and getting it onto the web and iOS would open it up to new generations of players.
|
|
|
Logged
|
|
|
|
Pages: [1]
|
|
|
|
|