Nifty vs Lemur - a consideration

Hello Everyone,
After struggling a lot with Nifty, I started thinking about maybe switching to Lemur.

I find Nifty very powerful, but there’s missing documentation, it has no new updates, it’s very precise with syntax (XML), and in general, it is hard to use.

However, I feel like people Can easily make Lemur GUIs in mere minutes.

On the other hand, Nifty is very dynamic (I can add my own controls, styles). Is Lemur also that dynamic? (I don’t think “dynamic” is the correct word).

On the yet other hand, Lemur is open-source AND maintained, and I can ask questions on this forum.

And on the yet other other hand (don’t worry - it’s the last hand), Nifty has a great effect system, where you could quickly make tooltips, backgrounds, colours, pulsing colours, pulsing tooltips, images, different styles when hovering, etc.

To finish the post: what do you recommend? Use old Nifty or new Lemur?

Nifty is still under development and you might find more documentation there.
It’s only not packaged with the engine and the binding might not be updated.
See GitHub - nifty-gui/nifty-gui: Your Open Source Java OpenGL GUI. Interactive user interfaces for games or similar applications. LWJGL, JOGL, JME or Java2d rendering.

Lemur also allows you to write own controls and style and actually you have to write own controls, since it only comes with a basic set of controls currently (though there are some premade ones in pauls’ other software/lemur-proto)

I think Lemur also plans to implement animations but things like tooltips might be up to the user.
In the end the only thing that really matters is what you feel more comfortable with.

I decided to go the Lemur route myself. The main reason I picked that over Nifty or say ToneGodGui was the following:

  • Many people that start off with Nifty seem to either decide to roll their own UI or go with either Tone or Lemur. I found that a bit… unnerving.
  • Lemur (to me anyways) is more under active development than ToneGodGui recently (not sure what happened since it was all the rage like a year or so ago).
  • Starting off with Lemur is silly simple. The quick start guide isn’t too bad (I got hung up at one part but it was easily solved by just downloading another jar).

Cons I’ve found so far with Lemur would be that the documentation and examples are incomplete, and that it is missing some features like radio buttons (but I rolled my own just using checkboxes in Lemur).

For me though I prefer building things in code and that is how you add and make things in Lemur.

Want a new label?

myWindow.addChild(new Label(“Debug Texture Settings”));

Done.

I’m still working away at it but ya. I’m liking the Lemur so far.

Side note @pspeed is the developer and there is a section in this forum for Lemur specifically.

If you find section of the docs that are particularly lacking then you can post a problem report to the Lemur project. It bumps it up in my priority that a) it’s still not good enough, and more importantly b) someone actually cares about it. :slight_smile:

1 Like

Will do! :slight_smile:

I think there is also the possibility to use JavaFX in jme3

2 Likes

I think this is the best option for desktop :slight_smile:

Lemur already has animations… though you still have to write your own effects as there aren’t any standard ones yet. It’s not too hard, though, as many primitives already exist.

See:

My original announcement thread… thought I had a video link but I guess not:

My test app had buttons flying around and rotating using animation. I guess I didn’t capture a video. Closest I have is the fades in this UI:

They are done with the effect system so are automatic as pages are opened/closed.

Here is the section of the docs page with some examples:

3 Likes

You just throwing that one out there to see if it sticks, or have you read something here I’ve yet to find? :slight_smile:
(Also, can’t you use it now the same way you can semi-use Swing? i.e cautiously with a little pain and some hacks…)

Working with JavaFX professionally now, so that’s interesting.

I have never tested it, but I hope it works

1 Like

my editor uses javaFX :slight_smile: it has very flexible API.

Does lemur support generating GUIs from xml yet? I find GUI generation code a bit unpractical and prefer to go xml way.

It does not support this yet. I do have plans for some kind of GUI definition language but it will probably not be XML… as that’s literally the worst way to hand write anything. <sentence><word>I</word><word>have</word><word>do</word><word>it</word><word>at</word><word>work</word><word>and</word><word>I</word><word>hate</word><word>it</word></sentence>

Though I will say that Lemur is one of the few GUI libraries where the code is actually (usually) smaller and more concise than an XML definition would be.

Fake example:

<lemur>
    <container x="100" y="200">
        <children>
            <label text="Foo" />
            <button text="Ok" />
        </children>
    </container>
</lemur>

Actual code that does the same thing:

Container container = new Container();
container.addChild(new Label("Foo"));
container.addChild(new Button("Ok"));
container.setLocalTranslation(100, 200, 0);

And the problem with the XML is that it becomes very hard to include the fidelity you get with the Java code in the sense of being easily able to specify layout constraints, etc… It’s one of the reasons I haven’t come up with a good DSL yet as I can’t figure out a nice syntax for constraints that isn’t worse than just writing code.

One argument for a separate definition language is “But designers can tweak it and the code doesn’t care.” I’ve never found that true in reality. Designers constantly run into XML problems unless there is an editor. (And an editor doesn’t care about the format.) And no matter what you now have problems on how to hook up those GUI elements to their models. 99% of our Nifty questions here are people struggling with the XML or struggling to hook that up to their code.

What I’d really like is some Photoshop/GIMP export plugins. :slight_smile:

2 Likes

My recommendation is to make your game code GUI agnostic, and then make the choice.

Nifty has the advantage of letting you have a UI design via xml and leaving the code just handling controls. The other advantage is that Nifty is engine agnostic that connects to JME with a few lines of code and it works on all platforms (mobile, desktop and android consoles) with little issues. However, besides the very steep learning curve and “figure it out yourself” design, Nifty is not as flexible as you would like and doing it with Java code can be confusing, so clean, simple code philosophy is key here (but a P.I.T.A. when you are prototyping).

Lemur offers a much more friendly alternative, giving you at least the same amount of control like in Nifty but with much less hassle and easier to understand. Makes thigs easier when you want to focus more on the game code than making the UI work through fights. Since it’s JME oriented, your way of thinking does not change and “keeps the flow”. It also supports 3D UI (something that Nifty needs a LOT of unnecessary tricks to do IMO). The disadvantage is that the UI currently is not programmer free and not out-of-the-box solution but requires an initial setup (which is simple, but not as simple as using the jar directly).

Nifty has just as many jar dependencies as Lemur… it’s just that the SDK configures them for you.

More like the engine binaries, which is why I would love to have a Lemur-JME ready branch :stuck_out_tongue:

1 Like

Not sure what this means.

Nifty requires a handful of jars other than the engine binaries. Last I used it, I think it was like 4-5 jars… about the same number that Lemur requires. (Basic lemur only requires 2 jars other than Lemur itself.)

Anyway, hand-building jar lists is kind of 1990s technology. As IDE support for modern build tools improves then you won’t have to worry about that.

…which is another Lemur benefit: it and its dependencies are in public maven repos. So use in gradle or maven is really easy.

Note: based on feedback, I’ve recently updated Lemur’s getting started page and also added a section for gradle configuration. Thanks to @thecyberbob for the nudge.

I suppose using a GUI toolkit written by one of the core JME developers (and used by two others), where the developer is actually on the forum 16+ hours every day is probably a distinct advantage also. :slight_smile:

6 Likes

What happened with tonegodgui developer? I am pretty newfag and don’t know about it in details

Turns out it’s still supported but not sure to what extent beyond just making it work: Tonegodgui maintenance

It’s available in the plugins section in the IDE so feel free to give it a whirl.

She had various life issues going on that caused her to drop out from time to time. My guess is that some life reprioritization occurred. She may pop in again someday, I guess. It’s happened before but not for this long.

1 Like