• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
  • entries
  • comments
  • views

Awesomium both in name and in use

Sign in to follow this  
Followers 0
Little Coding Fox



Awesomium is a "google chrome in a lib" library that can be used on pretty much any application to render web pages (including flash and silverlight content), and has a great indie license to boot.

I know there are developers like me who'd rather not write their own native UI code for their games. After writing my own and having little success, and by that I mean that it was overly complex and hard to create and use any new UI elements and also mimicking their behaviour, and having tried several libraries such as libRocket, I helped a friend work on some web design assignments he had for university, (re)-learning HTML and using HTML5/CSS3/jquery for doing all sorts of awesome things.

I already heard of Awesomium and how you could use it combined with games for UIs and such, but considering my lack of HTML skills, I didn't consider it at the time. After I did help my friend, I had some moderate understanding of some fancy CSS3 tricks and was able to compose a UI relatively easy. And after I learned how to use some of Awesomium's most awesome features (no pun intended), I find it to be the very best UI library around.

Some advantages on using Awesomium

  • You can design your UI with HTML5, CSS3, and any javascript library.
  • Writing custom elements is much easier. You don't even have to write pretty much any code in your native language.
  • You can have fancy animations and even pre-made UIs using JS libraries like jquery UI.
  • You can use the awesome open source fonts from Google Web Fonts!
  • Works on the 3 main OSs (Windows, Linux, OSX)
  • It is rather quick and uses the same "multiprocess" scheme that Chrome uses (so if an Awesomium-created process crashes, your game won't crash)
  • You can use their Javascript API to create custom JS objects and then use javascript scripts on your pages to control parts of your game (e.g., I have a custom Core JS object with several methods like LoadHTML which let me "move" between HTML pages instead of doing it manually)
  • In the upcoming 1.7 SDK which will be released in the next month, you will have full support for HTML5, and with it, you can use the
  • You can have in-game web browsers, among other interesting interactions within your game
  • Many other fancy features like custom HTTP headers and resource handling

    You may be wondering, why prefer this to libRocket. LibRocket relies on a heavily modified version of HTML/CSS and as such is much harder to work with, even if it has a nicer license.

    Some tips while using Awesomium

    The biggest challenge while using Awesomium for me was having the UI elements become unselectable when the user drags the mouse around. You might think this to be a minor inconvenient, but I felt that the UI elements should look like actual UI elements instead of just a webpage overlayed on top of the game. If you do a search for how to do this, you'll find various solutions, but for some reason using them wouldn't work very well for me.

    However, I ended up writing this very simple CSS class:
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;

    And using it like so:
    function MakeElementsUnselectable()

    This javascript function will go through all non-input elements and apply the 'unselectable' class I defined upon all of them. Input elements need to be able to be selectable since otherwise elements such as textboxes will not be editable or show the blinking cursor.

    You may be wondering why I have three lines doing the exact same thing. I did that so that it will work on my main browser (Firefox) and also on Awesomium (which uses Webkit). For some reason Awesomium was not accepting -webkit-user-select so I added the 3rd line which is more standard, CSS3-wise.

    Another useful bit of code allows us to remove the custom webkit outline that happens around input elements.
    outline: none;

    There's not much to talk about this part, but this is very useful since e.g., the outline around textboxes will not be shown. Here's an example of how it looks when the outline is shown:
    (Taken from http://www.electrictoolbox.com/remove-webkit-border-input-focus/)

    The End

    And that's pretty much the end for this post. I hope you find it useful. I didn't leave much details on actually implementing Awesomium because it is rather easy to use, even if you use their C API (as I had to, since their project files on Windows were for VS2008 and I was using VS2010).

Sign in to follow this  
Followers 0


Thanks for sharing!

I assume the Firefox compatibility is for testing your UI in the browser rather than having to launch the game every time you tweak something?

Are you using it for in-game UI, or just menus?

How have you found the performance? I've heard previously that the rendered web-content can update poorly if you do anything too fancy, but I'm not sure if that's a genuine concern or the result of trying to do something silly.

Share this comment

Link to comment
Oh, and one other quick question -- how does it weigh-in in terms of impact on executable size?

Share this comment

Link to comment
[quote name='jbadams' timestamp='1329267338']
Thanks for sharing!I assume the Firefox compatibility is for testing your UI in the browser rather than having to launch the game every time you tweak something?Are you using it for in-game UI, or just menus?How have you found the performance? I've heard previously that the rendered web-content can update poorly if you do anything too fancy, but I'm not sure if that's a genuine concern or the result of trying to do something silly.

Yes, I'm doing Firefox Compatiblity for testing my UI in the browser. This way I can e.g., position my elements without having to launch the game all the time, as a simple refresh usually works.

I'm using it for both in-game UI and menus, and I found the performance to be at the very least adequate. On an nVidia GT320 PC, my performance ranges from 900 to 1300+ FPS when rendering a webpage with constant JS animation (by constant I mean something changes every 15ms at least), altough nothing else was being rendered at the time so the performance may vary on heavier rendering settings like an actual 3D game, as I'm using it on a 2D game at the moment. Also, since the rendering to a bitmap is actually done on the child Awesomium processes, you won't notice too much of a performance impact except when updating your texture with the new data.

Regarding the Executable Size, if you use their release_packed binaries, it will only give an increase of about 9.40 MB (although these are separate LL/.exe files, so your .exe doesn't actually increase in size much). These extra files might be much larger if you're not using the packed binaries though. For instance, the debug .dll reaches 76MB in size for me. Also, the .exe file I mention in the extra files is simply the Awesomium process, but you may modify your own .exe so that you can use it instead of Awesomium for the Awesomium Processes.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now