Advertisement

Any recommendation on GUI solutions for games?

Started by July 15, 2017 06:24 AM
7 comments, last by Kylotan 7 years, 4 months ago

Beginner in the field here. I'm trying to implement a grand-strategy engine from scratch using C++ and DirectX11. It turns out that the efforts implementing GUI part itself is already much beyond my consideration. Imagine the GUI of Civilization V or Crusader Kings II, that's what I want.

I know some AntTweakBar stuff, but these are mostly used in testing some rendering applications right? Can it also be good in games?

What are some common solutions for most indie games? (Implementing a scroll slider, a listbox, a tab control, for example)

Thanks very much.

Not an indie, but my guess is that most indies will grab a random UI library from a shelf, and use it. You don't make money from a UI implementation, you make money from good game play, so that's where a wise indie will spend his/her time.

You have a choice here. You can dive into making a UI library (which is a fun subject on its own), or grab something that exists, and spend time on other parts of your game (I would recommend you start making a game rather than an engine. It's an order of magnitude simpler, yet it contains many parts of an engine. In that way, you get a better idea of what an engine should contain or provide, which will eventually improve the quality of it.)

Advertisement

Hey there, I've been using AntTweakbar in my game and it is mainly a tool development UI. I get the occasional framespikes from it, and the api doesn't allow custom textures for your panels, so I wouldn't recommend it. If you fear the bloatedness of custom ui libraries and want to make your own, start small - The most fundamental ui elements you can implement are buttons, textboxes and ui images coupled with a parenting system.

If a library will do what you need it to do, then use one. If not, do you know enough about the concept that you can modify the library to suite your needs ? Do you want to learn how to code the particular library yourself which also means you can specialize it to cater for your precise needs.

 

Personally I write my own GUI code because I like doing it, it also benches me in thought for a few hours, how can I make my GUI unique, appealing and relevant to the game that I'm making. While keeping it easily navigable and clear. 

But there are good looking libraries that will do what you need them to, And what I like is that the library devs often take suggestions on improvements because in the end it means their products will be better so they'll get more sales. 

In the grand scheme of things, games have often quite simple GUI requirements. I.e a game I recently completed had:

  • Text
  • Button
  • List Box
  • Check Box

Granted, for a RTS you might have more complex requirements but for that you will likely need custom GUI components anyway.

One alternative is using a "proper" Gui library such as wxWidgets, Gtk+ or Qt. Then use that for the buttons and lists but then render the game in some sort of wxGLCanvas (if using wxWidgets and OpenGL).

http://tinyurl.com/shewonyay - Thanks so much for those who voted on my GF's Competition Cosplay Entry for Cosplayzine. She won! I owe you all beers :)

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.

I've had success with dear ImGui (https://github.com/ocornut/imgui); really easy to hook up and do stuff with. It's an immediate mode gui, I don't know if that has any problems for you.

Advertisement

Yeah, Qt has been around a while and is a powerful library.  Other things to try, if you're desktop only, is doing XAML interop.  (or UWP I think you can do C++  and XAML)  -- though I don't see many games do that, mostly level editors.  You might also try Scaleform, though I don't think that's free.

For a game with a complex UI that you want to scale nicely, I think I'd avoid trying to rewrite the wheel for every single thing.  

3rd party UI libraries have always been in a pretty poor state. Someone wrote a blog entry about this recently. And as more and more people use existing engines, this is unlikely to change, because Unity and UE4 users will use the built-in UI.

Some people used to do okay with LibRocket, but that's not seeing much love these days.

CEGUI, formerly Crazy Eddie's GUI, has been widely used over the years, and widely criticised over the years. But it's certainly capable.

TurboBadger looks good. Never used it myself, or heard of anyone else that did, so tread carefully.

Pros sometimes use Scaleform. They don't even list a price, so you probably can't afford it.

This topic is closed to new replies.

Advertisement