Author Topic: Newbie questions  (Read 5268 times)

AmpliMath

  • Guest
Newbie questions
« on: March 29, 2013, 10:39:54 AM »
    Hi all,

    We are currently using an in-house GUI system for our game development. We achieved very cool interfaces in Endless Space (for those who played it), but we are facing several challenges to improve the system. I was considering switching to NGUI, but I am wondering if some of its specificity are really applied to us. Sorry if I ask the obvious !

    • Our project uses a huge number of widgets, something above 2000 game objects. We have around 150 different panels. I have checked the profiler while running some of the NGUI examples, and I see lots of Update() running. Do you think that it could kill performance at some point? The examples I see in the SDK are gorgeous, but I was wondering if anyone tried to achieve a massive scale GUI already with NGUI, such as a strategy game.
    • NGUI seems to be closely tied to its atlasing system. In our game, the sheer amount of data, forbids the atlasing of everything. We have above 600 icons, presented either in 64x32 or 128x64, depending on the context. So we load/unload the textures dynamically during the game. Can this be achieved by NGUI as well? Is this the purpose of the UITexture class? Can it be created in real time?
    • Looking into the rendering code, I found dynamic mesh creation used for batching primitives. Obvisouly, when an object becomes invisible, the vertex list must transformed again with ToArray() causing an allocation. In Endless Space, we suffered a lot from random Garbage Collections, which froze the sound playback. I was wondering if any of you suffered for excessive allocation / GC with huge scenes. We currently use GL immediate mode for drawing : no allocation, almost free rendering, batching is possible, but the CPU overhead of calling each GL method is just unacceptable. And Unity support's answer is : do not use GL immediate mode :)
    • Dynamic creation of widgets or panels is critical for us, as we have lots of list made of complex objects. Is it easy to do with NGUI, the usual way with prefabs which get instantiated and added to the hierarchy?
    • How easy is it to create new controls? Is the rendering aspect easy to access? You change list the vertices, colors, texCoords, indices, and you are good to go?
    • Finally, how long would you say is the learning curve to do cool advanced stuff with NGUI? The documentation seems clean, as well as the code, I just wanted to get some user input :)

    EDIT : also we have integrated Freetype library import into our solution. I have read the post regarding your new font import system, is it close from release?

    Thanks for your answers!

    AmpliMath

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Newbie questions
« Reply #1 on: March 30, 2013, 07:32:13 PM »
Ooh endless space, I have that!. :)

I'll try to ask your questions the best I can.

* If all the widgets/panels are on at the same time, it will run slowly. Especially if many of them are moving around.
* UITexture can set its mainTexture property at run time, so you can load and unload that as much as you want.
* I can't say much about this, because I don't know all the details. We had some troubles in one game with excessive garbage collections, but if you don't move around stuff inside the panels (move the panel instead) you don't re-create the meshes.
* Dynamic creation is relatively easy. I tend to use prefabs that I instantiate and add to the hierarchy, but you can add widgets dynamically too - you just have some more stuff to setup in code.
* What do you mean by controls?
* I wouldn't say the learning curve is all that high - you have to understand how widgets are drawn and then it's relatively easy to do advanced stuff.

Unity has freetype directly in it for its dynamic fonts, but NGUI does not support that officially.. yet. I don't know the time table for supporting it, but as far as I know it will be in the next release.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Newbie questions
« Reply #2 on: March 30, 2013, 10:12:55 PM »
Endless Space is one of my most favorite games of all time. :D

AmpliMath

  • Guest
Re: Newbie questions
« Reply #3 on: April 01, 2013, 05:00:37 AM »
Thanks for the nice comments! Do you know that many people asked me if the game UI was created using NGUI? :D I suppose that is a compliment for both me and you!

Getting back to controls, I meant creating new widgets. For instance, we created a "Sector" widget in Endless Space, with angleMin, angleMax, radiusMin, radiusMax. This allowed us to draw circles, disks, angular sectors, and even hourglasses with rectangular clip (but I guess you can do that with your FilledSprite). We used this for example in our research view (background ovoid shape in the attached image).

As this is not a rectangular widget, and vertices have to be generated using cos/sin, I was wondering how easy this would be to do myself using NGUI.

Cheers,
AmpliMath


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Newbie questions
« Reply #4 on: April 01, 2013, 06:04:56 AM »
You can create a custom widget if you want -- just derive from UISprite or UIWidget, and override the OnFill function.

That said, filled sprite is able to do cooldown style timers quite nicely with a 360 degree fill. It also generates vertices using sin/cos.