From C++ to HTML5: Opera ports game with web standards
Even before the introduction of the WebGL standard for rendering 3D graphics in a browser, it was already clear that a browser can be a suitable platform for graphically complex games. To demonstrate the browser's potential capability in this arena, Mozilla has released the Flight of the Navigator demo and the Opera developers are working on a technology preview of what they think can be achieved. The question though is what is practically possible now if, say, an entire game were to be implemented using currently available web standards. Now, an Opera developer can answer that question.
Erik Möller at Opera has shown what it takes to port a video game consisting of 100,000 lines of code from C++ to HTML5. Möller developed Emberwind, a platform game written in the C++ programming language, in late 2009, and later joined Opera Software as a core developer. There, the developer has been given a small team of students to help him port Emberwind to HTML5.
The latest developer snapshot already works on Windows 7, Mac OS X, Ubuntu and iOS (with the current versions of the Opera, Internet Explorer, Firefox, Chrome and Safari browsers). However, Erik Möller concedes on his blog that this doesn't mean that the port has been fully tested. The game automatically detects whether the target platform supports WebGL (and offers a 2D canvas if it doesn't), and it already uses Google web fonts for rendering text – but Möller says that a satisfactory gaming experience will still require several further weeks of testing and development.
Among other things, the developers are planning to revise the trigger system and implement the audio engine. The audio system is based on the
<audio> element, which is still quite new in HTML 5 and should allow Emberwind to work without Flash – and therefore on platforms such as the iPad.
If development goes ahead as planned, Opera will not only provide effective proof that web standards such as HTML5 – combined with APIs such as WebGL for accessing hardware-based features – are on par with native C++ applications, it will also demonstrate that cross-platform multimedia apps can manage without Flash.