Porting a C++/OpenGL game to run in the browser

The Flash C++ Compiler (FlasCC) was designed to allow C/C++ developers to deliver existing C/C++ codebases via a web browser using the Flash Player. One common use case is to port an existing game written in C++ and OpenGL. The FlasCC engineering team has taken a popular C++/OpenGL game called Neverball and ported it to the web. This post demonstrates the game running in multiple web browsers and provides links to resources that will help you learn how to port your C++/OpenGL game to the web.

Neverball

The Neverball project is an open source computer game written in C++ using OpenGL. The goal is to tilt the floor to roll a ball around picking up coins and getting to the exit. You can download the native executable to try the game yourself from the Neverball Downloads page.

The Neverball Downloads page also allows you to download the source code for the game. You can try downloading the source code and using a native g++ toolchain to build a native executable.

Learn how to port this game to run in the browser by reading the extensive article on the Adobe Developer Center that describes how to compile OpenGL games with the Flash C++ Compiler (FlasCC).

Live Demo

The FlasCC engineering team has already built a version of the game and hosted it online for you to try yourself.

Neverball Live Demo

Screencast

This screencast demonstrates the game in action across various web browsers:

2 Responses to Porting a C++/OpenGL game to run in the browser

  1. 0l4f says:

    Awesome technology!

    Just one thing that comes to mind: IE is the only browser that does not support WebGL, but in Windows 8 Metro mode, Microsoft requires your URL to be whitelisted to display Flash content in IE. And this example would never be whitelisted by Microsoft because the Flash content is the main portion of the page, and is not backed up by fallback to other technology supported by IE.

    So, Stage3D support on IE should also get a red cross if it runs on IE in Windows 8 default Metro mode.

    That means that if you take Windows 8 into consideration, Stage3D runs in the same browsers an WebGL and they’re tied for the lead…

    What would be really, really cool is if we could compile C++ games into AIR iOS / Android apps…!

  2. stshongr says:

    Hi 0l4f,

    Thanks for your feedback!

    I’m not an expert on the IE whitelist and have never submitted a site myself, but from what I can tell you should be able to get your game whitelisted as long as you ensure that the game works with touch, has a good experience on mobile, and Flash is a critical part of the experience (and not just an advertisement for example).

    Looking at the guidelines at http://msdn.microsoft.com/en-us/library/ie/jj193557(v=vs.85).aspx :

    “Content that falls under the following categories and that targets the Flash Player is considered incompatible with Internet Explorer 10. Incompatible content might be the reason Microsoft doesn’t include websites with content targeting the Flash Player on the CV list or requires the user to view the site in Internet Explorer for the desktop:

    – The primary experience of the site is HTML. Flash provides additional, non-primary experience on the site, which doesn’t meet the performance standards or is otherwise deemed incompatible by the standards of these guidelines.
    …”

    So from what I can tell it looks like a page that is completely Flash should be acceptable as long as that Flash content is a primary part of the experience.

    As far as I’m aware I don’t think there is a way to remove Flash Player from IE in Metro mode so there would be no need for a fallback technology (assuming your content is whitelisted).

    Again I haven’t tried whitelisting something myself so I might not be the best person to ask about it. Have you tried doing it? What was your experience like?

    Thanks,
    Steve