The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
August 17, 2022, 09:18:46 pm
Home Help Search Login Register
News: Paul & Fred have reached a settlement with Stardock!

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  General UQM Discussion (Moderator: Death 999)
| | |-+  UQM port for Chrome (using Native Client)
« previous next »
Pages: [1] Print
Author Topic: UQM port for Chrome (using Native Client)  (Read 4849 times)
davidben
Zebranky food
*
Offline Offline

Posts: 6



View Profile
UQM port for Chrome (using Native Client)
« on: March 04, 2012, 12:19:14 am »

Hi all,

I've ported UQM to Native Client so you can run it in Chrome. If you're not familiar with Native Client, it's a way to securely run native code in your web browser.

The code's on Github. The vast majority of the changes are buildsystem-related. Once it actually builds, the game basically just works. It works by setting up a virtual filesystem where user data is backed onto an HTML5 filesystem, and game data is downloaded on-demand and also cached locally. The game itself runs largely unmodified. The files themselves are separated into packs provided by the nacl-mounts library. I'm not using the built-in zip mounting system for now as I want the data split into more files; in particular, you only have to download each alien's voice files as you meet them, so the initial download's not too bad. Perhaps a future version could reuse the zips (the main requirement is that you know what files are in what pack without reading them).

I put it at http://uqm.davidben.net/ for now if anyone wants to try it. You'll need to enable Native Client in about:flags to run it. (This won't be needed once it's in the Web Store.) (Edit: It's in the Web Store now. Install it here.)The front-end HTML around the port is extremely basic and needs styling. I just put in the bare minimum needed to show download progress and the like for now. But for the most part, it should work. The github page has a list of some known issues.

I'm posting this here to gauge interest in this sort of thing, and also to see if upstream would be interested in taking the changes. I'm envisioning that a future versions could do things like sync your saved games on the server, maybe even support network play over WebSockets. (So no mucking about with IP addresses or routers.) The other question is hosting. I'm happy to find a place to host this and submit it to the Web Store, but I wanted to see if upstream would prefer managing the hosting and Web Store submission.

So, what do people think? Is there interest in having this maintained by UQM?
« Last Edit: March 10, 2012, 04:30:14 am by davidben » Logged
Admiral Zeratul
*Many bubbles*
***
Offline Offline

Gender: Male
Posts: 223


I enjoy overthinking things.


View Profile
Re: UQM port for Chrome (using Native Client)
« Reply #1 on: March 04, 2012, 02:41:45 am »

This is a great idea! I would even go so far as to call it brilliant!
Logged

Priority override. New behavior dictated. Must break post into component ideas.
Spurk
*Many bubbles*
***
Offline Offline

Posts: 115



View Profile
Re: UQM port for Chrome (using Native Client)
« Reply #2 on: March 04, 2012, 02:43:37 am »

You are awesome!

I have started using a chromebook rather heavily at home and when I want to play a game, there are never many choices. But UQM for NaCl is great! I am totally in favor of putting that in the Web Store, but I'll be bookmarking your page in the meantime.

As for the web trimmings, I think they're fine. I'm sure you could probably make things less spartan on one hand, but at the same time, it serves its purpose and gets out of the way otherwise. I especially like the use of the progress bar to let me know when things are loading.

I quite understand your desire to see if the upstream people want to manage the Web Store submission and/or code, though I note the Android port is not maintained by them.
Logged
Megagun
Enlightened
*****
Offline Offline

Gender: Male
Posts: 580


Moo


View Profile
Re: UQM port for Chrome (using Native Client)
« Reply #3 on: March 04, 2012, 07:40:31 pm »

Hah. Nice. This is definitively something I'd want to look into for Project 6014.
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: UQM port for Chrome (using Native Client)
« Reply #4 on: March 06, 2012, 07:45:25 pm »

Nice work.

