G$earch

Original Game Boy becomes a Web app

Posted by Harshad

Original Game Boy becomes a Web app


Original Game Boy becomes a Web app

Posted: 29 Nov 2010 05:43 AM PST

Imran Nazar's JavaScript emulator can run 1989-era Game Boy games in a Web browser.

Imran Nazar's JavaScript emulator can run 1989-era Game Boy games in a Web browser.

(Credit: screenshot by Stephen Shankland/CNET)

One consequence of the steady increase in computer power is that newer machines can emulate the behavior of older ones, with software running fast enough to simulate operations that formerly required hardware.

Now, in an illustration of just how far Web programming has come, one coder has begun a project called jsGB that lets a Web browser emulate Nintendo's original Game Boy handheld game console.

Imran Nazar, a 26-year-old programmer from Manchester, U.K., has begun work to emulate the Game Boy in JavaScript, the Web programming language whose performance has become a top priority of browser makers today. JavaScript is used for everything from pop-up dialog boxes on Facebook to the Google Docs online productivity applications, but Nazar is busy adding 1989-era Tetris and similar games to the list.

"New JavaScript engines such as [Firefox 4's JaegerMonkey] mean much higher speeds for the core processing, more than enough to cover emulation of a basic system," Nazar said in a blog post on Mozilla's gaming site. In addition, HTML5 now offers the Canvas element for easily controlling a two-dimensional graphical display, he said.

"Why write a console emulator? It's a good way to learn the ins and outs of a particular console, and excellent for bringing together the lowest and highest levels of development," Nazar said. "And why build a console emulator in the browser, using JavaScript and HTML5? I say: why not?"

The work spotlights the growing capability of Web-based programs. JavaScript performance increases, though hard to measure, are opening new horizons for Web programmers. The cloud computing philosophy, which can let people get access to information and use online tools wherever they have a browser, is gaining credibility. New Web standards and browser features such as offline storage, advanced graphics, and hardware acceleration improve what browsers can do.

It's not all easy going, though. Perhaps the most advanced embodiment of the Web-app future, Google's Chrome OS, is stumbling on its way to market. Its troubles aside, however, it's clear more and more gets done in a browser window.

Nazar isn't the first to tackle the subject. Another JavaScript Game Boy emulator from 2009 is available on the Web, though like Nazar's so far, it's silent.

But Nazar has been chronicling his Game Boy project at his Web site. It's interesting as much for the gory details of how the Game Boy works as it is for how Nazar brings it to JavaScript.

The handheld computer introduced two decades ago didn't have much horsepower. The Game Boy came with a modified Zilog Z80 processor, an 8-bit model that could only address a 16-bit memory space of 65,536 bytes--less than a thousandth of what typical computers have today.

Getting the performance right is tricky because browsers' JavaScript execution speeds vary more than the Game Boy's processor clock frequency, though.

"Timing of the games is pretty much bang-on, since the original games based their timings on the cycles of the CPU: since the CPU timing is accurate, games run in step," Nazar said in an interview. "Actual running speed is highly dependent on the browser used: I've noticed that Chrome and newer beta builds of Firefox run the emulation much more quickly, thanks to the new JavaScript engines in these browsers."

Its screen was simple, too. The display measured just 160x144 pixels, each able to display black, dark gray, light gray, or white. The entire thing fits easily into a patch of "frame buffer" memory controlled through the HTML Canvas element.

Nazar also has figured out how to simulate the input controls--a relatively simple layout with a four-way rocker switch and four control buttons.

Nazar didn't have to figure out the hardware details himself. "The Game Boy hardware is very well documented, since so many people have reverse-engineered its internals over the years. Pan/ATX compiled the more-or-less definitive specification of the Game Boy hardware; I've got it mirrored."

The games themselves are hosted on his server, from which the emulator retrieves them to load them. "All the games I've used to build and test the emulator are public-domain and available on pdroms.de, apart from a recompiled version of Tetris built from reverse-engineered source code," he said.

Perhaps later he'll tackle the color version of the Game Boy, he said.

"The color Game Boy is a significantly more complicated beast, but I won't rule out putting together an emulation of it," Nazar said. "It won't be for a while yet, though."

Updated 9:58 a.m. PT with comments from Nazar.

Originally posted at Deep Tech

Battle lines drawn for 3D on the Web

Posted: 29 Nov 2010 04:00 AM PST

This WebGL demonstration shows 3D models of asteroids striking a rotating planet. It's not fancy, but it's 3D in a browser.

This WebGL demonstration shows 3D models of asteroids striking a rotating planet. It's not fancy, but it's 3D in a browser.

(Credit: screenshot by Stephen Shankland/CNET)

