By using this site, you agree to our Privacy Policy and our Terms of Use. Close

Forums - PC Discussion - How Bastion Can Run in a Web Browser with Google's Native Client

Tagged games:

I just realised this hadn't been posted

Supergiant Games launched Bastion on the Xbox 360, and a PC release was soon to follow. Now the popular action-RPG is breaking new ground by running inside the Google Chrome browser--Chrome's languishing web store isn't just for Angry Birds and ports of crappy Flash games anymore. More importantly, Bastion heralds the launch of a little thing Google's calling the Native Client (cheekily abbreviated NaCl), an open source technology for running native code within the browser window.

With Native Client, developers can easily port apps to the web from their existing code. Native Client runs C and C++ code, enabling multi-threaded 2D and 3D performance within the protective bubble of the Chrome browser. And Bastion is just the beginning. Other developers, including Square Enix, are on board for Google's Native Client push, which stands to change the foundation of web app development from this point forward.

Native Client's potential is obvious: developers can write their apps and games in languages like HTML5 and JavaScript that they already use. That makes cross-platform development incredibly easy, since Chrome already runs on Windows, OS X, and Linux. Quake demonstrated the potential of this concept a couple years ago, but there's a big difference between tech demo and purchasable products. After all, Quake's been ported to watches before--that doesn't mean watches are the next big game platform.

We know why Native Client is significant; the how is more complicated. What did Google do to make it so easy to port games to the Chrome browser? The Native Client's structure helps us break down the working parts. As explained by Google's technical overview, there are three components of NaCl: the web-facing HTML/JavaScript elements, a client module for running native code, and an API bridge connecting the two.

  • HTML/JavaScript application: Provides the user interface and event handling mechanisms as well as the main HTML document; can perform computation as well.
  • Pepper API: Enables the JavaScript code and the Native Client module to send messages to each other, and provides interfaces that allow Native Client modules to create and use browser resources.
  • Native Client module: Typically, performs numerical computation and other compute-intensive tasks. Handles large-scale data manipulation. Also provides event handling APIs for apps such as games where the user interface is integrated into the code that is run natively.

Native Client has API restrictions in place and can never access the OS itself--everything's sandboxed within the browser, at an overhead cost of only 5 percent performance. The Native Client's language support and features for games are expanding in the future (for example, Bastion's initial release lacks gamepad support), but the plugin already supports some key functionality like OpenGL ES 2.0 3D.

Unity 3D is among NaCl's supporters, which may be as big a deal for Google as it is for Unity. The popular game development tool is potentially being opened up to an audience of 200 million Chrome browser users. Unity's JavaScript, C# and Python code can be readied for the Native Client with a simple checkbox in new versions of the game development tool. Unity's developers posted a blog in June 2011 talking about the cool possibilities of the Native Client, and it looks like they've fully gotten on board in the past six months.

The Native Client will give Chrome's web store a chance to remake itself with more sophisticated apps leading the charge; the lack of Bastion on the store's front page proves it's in need of a content curation makeover. More importantly, Native Client might make the concept of a web app store worthwhile again. As a content distribution center for Chrome OS, the app store never took off. Between HTML5's increasing flexibility and the Native Client, there's a bright future ahead for web apps.

There are a couple ways to try out the native client right now: the Native Client Examples app shows how some of the technology works, while Bastion shows that games are already completely playable in-browser. Mini Ninjas will be Square Enix's first game for Native Client and will launch within the next few weeks, following the release of Chrome beta 17.

http://www.tested.com/news/how-bastion-can-run-in-a-web-browser-with-googles-native-client/3263/



@TheVoxelman on twitter

Check out my hype threads: Cyberpunk, and The Witcher 3!