As for merging with the upstream; I'm willing to commit patches which don't get in the way of the rest of the code and don't require attention after the initial commit. It's a nice addition, but not something that we wish to maintain ourselves.
(Though I'm not a big fan of NaCl itself; it goes against the principles of the open web, being locked to Google and going back to black boxes.)
Logged

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

Posts: 6



View Profile
Re: UQM port for Chrome (using Native Client)
« Reply #5 on: March 06, 2012, 09:44:18 pm »

Glad to hear people like it. I'll post here when I get around to putting it in the Web Store.

Quote
As for merging with the upstream; I'm willing to commit patches which don't get in the way of the rest of the code and don't require attention after the initial commit. It's a nice addition, but not something that we wish to maintain ourselves.

Fair enough. I will open a bug then and see what can be merged. The changes to the core code are minimal, and I did my best to work with the existing buildsystem. But there were places where I had to add ifdefs (such as this awful awful hack). The full diff from 0.7.0 is here if you want to see it. If I ever get around to them, some of my future plans will likely be more invasive (such as the netplay server, or more communication between the resource system and the bits that download game data), but hopefully I can write them in such a way as to be minimally intrusive if not generally useful to the project. I'm willing to maintain patches that aren't deemed acceptable, but obviously the less I have to rebase the easier it will be on my end.

Quote
(Though I'm not a big fan of NaCl itself; it goes against the principles of the open web, being locked to Google and going back to black boxes.)

Heh. Mostly I just think it (and SFI in general) is an interesting technology, but I agree it is a shame that this is Chrome-only. No other browser's intending to pick up NaCl to my knowledge. I'm thinking of trying out Emscripten to see if that could used as a fallback; I've seen some reference to a canvas-backed SDL implementation. Not sure how the performance is. (Maybe when PNaCl happens, someone will write a PNaCl to JS compiler by plugging in Emscripten. That would actually be rather amusing.)
Logged
davidben
Zebranky food
*
Offline Offline

Posts: 6



View Profile
Re: UQM port for Chrome (using Native Client)
« Reply #6 on: March 10, 2012, 04:28:57 am »

And it's in the Web Store now. Along with slightly nicer web trimmings.

https://chrome.google.com/webstore/detail/dieafepjepbfogacjnifndljhlpiggmb
Logged
Admiral Zeratul
*Many bubbles*
***
Offline Offline

Gender: Male
Posts: 223


I enjoy overthinking things.


View Profile
Re: UQM port for Chrome (using Native Client)
« Reply #7 on: March 10, 2012, 08:55:17 am »

I just played Super Melee in Google Chrome! That is very nice indeed. However, the loading times are quite long.
Logged

Priority override. New behavior dictated. Must break post into component ideas.
davidben
Zebranky food
*
Offline Offline

Posts: 6



View Profile
Re: UQM port for Chrome (using Native Client)
« Reply #8 on: March 10, 2012, 10:05:21 am »

Yeah, for some reason the filesystem setup is all rather on the slow side. I haven't really figured out what's up there. It might just be slow. I am planning to make one change to how nacl-mounts buffers things that should help a lot though. The current setup isn't being anywhere near as effective as it should be.

That said, downloading game data (any time there's a progress bar at the bottom) should be a one-time cost. That all gets cached locally. Edit: To clarify, downloading each individual hunk of game data is a one-time cost. To avoid a 150MB up-front cost, things get loaded on-demand. Most notably you only download a race's voice files when you first meet them.
« Last Edit: March 10, 2012, 10:12:33 am by davidben » Logged
Elestan
*Smell* controller
****
Offline Offline

Posts: 431



View Profile
Re: UQM port for Chrome (using Native Client)
« Reply #9 on: March 11, 2012, 08:36:46 am »

The changes to the core code are minimal, and I did my best to work with the existing buildsystem. But there were places where I had to add ifdefs (such as this awful awful hack). The full diff from 0.7.0 is here if you want to see it. If

It would probably make it easier to merge if you branched from the current SVN head (see instructions at http://wiki.uqm.stack.nl/The_Ur-Quan_Masters_Technical_FAQ#Where_do_I_get_the_game.3F).  For one thing, I added C++ support to the build system a couple of months ago, so our changes there are going to collide where they aren't identical.
« Last Edit: March 11, 2012, 08:38:43 am by Elestan » Logged
davidben
Zebranky food
*
Offline Offline

Posts: 6



View Profile
Re: UQM port for Chrome (using Native Client)
« Reply #10 on: March 11, 2012, 08:41:57 am »

It would probably make it easier to merge if you applied the diff to the current SVN head (see instructions at http://wiki.uqm.stack.nl/The_Ur-Quan_Masters_Technical_FAQ#Where_do_I_get_the_game.3F).  For one thing, I added C++ support to the build system a couple of months ago, so our changes there are going to collide where they aren't identical.

Indeed they did.  Wink I wanted to base the port off 0.7.0 just so I had a stable base to work off of. I rebased the changes on top of trunk before filing bug to merge them. (See branch rebased or link below.) I resolved the conflicts between our changes (had to adjust them slightly). If only I had noticed the change when I started.

https://bugs.uqm.stack.nl/show_bug.cgi?id=1162

(Yeah, I know how to pull trunk. That's a git-svn clone you're looking at there.  Tongue )
« Last Edit: March 11, 2012, 08:47:54 am by davidben » Logged
dczanik
*Smell* controller
****
Offline Offline

Posts: 306



View Profile WWW
Re: UQM port for Chrome (using Native Client)
« Reply #11 on: March 20, 2012, 11:35:38 pm »

Awesome!!  Fantastic job. Yeah, the loading time is a little slow.  I personally would prefer to download the game files up front before playing. I hate load times  Undecided

I posted the news on moddb.com too.  I'm amazed at how many platforms the game is available on. Now we just need  HTML 5 programmers to port the game...  Wink
Logged

- Damon
Ur-Quan Masters HD Project leader/artist. Project 6014 Artist.  Like my art? Please check out some of my other artwork
davidben
Zebranky food
*
Offline Offline

Posts: 6



View Profile
Re: UQM port for Chrome (using Native Client)
« Reply #12 on: March 25, 2012, 12:24:55 am »

I've fixed a lot of low-hanging fruit in nacl-mounts (turns out it implements a LOT of filesystem operations slow) and updated the build. If you visit the page now, the startup time should be comparable to the desktop version.
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!