The Web is the next vanguard for 3D graphics, but programmers who want to embrace the new dimension next year will have to place a bet on one of two competing technologies: Flash or WebGL.

For years, Adobe Systems' Flash software has been the way to bring graphical games like Crush the Castle, Bloons, Desktop Tower Defense, or Stunt Bike Pro to the Web.

But at the same time, Web standards advocates have toiled to build such technology into the Web itself and not rely on the proprietary and sometimes insecure Flash Player plug-in. That work following in Adobe's footsteps is coming to fruition with the arrival of Web fonts, 2D graphics, audio and video, animated effects, and other features.

"We believe that 3D on the Web should be a first-class citizen running directly in the browser and not through plug-ins," said Tim Johansson, core developer at Opera.

That's a familiar refrain for Web development. There's s big difference with 3D, though: it looks like WebGL will beat Adobe's 3D Flash technology out of the gate.

"WebGL likely won't be finalized until early 2011, though a provisional 1.0 spec may arrive before the end of 2010," said Vladimir Vukicevic, the Mozilla principal engineer who helped create WebGL. Even more importantly, WebGL is the incumbent: developers for Firefox, Safari, Chrome, and Opera all have begun building WebGL into their browsers.

Here's the tricky bit, though: Microsoft is a WebGL holdout. Without Internet Explorer on board, WebGL's utility is greatly diminished to Web developers trying to reach the broadest market. And guess what? Flash works fine on IE.

In effect, Microsoft is an influential swing vote on the future of 3D on the Web. It's been frosty toward WebGL in the past and isn't commenting on it today. But if Microsoft chooses to embrace it in some way--and there are some signs it might--IE9 has a hardware acceleration foundation perfectly suited to the task.

One way or another, all this work will mean 3D will be more common on the Internet. That will help with several scenarios: building browser-based virtual worlds like Second Life, adding a new dimension to online map services such as Street View, bringing splashier interfaces and graphics to Web applications and Web sites, and improving online training and education. 3D isn't just for games.

Molehill maneuvers

Adobe's 3D Flash work, code-named Molehill, is well under way, but a beta isn't due until midway through 2011. "I'm thinking end of the second quarter or the beginning of the third quarter," said Anup Murarka, Adobe's director of product marketing for the Flash platform.

Don't count Adobe out just because it won't be first, though. Flash has legions of developers as well as mature programming tools. When it does arrive, it will be integrated well with existing Flash technology so programmers will get "access to the richness of the Flash environment they're already used to" when working with 3D, Murarka said.

The company's message is focused on the broad reach of Flash rather than how soon it will be updated with 3D features. Flash reaches 98 percent of personal computers today, the company said.

"There have been numerous options available for some time--other 3D plugins. That's something we're used to," Murarka said. "Our value is making this consistently available."

Practically speaking, though, Adobe couldn't move to 3D much faster, even with competing interfaces under way. That's because Adobe has been focusing on an even higher priority: support for mobile devices.

"I think the biggest element of the last 18-24 months has been rebuilding the foundation of our code base so it would be capable of being delivered across multiple screens. Designing the foundation to scale across desktop, mobile, tablet, and television is not a trivial undertaking," Murarka said. "Doing an entirely new 3D pipeline and engine isn't a simple task either."

The Molehill coming-out party was October's Adobe Max conference. Adobe showed zombie-slaying and car-racing games, rounded up 3D gaming allies to help show off Molehill, and published several Molehill talks online. In those talks, Adobe revealed that Molehill is a very low-level interface. But other companies--and eventually Adobe itself--will build a higher-level interface atop Molehill for those who prefer to deal with more elaborate 3D constructs such as objects and scene graphs.

With hardware acceleration, Flash 3D should be able to draw imagery constructed of hundreds of thousands of triangles on a high-definition screen refreshed 60 times per second, Adobe said. Under the hood, Flash 3D will employ Microsoft's DirectX 9 interface on Windows for handing off 3D instructions to the video hardware. On Linux and Mac OS X, Molehill uses a different 3D interface standard, OpenGL 1.3, and on mobile devices, it uses the stripped-down OpenGL ES 2.0 that's available on newer iPhone and Android phones.

Flash's plug-in nature, though, keeps it one step removed from Web page elements and all the standards Web developers can use to control such elements.

That isolation might be changing, though.

"The Web community is now looking at new ways to modernize plug-ins--like clever ways to integrate plug-ins more seamlessly so that their content is searchable, linkable, and can interact with the rest of the Web page," Google said in its "20 Things I Learned About Browsers and the Web" book.

Flash also has its own plug-in competitor, Unity 3D. It's been installed on 40 million machines and powers hundreds of online games already. Unity 3D is a higher-level programming foundation, a game engine with abundant built-in features. Thus far, though, it doesn't extend to the mobile Web and doesn't enjoy Flash's widespread use.

