Customizable GUI's Using HTML/CSS

Started by
11 comments, last by dougbinks 11 years, 7 months ago
As you may or may not know I have forked the Glest Advanced Engine to work on a somewhat unorthodox RTS-like game. The game is, due to being a Glest fork, open source and designed to be easily modded. I don't necessarily expect my game to be widely modded, but the engine will be used for 7 games of fairly different types, although all RTS-like. For these reasons I want to have a GUI that is easily modified in all aspects.

This engine uses C++.

I was wondering if their are any good libraries, which are open source, that allow for HTML4-5/CSS3 files to be used to modify the GUI. Over at 0 A.D. they talked about stuff like Webkit and Awesomium and Berkelium, but I was wondering if people who are more expert in game programming and design could think of any more or better options. Awesomium is no longer open source I believe.

I basically want to have easily moddable styles for panels/menus/buttons and also Civpedia style manual type stuff.
Advertisement
Awesomium and Berkelium are both Cromium based (which in turn is WebKit based) AFAIK, with the former being a commercial product and the latter being more rough-around-the-edges, but open source.

Another option is libRocket, which is open source, and AFAIK, isn't built upon the heavyweight WebKit backend.

As you may or may not know I have forked the Glest Advanced Engine to work on a somewhat unorthodox RTS-like game. The game is, due to being a Glest fork, open source and designed to be easily modded. I don't necessarily expect my game to be widely modded, but the engine will be used for 7 games of fairly different types, although all RTS-like. For these reasons I want to have a GUI that is easily modified in all aspects.

This engine uses C++.

I was wondering if their are any good libraries, which are open source, that allow for HTML4-5/CSS3 files to be used to modify the GUI. Over at 0 A.D. they talked about stuff like Webkit and Awesomium and Berkelium, but I was wondering if people who are more expert in game programming and design could think of any more or better options. Awesomium is no longer open source I believe.

I basically want to have easily moddable styles for panels/menus/buttons and also Civpedia style manual type stuff.


Very interesting concept, we thought of doing the same but in the long run couldn't figure out a way to make it work. ( all though we didnt try very hard ) Ultimately we went with XML based elements which link to API in the code. This has proven to be very useful and simple to add/setup.

If you figure out how, and you dont mind sharing please do so. I think moving towards the same thing that the web industry has would be very crucial since most people these days know the basics of hmtl and css.
If you end up going down the Webkit/Chromium route, you may also want to check out the Chromium Embedded Framework, as this seems more updated than Berkelium. Awesomium now offers a free version for Indie developers as well, so you may want to consider that.

I've used libRocket and found it easy to work with and powerful, but am very tempted by moving to a simple GUI system for in game and a webkit based GUI for menu system, server browsing etc.

If you end up going down the Webkit/Chromium route, you may also want to check out the Chromium Embedded Framework, as this seems more updated than Berkelium.



I've explored this route before. FWIW offscreen rendering with CEF is not available on Linux, but only on OSX and Windows. See http://code.google.com/p/chromiumembedded/issues/detail?id=594

Personally, as cool as an HTML/JS/CSS based GUI is, I think it's severely overengineering the problem. If it's so difficult to make and modify something as simple as a GUI in your engine, such complexity probably pervades the entire system. I think you should first consider working on that problem, before you consider adding the signficant runtime/maintenance burden of an embedded browser to the mix.

YAGNI.

Between Scylla and Charybdis: First Look <-- The game I'm working on

Object-Oriented Programming Sucks <-- The kind of thing I say

Actually, one of my coders came to me and said: "You know our launcher that links to the website and works all nice and pretty?" my reply was "Of course, I made you redo it like 50 times till it looked good. Why?" and his reply was "It doesnt work anymore with html because the project is no longer open source."

Soon as he said that I said: "You read that guys post about the HTML and such in his projects for the UI! Oh this is bad news!" lol I didnt even realize we were using that part already.... sucks. Well, seems I am in the same boat as the OP now!

I've explored this route before. FWIW offscreen rendering with CEF is not available on Linux, but only on OSX and Windows. See http://code.google.c...s/detail?id=594

Personally, as cool as an HTML/JS/CSS based GUI is, I think it's severely overengineering the problem. If it's so difficult to make and modify something as simple as a GUI in your engine, such complexity probably pervades the entire system. I think you should first consider working on that problem, before you consider adding the signficant runtime/maintenance burden of an embedded browser to the mix.


Kinda what I was saying, we have a very robust XML system but for our launcher tool I wanted the ability to send them live updates and make it easily styled. We could do this through XML and other methods but the simplest possible answer was to make a HTML based UI system. It worked like many of the high end launchers you see today and was rather fast ( so long as they had a good internet connection ). Im not saying it was the best solution but it was a solution.

Personally, as cool as an HTML/JS/CSS based GUI is, I think it's severely overengineering the problem.


This depends (as always) on the complexity of the GUI required. I've found it fairly easy to integrate CEF, Berkelium and Awesonium, and for something like server browsing sharing the GUI code between a web interface and the game can be useful. Even for relatively simple GUIs, the ability to use well known HTML tools to create content can be very useful for artists. On the other hand, it can be a lot of fun to make something clean and simple yourself.


FWIW offscreen rendering with CEF is not available on Linux, but only on OSX and Windows. See http://code.google.c...s/detail?id=594


Shame about the lack of Linux off screen rendering for CEF at the moment, though it looks like something which could be done fairly easily by someone who cared sufficiently.

[quote name='dougbinks' timestamp='1346240385' post='4974387']
If you end up going down the Webkit/Chromium route, you may also want to check out the Chromium Embedded Framework, as this seems more updated than Berkelium.



I've explored this route before. FWIW offscreen rendering with CEF is not available on Linux, but only on OSX and Windows. See http://code.google.c...s/detail?id=594

Personally, as cool as an HTML/JS/CSS based GUI is, I think it's severely overengineering the problem. If it's so difficult to make and modify something as simple as a GUI in your engine, such complexity probably pervades the entire system. I think you should first consider working on that problem, before you consider adding the signficant runtime/maintenance burden of an embedded browser to the mix.

YAGNI.
[/quote]

Well open source projects that use web standards for the GUI have a much better chance of attracting artists and other kinds of contributors. This is because a lost of people already know how to handle HTML and CSS.

The engine I am forking was created by two separate groups of Devs and I do disagree with some of the things they did which I am working on. Adding new things to the GUI doesn't take me incredibly long, for a new thing it may take me a couple days because I also have to add the new feature before I change the GUI.

One part of the game is the resource bar, I wanted to add a unit bar for the faction so you knew how many of what unit you have. This took me about 6 hours because it was one of the first things I did in changing the GUI and I was unfamiliar but on the other hand most of the code for the resource bar was still compatible with this new unit bar.


One thing that is a problem is that each GUI element has to be modified in source. So I have several copies of a very similar widget code that is a frame. So I have to work on removing that. There is a whole lot of work to be done on the GUI already, so it seems like a good time to add styling type stuff.
Something to consider is that using a Chromium based project will tie you to building a 32-bit executable for Windows only as there still does not exist a 64-bit version of Chromium for Windows.

Edited for clarity.

This topic is closed to new replies.

Advertisement