Can not render the font(solved)

My project has a complex amount of content going on in the UI.

I’ve run into a problem where there’s too much, in fact. So when I am trying to clone text node for a dynamically-populating list, I’m getting the error “WARNING:RENDER: Fontrenderer: Render object count reached limit (128).”

so it’s very disappointing to be running into this issue now. Is there some way that I can reduce render usage from temporarily unused Font? Alternatively, assuming the worst case scenario, can I increase the render size for the fontrenderer?

I’m sure the buffer size can be increased, but it might not be that it’s not exposed as a configurable value in game.project yet though. Could you tell us a little bit more about the scope of the project? How many text nodes do you have? How complex is the gui? Are you creating nodes for all elements in the dynamic list, or do you use a pool of text nodes?

I want to create about 300 clones of certain text nodes. Gui is not complicated. Creates a parent node and a text node clone within a single scroll node. The text node is created with the parent node and it set to the node’s child. about the scroll node created factory and deleted it. Only one scroll is generated.

Assuming that a, b text node is set to child in A node, I clone A node. when i generated clone in A node, i found error from 130th.

Ah, I see. I now realise what’s wrong. When we render things we try to batch calls to the GPU to reduce the number of draw calls and thus increase performance. This is standard practice in game engines. This means that components (sprites, spine, text etc) that are of the same type and should be rendered in order (most often based on z-value) will result in a single draw call instead of one draw call per component instance.

When you have many box nodes with childed text nodes the default would be to render them in their hierarchical order, meaning “draw box”, “draw text”, “draw next box”, “draw next text” and so on. This will result in many unnecessary draw calls and you really want to avoid that. Now, arranging your gui nodes in a hierarchy is convenient in so many ways and luckily there is a way to still have a hierarchy of nodes and still render efficiently. The solution is called layers and is described in detail in the manual. In your case you need to create two layers, one that you assign to the box node that you are cloning and one for the text node that is childed to the box node. This will cause all of the box nodes to be rendered in a single call and all of the text nodes to be rendered in another call.

To learn more about draw calls in Defold I can recommend this excellent forum article.

3 Likes

I thought it would be solved. But it was not resolved.
There are three nodes to replicate. One is a box and two are text. The box node is set to parent, and the text node is set to the child of the box node. I’ve set up three different layers on the three nodes, but when I get more than 190 clones, it says “WARNING: RENDER: Out of text-render buffer”.

Hmm, would you mind sharing the project (from http://dashboard.defold.com) with me (bjorn.ritzl@king.com)?

Yes. Sorry for the late reply. Click the green button below to create a clone. And the problem occurs from about 210th.

If you do not mind, I want you to let me know about other problems. Every time the button is pressed, the scroll is moved to the bottom. When dragging, the position is returned again. Can you fix it?

You must synchronize your files (Project->Synchronize). All I got was an empty project.

I synced before sharing. And now I synced again. please check again

Ah, sorry, my mistake. I see the files now.

Ok, so the first issue with “WARNING:RENDER: Fontrenderer: Render object count reached limit (128).” was solved via the layers that you added to your gui. The new error “WARNING:RENDER: Out of text-render buffer” is caused by another buffer becoming full, this time it’s the graphics.max_characters buffer that you need to increase in game.project. And if you increase that buffer you’ll eventually run out of gui nodes. You can increase the number of gui nodes by selecting the root of your gui scene and increasing the “Max Nodes” value.

BUT I really believe that for a chat client such as the one you are working on, or any other place where there’s a list containing a large amount of values, that it’s best to have a pool of list items and recycle those that are off-screen, resulting in a fixed amount of nodes.

5 Likes

Thanks for your troubleshooting and detailed explanation.

1 Like

@britzl
I’m having a similar problem but with game objects, not GUI.
I’m using a significant amount of game objects that contains a sprite and a label (hundreds of them). On a trigger, they need to all move together at the same time (like a shuffle), and I’m getting the error “WARNING:RENDER: Fontrenderer: Render object count reached limit (128)." The shuffle works well, but when this rendering error is triggered the labels disappear for a second.

How should I organize the code, game objects, etc, to prevent this rendering error?

I would recommend you post a separate question in the forums, so that it appears as an unsolved problem in the list, @phil.oger.

The answer to your question will likely be to check out project settings, in particular changing the max count for sprites from the default 128 to something higher. However, I cannot really imagine a situation where having hundreds of labels and sprites simultaneously is warranted. Could you be more specific about why you need this?