Game gets slow by Nifty GUI

My game has several draggable Nifty gui windows. One of that windows contains a ListBox with panels. Each panel in that list is an item slot like those of a Minecraft inventory. The only usage of the list is to click on an item, and then click on a button “Sell” or “Buy more”.
When I add multiple items to the list, so I get multiple panels in that ListBox, the game gets very slow. For example I have 100 fps, then I add about 300 items to my list. Now my fps is 12.
Also when the window containing the list is not visible, my framerate remains too little. I think only the elements that are visible needs to be drawn, so only that (visible) elements needs time and affect the fps.
I’m only at the beginning of the development. If it is too slow now by Nifty GUI that does not bode well.

Without any code its hard to tell what is going on. I have easily that number of elements in my nifty game gui and it doesn’t have that kind of slowdown in it. The visible elements do increase the render time but adding any element does increase the processing time whether visible or not. The listbox according to a quick glance actually clips the elements and doesn’t hide them so you have 300+ elements that are still required to process events and potentially render. If the performance problem really is in nifty and not your code you could try creating your own listbox control with a focus on large list performance.

1 Like