Home How Asm.js Could Transfigure PC Gaming

How Asm.js Could Transfigure PC Gaming

Where do you spend most of your time on the computer? Chances are it’s probably the browser window. That’s where you check email and update social media, and where you watch videos and conduct research. You’re probably using it right now to read this article.

Developers know this to be the case, and that’s what led to the creation of asm.js, a Mozilla-developed subset of JavaScript designed to let users to launch everything from the browser window—even computationally intensive applications like games.

See also: HTML5’s “Dirty Little Secret”: It’s Already Everywhere, Even In Mobile

Asm.js—pronounced Azz-im jay es by Mozilla developers—is a highly optimized subset of Javascript designed to provide near-native application performance in a browser. Like all JavaScript, it runs in browsers without the need for any plugins.

And it’s starting to catch on. Early on, it only worked in Firefox; now Chrome has joined the bandwagon, and even Internet Explorer will do likewise soon. Microsoft said asm.js support was one of developers’ top 10 requests for Windows 10.

“Asm.js is well suited for any computationally intensive task on the Web,” said Dave Herman, Mozilla’s director of strategy for research. “Mozilla is seeing uptake of asm.js at places like Khan Academy, AutoDesk’s new tool, and photo editing solutions like Polarr.”

What Game Developers Want

Among those clamoring for asm.js, however, the voices of game developers are the loudest. At the forefront of the movement is Humble Bundle, the pay-what-you-want digital distributor that teamed up with Mozilla last fall to provide a number of games you can play in the browser.

That offering caught on with users, too. In two weeks, the bundle closed at more than half a million dollars in sales with more than 89,000 bundles sold. Now the company is gearing up for a second Humble Mozilla Bundle in 2015, bringing twice as many games to the browser.

“We ask ourselves at Humble Bundle, ‘why shouldn’t playing a game be as easy as watching a YouTube video?’” said cofounder John Graham. “These days, most computer users live in the browser. They should be able to play games in the browser, too.”

How It Works

Normally, if you want to play a video game on your computer, you can’t just click and go. You might run a DVD version of the game, or download a copy of the software from Steam or a similar service.

“Right now, you have to download an extension or an app manager,” said Graham. “Really, the browser could be handling all that for you. In general, I’m worried about the direction of app stores. Their deeper and deeper integration is turning the PC into more of an iPhone.”

With asm.js, Humble Bundle has been able to release a collection of games you can play by simply clicking a link in your browser. Asm.js has made it possible to compile the C/C++ code in which most computer games are developed into asm’s version of JavaScript, which browsers can then interpret natively, using the Emscripten compiler.

It’s no instant process, says Humble Bundle software developer Anthony Vaughn, but it’s no more difficult than porting a game written in C/C++ to Linux.

“If you think about the browser as another platform, you used to have to target Mac or Windows or Linux—now you just target asm.js,” said Vaughn. “Asm.js isn’t meant to be poked at by a human. It’s meant to be this layer you target. When you’re in C++ land building your own engine, you can deal with what you’re accustomed to and then have the Emscripten compiler produce your asm.js code. You don’t have to handpick or edit the JavaScript.”

What’s The Catch?

There’s no doubt that asm.js has the potential to revolutionize the way gamers play on the computer. But it’s not quite there yet.

For one thing, asm.js isn’t an improvement on JavaScript, but a subset of the language. It can only do what modern JavaScript can. So while it’s possible to load the Unreal Engine in your browser window, it still might take a while. This also means that you can’t expect the latest and greatest games in the browser using asm.js.

Plus, there are the technical difficulties some users have been experiencing with the Humble Bundle’s asm.js games as recently as November 2014. Vaughn said that the difficulty of porting a game to the Web with asm.js depends significantly on the way the game has been designed.

“Many games are made to update synchronously where most of their work is done such that every task that a game wants to do can’t start until the task before it has completed,” he said. “However, if you design a game for asm.js, you can have multiple tasks going on at once. So the game might be running a level, and while that’s happening, you can have it streaming audio, video, and pulling up another level in the background.”

Or to put it more simply, the game needs to have the ability to buffer.

“It’s like watching a YouTube video before the entire video is loaded,” Graham said. “If you can let if buffer while you watch, you get a smooth, continuous experience.”

Humble Bundle said the most difficult part of the process is where middleware is involved. Many game developers use middleware solutions to shortcut audio playback, UI rendering, and physics calculations. In his recent post on Gamasutra, Vaughn encouraged game developers to ask their favorite middleware options to come over to asm.js. Otherwise, these solutions need to be restructured in order to bring games to the browser.

These difficulties are a major reason why you’re not seeing more games in your browser right this minute. It’s up to pioneers like Humble Bundle to work out the kinks. According to Graham, it’s worth the effort.

“In one sense, asm.js is the most cross platform language there is.The browser is the most cross-compatible platform there is, and accessibility is very much part of the ethos of Humble Bundle,” he said.

Screenshot of the asm.js game “AaaaaAAaaaAAAaaAAAAaAAAAA!!! for the Awesome” via Humble Bundle

About ReadWrite’s Editorial Process

The ReadWrite Editorial policy involves closely monitoring the tech industry for major developments, new product launches, AI breakthroughs, video game releases and other newsworthy events. Editors assign relevant stories to staff writers or freelance contributors with expertise in each particular topic area. Before publication, articles go through a rigorous round of editing for accuracy, clarity, and to ensure adherence to ReadWrite's style guidelines.

Get the biggest tech headlines of the day delivered to your inbox

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.

    Tech News

    Explore the latest in tech with our Tech News. We cut through the noise for concise, relevant updates, keeping you informed about the rapidly evolving tech landscape with curated content that separates signal from noise.

    In-Depth Tech Stories

    Explore tech impact in In-Depth Stories. Narrative data journalism offers comprehensive analyses, revealing stories behind data. Understand industry trends for a deeper perspective on tech's intricate relationships with society.

    Expert Reviews

    Empower decisions with Expert Reviews, merging industry expertise and insightful analysis. Delve into tech intricacies, get the best deals, and stay ahead with our trustworthy guide to navigating the ever-changing tech market.