2
\$\begingroup\$

I'm writing a platform game which uses SDL for the main graphics code. There is a chance that I may be using OpenGL for the rendering at a later stage, so answers could relate to either.

I'm needing a good method to include vector animations (such as a starting video) within the game.

Being a platform game, I would prefer to limit the dependents and size of the data. This rules out using Theora as the resulting vector animations would be needlessly lossy and overly large compared to the rest of the content. Flash sounds like an OK option, however it is finicky to embed (or even use) on non-windows platforms, and requires significant amounts of dependencies.

My idea is to use HTML5 animations, rendered by Gecko (the embeddable Firefox rendering engine) or WebKit (the Chrome rendering engine) in SDL, or rendered to an OpenGL surface in SDL. Quite simply - is this feasable? Are there any other examples as to how I should embed it? Is there a better (read: smaller and simpler) solution?

\$\endgroup\$
1
  • \$\begingroup\$ It would be helpful if somebody with 300+ reputation could tag this 'Gecko' - it is a new tag, hence I can't do it \$\endgroup\$
    – lochok
    Aug 1, 2011 at 8:14

1 Answer 1

2
\$\begingroup\$

One solution (probably the easiest at the moment but not necessary the best) is to include a complete web browser engine into your game.

I'm currently trying some solutions which wrap Chromium/WebKit in C++ (and C# or C) to use some HTML5 as GUI.

  • Awesomium seems to be the more popular.
  • Berkelium is an alternative solution, that I didn't tried yet.

The both are based on Chromium/WebKit and can be used under Windows / OSX / Linux. As they both render the browser content into off-screen buffers, you can do what you want (save to file, display etc.) with them.

I'm almost certain you can find similar frameworks for other web browser engines, but as I don't know them I can tell for sure.

A best practice is probably to integrate the web browser engine directly instead of using some frameworks but it request more time and work indeed.

\$\endgroup\$
2
  • \$\begingroup\$ This seems that it may work. My only issue is I can't find whether either of them have a method to output the sound that a page (or in my case, an animation) produces. Will I need to integrate it directly? \$\endgroup\$
    – lochok
    Aug 3, 2011 at 5:06
  • \$\begingroup\$ Ok, I did the test with Awesomium (because I'm currently testing it). I tried an HTML5 sound, and the page displayed "Your browser does not support the audio element." then I tried to load my own flash website (after plugin activation) and I had the sound. So the sound does work but the Chromium version used in the current Awesomium version doesn't support the HTML5 audio tag. \$\endgroup\$
    – Valkea
    Aug 3, 2011 at 5:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .