Search Unity

Unity3D Google Chrome NativeClient (NaCl)Support?

Discussion in 'General Discussion' started by Tseng, Dec 7, 2011.

  1. Tseng

    Tseng

    Joined:
    Nov 29, 2010
    Posts:
    1,217
    I just found this on Google Plus Stream:

    Basically it's about AngryBots being ported to Google Chromes NativeClient (NaCl).

    Now, this makes me curious. What's actually necessary to port it? Is it done with some of the existing Unity3D version or is it something done with the upcoming 3.5 version? It sounds pretty interesting and I would like know more about it. anyone know more about it?
     
  2. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    Unity 3.5 supposedly includes a NaCl export option. How much we'll have to mangle existing code to get it to work, I don't know. Hopefully, not much ;)
     
  3. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    I would think that if they do launch the native-code export it would be just as fully featured and 100% total support like the web player would be.
     
  4. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,133
    One thing I am wondering is, when you click 'Add To Chrome', it then downloads a 55 mb file???

    Will that be standard? Or just because its beta?

    I thought NaCl would work just how the unity web plugin works, just without the need for installing the plugin.

    As in, it would be able to open a web page with NaCl unity content, and just display it, or ideally stream it. So you could get your Unity content loaded and on screen immediatly.

    If thats not true and instead the user is going to have to download the entire NaCl app before it can run, that kind makes it considerably less useful.... The user still has to agree to download something, and wait for it to download, and even worse, it has to download the entire game package before it runs.
     
  5. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    I just tried the Angrybots game in Chrome on Mac, and it worked and installed seamlessly. A pretty sweet way to distribute games to Chrome users!

    I don't have access to the 3.5 beta though, so I don't know what the build process is like.

    But I can surely see some confusion about what is the Unity Web Player vs. the NaCl app player. Also considering the Chrome web store says "There are two different types of installable web apps: packaged and hosted. Hosted web apps are regular web apps, served from web servers. Packaged web apps are bundled and are completely installed into the user’s browser."
     
  6. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,133
    Oh I see. Well hopefully Unity can run as a hosted web app.
     
  7. npsf3000

    npsf3000

    Joined:
    Sep 19, 2010
    Posts:
    3,830
    Impressed.
     
  8. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    NaCL does not run as webapp, its native code, not some 'web thing'. it has to be installed in chrome. Be it through the Chrome store or by changing the chrome configs to allow non market NaCL apps to install.
     
  9. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    This is not correct. The Chrome web store allows distribution as packaged apps, which download all content (nacl executable and unity3d file) onto the users disk for fast and offline access. This is not a requirement, however. When using an unpackaged app, everything is downloaded from a web page, just like an embedded image file. This is also possible to do without using the chrome web store, however, for the time being, NaCl is only enabled by default for CWS content, and needs to be manually enabled (in chrome://flags) to work for generic web pages. But there is no requirement for installation of anything.
     
  10. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Ah okey. something new learnt.

    thought it was still no webapp no matter how you turn it as it runs on NaCl not on HTML5
     
  11. Tseng

    Tseng

    Joined:
    Nov 29, 2010
    Posts:
    1,217
    I grabbed the beta to try it out. Looks pretty neat so far. It's an addtional checkbox on WebPlayer build settings. But wow, the nacl binaries files are huge!

    From my game which compiles to 10 MB WebPlayer file, it becomes a 110 MB one with nacl, where the binaries are ~100 MB (for x86 x64).

    @Jonas: Well, from what I see, unity games won't be able to served as packaged apps in the store, because it's currently limited to 10 MB and unity binaries alone are much bigger than that.

    Would love to play bit more with it, but it's pretty hard to have 2 different unity installations on the same PC. If I start 3.5 Beta, it tries to open the old project I edited in 3.4. If i create a new one (or backup the old) and convert it, and start 3.4 it opens the project last opened in 3.5 and break it, cause both installations use the same registry entries to safe the settings and last opened project list -.-
     
  12. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    @Tseng, if you hold down option / alt key when launching Unity, you get the Project Wizard and can choose whatever version of project you want to open.

    "Well, from what I see, unity games won't be able to served as packaged apps in the store"

    Just want to point out that AngryBots is in the chrome web store right now, and the download is only 50MB or so. I am assuming that is all unity engine + angrybots content, because the NaCL engine is already embedded in Chrome. What would be the whole point of all this right?
     
  13. Tseng

    Tseng

    Joined:
    Nov 29, 2010
    Posts:
    1,217
    Yea, the unity engine itself is ~50 MB (unpacked) per archtecture (x86 / x64).

    http://code.google.com/chrome/webstore/docs/choosing.html

    So everything that's > 10 MB zip packed has to be a hosted app (where you upload the *.cbx file to your webspace and chrome downloads is from there on install)
     
  14. taumel

    taumel

    Joined:
    Jun 9, 2005
    Posts:
    5,292
    I've played Bastion (from the Google web store) via Chrome's native client.

    Pro: It worked on OS X.
    Con: No gamepad support without some tweaks.

    What i would like to know is if there also is a way to run such an app without Chrome. Let's say you bought a number of games this way and after two years Chrome isn't fond of the native client anymore, does there exist something like a stub app to run the games?
     
  15. npsf3000

    npsf3000

    Joined:
    Sep 19, 2010
    Posts:
    3,830
    Chrome is opensource and it's backed by google. So you've got the long term support of a giant tech company mixed with the freedom and power of the nerds.

    I wouldn't say it's a big risk.
     
  16. taumel

    taumel

    Joined:
    Jun 9, 2005
    Posts:
    5,292
    Oh, Google also dropped technology, remember O3D for instance?
     
  17. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Possible but
    1. Chrome is open source
    2. There are already 4 or so pretty strong spinoffs (including the globally most secure browser Comodo Dragon among some others)

    so the probability for it to vanish goes towards 0.
    Also don't forget: Its one of many targets, nothing prevents you building flash - webplayer - standalone from it along the chrome one. its just one more target thats relatively easy and not as limited as flash stage3d will be for example
     
  18. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    The quoted 10 MB limit for packaged apps is no longer present. See the linked AngryBots build on the Chrome Web Store. Any docs stating so are outdated. I believe the current limit is 100 MB compressed.

    As for the size for non-packed apps: Yes, the build is ~100 MB for the binaries. But:
    a) only half of that will actually be downloaded, as it's both the i686 and x86_64 versions
    b) if correctly configured, the web server will compress the data while transferring. The NaCl builds folders contain an invisible .htaccess file which tells apapche to gzip compress the data.

    In the end, the actual downloaded data will be around 10 MB for the unity engine with current builds. Still not perfect, but much better then 100MB.
     
  19. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334