The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
March 29, 2024, 02:24:41 am
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  Technical Issues (Moderator: Death 999)
| | |-+  Porting to the web with emscripten: Removing threads?
« previous next »
Pages: [1] Print
Author Topic: Porting to the web with emscripten: Removing threads?  (Read 6463 times)
quux
Zebranky food
*
Offline Offline

Posts: 10


I love YaBB 1G - SP1!


View Profile
Porting to the web with emscripten: Removing threads?
« on: May 10, 2013, 03:18:52 pm »

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 Offline

Posts: 10


I love YaBB 1G - SP1!


View Profile
Re: Porting to the web with emscripten: Removing threads?
« Reply #1 on: May 10, 2013, 03:19:50 pm »

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 Offline

Posts: 10


I love YaBB 1G - SP1!


View Profile
Re: Porting to the web with emscripten: Removing threads?
« Reply #2 on: May 10, 2013, 09:08:28 pm »

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 Offline

Posts: 116



View Profile
Re: Porting to the web with emscripten: Removing threads?
« Reply #3 on: May 13, 2013, 10:10:56 am »

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 Smiley.
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Porting to the web with emscripten: Removing threads?
« Reply #4 on: May 13, 2013, 08:04:26 pm »

Most of the threads are gone already. I think there is just one left for the audio.
Fossil will know more about this. You may want to join us in IRC on irc.freenode.net, in #sc2.
Although it can take a while before anyone answers.
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
quux
Zebranky food
*
Offline Offline

Posts: 10


I love YaBB 1G - SP1!


View Profile
Re: Porting to the web with emscripten: Removing threads?
« Reply #5 on: May 15, 2013, 11:06:34 pm »

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 Smiley


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
superbutcherx
*Many bubbles*
***
Offline Offline

Posts: 116



View Profile
Re: Porting to the web with emscripten: Removing threads?
« Reply #6 on: May 17, 2013, 08:45:15 am »

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 Smiley


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.

UQM-HD is based on 0.7.0., plus most if not all the updates made to the UQM code after the release of 0.7.0.
Our HD additions to the code are admittedly pretty ugly in places... but hey, it's the end result that the users see Smiley
Logged
quux
Zebranky food
*
Offline Offline

Posts: 10


I love YaBB 1G - SP1!


View Profile
Re: Porting to the web with emscripten: Removing threads?
« Reply #7 on: June 09, 2013, 02:10:12 pm »

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] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!