GUI: The road to hell is paved with good intention

posted in A Keyboard and the Truth for project 96 Mill
Published July 24, 2009
Advertisement
Nobody goes into game development thinking "I'm going to make things hard on myself", rather; inexperience and excitement of the unknown drags them into horrible time-sinks, where experience is gained and where souls are crushed.

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).
0 likes 4 comments

Comments

Prinz Eugn
Quote:Original post by EDI

  • 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



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.
July 24, 2009 09:25 PM
Cerasti
Thanks for the warning. It'll be a while before I start fiddling with a user interface, but I'll keep simplicity in mind.
July 26, 2009 08:29 AM
guptan
It is waste of time may be. But it will definitely teach some programming and design principles. And it will help us to appreciate the GUI development efforts.
July 28, 2009 12:49 AM
EDI
Quote:Original post by guptan
It is waste of time may be. But it will definitely teach some programming and design principles. And it will help us to appreciate the GUI development efforts.


You're right; you will learn much, waste a lot of time and ride the discouragement/elation roller coaster.

My views on this issue are intended for folks who are proficient programmers; but just getting into the game/game engine development scene.

In addition, know some key issues of experience can help you get similar benefits of knowledge and not waste as much time.

July 28, 2009 08:43 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement