IMGUI

Started by
8 comments, last by jbadams 9 years, 8 months ago

I post here because the forums at Molly Rocket seem more dead than tank tops.

I'm looking into this for a second time and i really can't decide whether:

a) Everything i want to do with it is possible.
b) It's actually any more simple than a well written RMGUI.


To those of you here that have written a decent IMGUI, or have atleast attempted one, i'd like to know how you:

a) Implemented modal dialogs.
b) Implemented draggable windows.
c) How did you identify a control between frames? I don't think the user passing an ID in to each Do*() method is an acceptable solution.
d) Do you have a designer for it or is it all hand coded? In most cases not having a designer is not acceptable.
e) Did you notice any performance issues when doing multiple passes over the UI code. It has been suggested that to solve the modal problem you need to do an examination pass before the input pass in order to detect ahead of time that something is modal.
f) Did you find any performance issues with alot of widgets?
g) How did you persist state between frames?

It also appears that the Unity 3D Editor is written entirely in an IMGUI and it's certainly pretty complex and this is encouraging however im not sure i believe it to be true yet as running fraps gives a framerate only for the game window. Not sure why the rest of the Unity Editor ui doesnt have a framerate if it is indeed immediate.

IMGUI or RMGUI guys, i don't see the answer yet, what's your take?

Advertisement
Personally I think the immediate mode gui is not sufficiently simpler to implement over a retained mode gui. Their implementations are mostly identical, except that with an immediate mode gui you define your gui with more implementation. Why not take the additional small step to store the parameters of the gui in some structure? It's not that much additional work. From that point it's only another small step to be able to define your gui outside of code.

To my own surprise, it has been more than two years since I asked something about designing a GUI.
My efforts on IMGUI resulted in a total loss. At the end, I ran out of time and I had to go back to the legacy GUI system.
It appears to me that IMGUI hasn't delivered. Many people would object that IMGUI is just GUI as it has always have been on consoles. That might be the case but a generic system is a different thing from a specific system.
I am very worried about the fact unity is still noted as example two years later. I would expect something more.

My main concern is that IMGUI proponents appear to be selling on

  • IMGUI is easier
  • IMGUI is implicit
  • IMGUI can do everything RMGUI can

It appears to me that those, taken alone, are true statements. But I'm not really sold they are true at the same time.
Take for example "can do everything RMGUI can". No, it cannot. Examples in the thread I've linked. It can do so only if IDs are generated and this is non-trivial. Once you generate IDs, say goodbye to the "implicit" part of the discussion.
And, to be honest, after trying to implement it, even for a barebone system, I'm unsure it's really "easier".
Sure it's not going to plug with the usual workflow without some effort.

Personally, when I first read CEGUI documentation, there was so much emphasis on Lua at the time I had the impression in was a very important requirement. It isn't the case, and I'm now looking at a complete CEGUI integration. So everything about that is now irrelevant to me.

Previously "Krohm"

Thanks for replying guys.

@smr - Yes i agree

@Krohm - Your thread there was one that i came across while researching this. As you say it's kinda surprising that for a technique that is supposedly so much better that there are still only very few (if not only one) commercial examples of it in use. I suffer the same problems as you did in that thread and i think it is clear that an RMGUI is the most suitable solution for me in my project.

I was actually scripting my IMGUI with Lua and to be honest that was quite powerful in itself, but it wasn't scalable.

Thanks,

Every time the subject of IMGUI comes up, I do a Google search to check on how far the concept has come along and how much traction it has gained since I first heard of it. I came across this tutorial which walks you through the process of creating a very simple IMGUI system and it helped solidify my understanding of the low-level design. There's a natural elegance to the code, however I'm not convinced the idea has come far enough yet to be preferable to RMGUI for any non-trivial interface, or at least to be used as the infrastructure for a general multipurpose GUI library.

What's interesting to me is that I've yet to come across an opinion of IMGUI from an actual UI artist or designer; someone who doesn't necessarily have a programming background. All the forum posts and blogs I've read tend to be discussions between engineers. It seems to me that at the very core of IMGUI you have code driving all aspects of the UI. But in all my years of working on GUI systems, the most important goals that always had to be met were that the UI be quick to prototype, fast to iterate, and easy to skin, without any intervention from the engineering team (other than the occasional feature request). IMGUI seems to rely primarily on the engineers to first design and implement the UI, and then hand off to the artists for skinning. This might work for small or indie projects where your engineers are also designers or artists, but from my experience this is not how a department of dedicated UI people expects to work. It typically goes: design coordinates with the UI team to figure out what functionality the UI needs. The UI team then determines the best layout in conjunction with the artists in order to meet the design team's needs. This is when prototyping and iteration speed is a priority, because they need to be able to figure out quickly what works and what doesn't work. Artists then skin everything to look pretty. Only once the art/design/UI teams are happy do they send it off to the engineering team to plug in backend functionality so that all the buttons and widgets actually do something. You can go through this process several times as designs change, but at the end of the day it's the engineering team servicing everyone else. They're at the end of the pipeline. I don't see how any of this workflow is possible with a code-driven GUI system, which makes everyone depend on engineers.

Ultimately the problem is that a UI designer/artist wants to be able to place down widgets and give them some data (X/Y/Size/Texture/Animation), that exist regardless of how code uses them, and IMGUI is all about eliminating the widgets and having their functionality and existence being driven entirely by code. I'm not sure how you can easily reconcile those two things. That being said, perhaps all IMGUI is missing are robust toolsets that provide UI people the ability to design/skin UI as they always have in the past, and then feed their work into some elaborate code generator that spits out the code to drive that particular UI scene. The UI team gets the workflow they want, and the engineering team gets to have the code that defines the UI and tweak as necessary. Time will tell, I suppose.

I think Zipster hit it spot on.

RMGUI's cater towards artists/designers at the front of the pipleline and programmers at the end. IMGUI is the exact opposite - programmers will implement the logical components of the gui and then can expose the data (layout, color, theme, etc) for artists/designers to tweak.

I suppose it really depends on the project/team you are working with. If your engineers are nothing more than code monkeys, and need specific requirements for everything they write, then RMGUI may be best suited. However, if the engineers are making more of the design decisions, and you just want to outsource your art, then IMGUI may be best suited.

To answer some of the OP questions:
a) I would implement modal dialogs as part of a layered screen system, and use multiple IMGUI objects. You can push and pop "screens" onto the stack and trap input to the top level. Typically though, IMGUI does not support overlapping widgets.

b) Draggable windows are implemented by returning the (x, y) position of the window out of the function, and using them as inputs for the next frame. The IMGUI will store the mouse drag information in it's internal state.

c) I don't think you can identify controls throughout a frame. All widgets are independent of eachother. I'm having trouble coming up with reasons why you need to identify a control with IMGUI.

d) As in the paragraph above, IMGUI is probably better suited for programmers at the beginning of the pipeline (i.e. hand coded), and then expose whatever data you need tweaked to the artists. Using a generic designer to be later implemented into the game by programmers doesn't really make sense to me with IMGUI. The IMGUI is tightly coupled to the code flow.

e) I don't have an answer.
f) I don't have an answer.

g) An IMGUI can store whatever data it needs between frames. Typically it stores a variety of IDs that reference to what widget is 'hot' or 'active'. The key point about IMGUI is that typically only one widget can be interacted with at a time, so storing state in every individual widget is a waste.

c) I don't think you can identify controls throughout a frame. All widgets are independent of eachother. I'm having trouble coming up with reasons why you need to identify a control with IMGUI.
Because you might need to associate a specific state with it. If the state is part of the model, that's no trouble (except the code needs to cater with this possibility). If the state is part of some external setting (such as skinning) the code has no way to deal with this. When scripting enters the picture the need for robust state association becomes a priority (as mis-guessing a control state association might violate some invariant).

Personally, after IMGUI, I looked at cocoa bindings and I found them quite more promising. Unfortunately, the amount of machinery required to make them work is scary.

Previously "Krohm"

Thanks for the replies guys, i think given that there is still so much doubt over how some of the issues i mentioned might be solved im just going to revert back to a retained GUI. I know however is solved in there.

Hello,

I stumbled on this topic while searching for the keyword. Recently released my ImGui implementation here fyi https://github.com/ocornut/imgui

On your questions,

" a) Implemented modal dialogs. "

That's not a really a problem for the low-level ImGui. My implementation allows to create any number of window - ImGui::Begin("window 1"): ImGui::End()

" b) Implemented draggable windows. "

The library context knows on which "window" you are adding widgets to and they are created relative to a window position. It draws windows sorted, allow you to move/resize them.

" c) How did you identify a control between frames? I don't think the user passing an ID in to each Do*() method is an acceptable solution. "

Controls typically have a string so you are already passing an ID.

Add an identifier stack (per-window+explicit push/pop) to resolve collisions in case of looping or recursing or opening node, it works really easily you rarely have to worry about identifiers.

" d) Do you have a designer for it or is it all hand coded? In most cases not having a designer is not acceptable. "

Mine is hand coded, a designer would defeat its purpose. Frankly I think UI designers are backward at least for the kind of things I am using it for. I can create a new tools in a matter of minutes, without even restarting my application (using modern C++ compiler with Edit&Continue or calling via a scripting language).

" e) Did you notice any performance issues when doing multiple passes over the UI code. It has been suggested that to solve the modal problem you need to do an examination pass before the input pass in order to detect ahead of time that something is modal. "

I am not doing multiple passes.

" f) Did you find any performance issues with alot of widgets? "

Performance are alright, we have pretty complex UI (data browsing, debugger) that gets created/updated/render in less than a millisecond - that include traversing source data.

" g) How did you persist state between frames? "

Via implicit ID. The library just track what it needs but that's very little.

To be clear, I agree it is harder to implement automatic layout in ImGui types of library. I just don't think automatic layout are actually that useful, it's very easy to achieve layout programatically. So my stance is to keep the ImGui very simple to use rather than clutter it with things liek half assed multi-pass attempt.

Been using it and team shipped games with it (PixelJunk Shooter 1/2, PixelJunk 4am, Tearaway). Still usiang it for subsequent pro and homebrew projects.

This is a pretty old topic, it's pretty unlikely that the original poster is still looking for answers to this -- thanks for adding the information for any future searchers who land on this though -- I'm closing this one, but if anyone stumbles upon this and has related questions please feel free to start a new topic.

//EDIT: This is a topic that isn't discussed particularly frequently, and it seems this particular topic ranks pretty well on search engines, so I've changed my mind -- I'm going to leave it open for now in case anyone else wants to contribute. An old topic being brought back from the dead really isn't harmful if new information is added, especially if it's one that is likely to be found in searches. smile.png

- Jason Astle-Adams

This topic is closed to new replies.

Advertisement