A custom game Graphical User Interface is just such a lure.
Common pitfalls
Having written many game GUIs in my time I've been able to compile a set of generally true, universal truths.
Generally speaking, if you're developing a GUI from scratch:
- It's gonna suck (functionally)
- It wont be nearly as good as a professionally built GUI (e.g. windows)
- The less you keep it simple the more it will suck
- It is deceptively complex, it seems simple but it isn't
- There is a whole science behind it, a science you likely aren't familiar with
- By design compromise and existing tools, there is little reason to make a complex custom GUI
- Chances are the GUI you're designing is more GUI than you'll ever need
- You're wasting time you could be using on actual game development
So now that I've all but told you your GUI is going to be broken without loads of time and effort spent on it; the only logical question is what do I do?
First off let's define what I consider a complex custom GUI.
An in-game windowing engine that generally includes some of the following:
- Dragging
- Resizing
- Minimizing/Maximizing
- Enable/Disable
- Z-Order
- More than 2 control types
- Window Snapping
- DC or window-drawing concepts
You writing a game? or an Operating System there, chief?
Generally speaking, your game shouldn't need all of these features; so your first line of defense is cutting features by design. When I do game development I always try to flex design where it can save code. Does your game really need its inventory window to be minimized and snapped to other windows or dragged around the screen? Probably not. Do you need the ability to render any font on any control? Probably not.
Chances are, this hypothetical window could be made using a single robust and reusable component class; and made to order, especially if you're writing a game and not an engine.
Or maybe you should be developing your game in Adobe Flash, where complex GUI is simpler to make?
Big Important Rule: It is generally better to know exactly what you need and code exactly for that, instead of writing flexible systems that you may not use.
So, you've looked over your GUI needs design (if you don't have a clear one, what are you doing designing a GUI in the first place?) and you've cut the fat, eliminating complex features; so where do you go from here?
If your game is an RPG, with lots and lots of windows, HUD and whatnot; it is likely unavoidable that you will need a non-trivial GUI; but whatever you do, don't roll it yourself if you don't have to! As stated above, if you do, chances are it will suck. When faced with dealing with an assured complex GUI need explore your options, there are generally well designed 3rd party GUI systems out there, CEGUI, wxWigets, etc. While they aren't perfect, chances are they are better then any half-baked system I can write in a year. Another alternative? The windows user interface is the result of MANY years of refinement, and for the windows platform, is the best GUI you can get; if you can bend your design to it, you can save mountains of time. At the very least using the Windows Common Dialogs for saving/loading games, and the windows menu system for a 'roll over show' menu bar, can shave months off your development and debugging.
If you really, really need to write your own complex GUI from scratch; I don't advise it; but if you do, be smart examine the code and concepts of successful GUI systems; and be prepared to spend a lot of time making it perfect; be ready to pay the price of a custom complex GUI.
A simplistic hybrid approach
But maybe you've looked over your game design and found "Hey, my GUI needs aren't really so bad."; using a combination of techniques you can fulfill your GUI needs, save time and create a quality product. In my next post I will use the GUI needs of the Selenite Engine as an example case (naturally).
True story... very good points. GUI seems to fall into the category of awesome to think about, but not awesome to put into practice. I've experienced many a cool UI idea that ended up exploding in my face.
Usability still gets shorthanded in the majority of small hobby games I've seen.