WebGL under way

It's not a coincidence that OpenGL and WebGL end with the same two letters. WebGL is a way to let JavaScript--the universal programming language of Web pages--tap into OpenGL ES 2.0. Both standards are maintained by the a consortium called the Khronos Group.

This compatibility with OpenGL is a big selling point for WebGL.

"There are many resources that teach WebGL on the Web, in books, and in classes. In addition, most university students are at least exposed to OpenGL. All this knowledge and information translates easily to WebGL," Vukecevic said.

And programmers won't have to deal with the nuts and bolts of WebGL, said Henry Bridge, a Google Chrome product manager.

"Perhaps initially not many Web programmers will use WebGL, but we think that JavaScript frameworks like jQuery [which provides prebuild programming modules for a wide range of tasks] will begin to integrate WebGL, or new frameworks will emerge that use it," Bridge said.

Google itself has one of those frameworks. It began as a plug-in called O3D. "The WebGL implementation of O3D is already usable," Bridge said. "Some other popular frameworks are SpiderGL and GLGE, but we're sure there will be many more."

WebGL will work on mobile phones. That's a requirement these days, with smartphones gaining in popularity, power, and usage. Those that support OpenGL 2.0 will benefit from hardware acceleration, which is all but essential for 3D.

Molehill also is designed to work on mobile phones, but Apple's ban on Flash for iOS devices significantly undermines Flash's cross-platform programming sales pitch.

Missing Microsoft

WebGL has its own Achilles' heel, though: Microsoft's lack of support in Internet Explorer, including the new IE9 under development.

DirectX is a powerful Microsoft advantage for keeping the videogame industry in the Windows orbit, and it's no surprise that Microsoft might hesitate to do anything that might undermine that advantage by supporting a cross-platform graphics interface.

But the operating system balance of power is changing. Mac OS X may be an afterthought for personal computer game developers, but the iPhone and iPad definitely aren't. Mobile is a hot, growing new market where Microsoft is comparatively feeble and where OpenGL has the advantage.

Bridge would like Microsoft on board, but believes WebGL will succeed without the company. "Even if they don't implement it..., we're confident that the addressable audience for WebGL content is big enough (and growing) so that it will get traction with developers," he said.

There are signs Microsoft could be persuaded to support WebGL.

Earlier this month in France, World Wide Web Consortium (W3C) members held the weeklong Technical Plenary / Advisory Committee meeting to discuss Web standards. There, Microsoft senior program manager Michael Champion said in a presentation (PDF) that "Microsoft wants to see the next-generation Web innovated at W3C," and mentioned one specific item for discussion: "Getting 3D Canvas work into W3C." The W3C already oversees the Canvas 2D work for two-dimensional graphics; WebGL got its start as Canvas 3D and uses HTML's Canvas interface.

And the W3C is exactly where WebGL appears to be headed.

"It's unlikely that the standard will move from within Khronos, however we expect the standard to be published by both Khronos and eventually the W3C," Vukicevic said. "We're working to make that happen in time for the 1.0 spec release."

A different angle

Another Microsoft-related WebGL hitch is that OpenGL isn't well supported on Windows, where the DirectX interface and its Direct3D component is the interface of choice.

But Google launched a project called ANGLE that grafts WebGL onto DirectX. The technology is "quite mature," Bridge said. "We plan to use it as Chrome's default rendering path for WebGL on Windows, and plan to submit it to Khronos for conformance testing as an OpenGL ES 2.0 implementation shortly."

"ANGLE's actually working incredibly well," Vukicevic said. "I was a bit unsure about that approach originally, but we're seeing virtually no performance difference between using OpenGL directly and going through ANGLE to talk to Direct3D."

Mozilla will provide an even stronger endorsement, too: "We'll be integrating it in a future beta for WebGL support," Vukicevic said.

That's a big help for making sure WebGL will perform well on Windows. But it's no deciding factor.

In all likelihood, WebGL and Molehill will make it to the Web. Programmers will just have to reckon with both.

Originally posted at Deep Tech

A better view

Posted: 24 Nov 2010 09:00 AM PST

Are you the type to have a lot of applications and windows open while you work? Find the right window easily by using DockView, the program that lets you view thumbnails of open windows by mousing over their icons in the OS X Dock. This latest update fixes bugs in previous releases.

Also this week we have the latest version of Scrivener, the tool for fiction writers that keeps all your important writing info in one place. Our game this week is Freeciv, the free open-source civilization strategy game where you can slowly build your empire and take over the world.

Don't forget to check out our iPhone apps of the week!

0 comments:

Post a Comment