Something I struggled with for quite a while was trying to figure out how to build a good-looking and functional user interface. I could certainly have built my own, but that would have been a major undertaking, as a lot goes into a user interface. You need a layout engine to manage where everything lands on the screen when you resize the window, you need widgets such as buttons, text areas, password boxes, scroll bars, radio buttons, progress bars, and more, and you need a way to author all that that is easy enough to use that if you change your mind, you can afford to do that.
That's a pretty tall order. And ideally I wanted it to be free.
A lot of games use Scaleform which lets you author your user interface in Flash. Flash certainly allows lots of flashy effects, but its authoring environment is expensive (yes I know there are free tools, but they're not for me) and you also have to pay the Scaleform guys. Scaleform fails the not free test.
You might also consider Qt which gives you all the things I was talking about above on several OS platforms. The weak point there is authoring, since the UI layout is done in code.
One of my key features is an in-game store, and the best way to make a store is with web tools. I was going to have to somehow get a web browser integrated with my game. I looked at three open source browsers to evaluate the possibility for embedding them in a game.
While I was doing that I had a headsmack moment. A browser is a really fancy layout engine with lots of UI widgets! I can use a web browser to run my entire front end! HTML includes the ability to navigate between screens, it has nice tools for authoring, AJAX for live page updating, web servers are free, I could even serve my entire game UI from the web if I chose (not gonna do that.)
Gecko (the engine behind Firefox) has very little documentation on embedding, and those who have attempted it say it is a month long project and not for the faint of heart. Too hard.
Webkit (the engine behind Safari) has some available documentation on embedding from the guys at Second Life, but talking to someone who had embedded Webkit in a game engine, it also sounded like a month long project. Better, but too hard.
That left Google's Chrome. And here's the money. I found Berkelium. I was able to have Berkelium completely integrated and displaying interactive web pages in just 6 days.
Berkelium is not all ponies and light however. To this point I haven't been able to build it. The source code for Berkelium and Chrome come seperately, so finding the proper source code build in Google's code repository took several hours of fiddling. What's even more worrying, is that the guys at Berkelium haven't been able to make a debug build. My fingers are crossed that the project will continue and produce a source build in Debug mode, but for now, I have to pray it doesn't crash in the browser. One other point to consider is the 40MB of binaries you need to include with your application.
Integration of Berkelium is straightforward, just follow their documentation. The package comes with a couple of examples, I was able to follow glut_demo to build my own WindowDelegate to do the rendering. I have to say, their code that implements the OnPaint method is INSANE. (Here's a hint, jj = rowNumber.) The only time I had trouble was when I needed to resize the browser window, and that came down to bugs in my own code, so I can't criticize them for that.
At this point, I'm also planning to use the browser for the UI during gameplay so it is running full-screen with transparency. (Most of the games I have worked on unload the full UI during gameplay.) Performance of the browser seems alright, I haven't noticed any visible rendering hitches when it is running and it hasn't tripped my long-frame warning, so it is processing reasonably quickly. This is not entirely unexpected since the Berkelium guys are also making a game with it. It will be interesting to see if using the browser for the gameplay gui makes it to the finished game. In any case, building an in-game front end manually is a lot less work than an entire user interface, so the browser is definitely a win.
We were unable to retrieve our session cookie from your web browser. If pressing F5 once to reload this page does not get rid of this message, please read this to learn more.
You will not be able to post until you resolve this problem.