Single big sized "Text Object" vs many small ones

Discussion and feedback on Construct 2

Post » Sat Jul 20, 2013 1:15 am

Hello all! I have a quick one this time..
I always add a text object as a debug panel to show FPS, number of objects, index number, etc. somewhere in my layout.

I tried using one single text object with many concatenated "&" and "newlines" to show all the info in this single text object witch, of course, becomes pretty big.

It also start to be a pain in the butt editing this big text object.

In other project i used many text objects each for every data i need. Then i put them one below the other. But this feels like a waste of resources. While the big single text object also feels like a rendering bottleneck.

Wich approach is better in terms of performance? As a reference i need more than 12 variables showing in this "debug panel". Some updates at every tick but are the less.

For now i stick with the big single text object. But this doubt buggers me from day one (let me exaggerate...)

Thanks in advance for any clarification about this.

John aka Hillstrom
B
31
S
4
G
4
Posts: 110
Reputation: 4,593

Post » Sat Jul 20, 2013 9:13 am

One thing I did in the past was log style, New data was just added to the end of a variable with Newlines, and it's length was cut to the last 500-1000 characters. Then set the text of the text object to that variable.

Or, you can Log to the browser's error console. See the tutorial here:
https://www.scirra.com/tutorials/147/checking-for-errors-in-browsers

edit:
oops, that tutorial didn't mention the "Browser" "Log" action:
From the manual "Browser actions" (link)

Start group
End group

Start or end a group in the browser error console. Groups appear indented, and the browser may give the option to expand/collapse the group easily. Groups can optionally be named. To create a group, use Start group, then a series of Log actions, then the End group action.

Log
Log a message, warning or error to the browser error console. This can be useful for debugging, testing and diagnostics.Paradox2013-07-20 09:20:05
B
220
S
58
G
32
Posts: 900
Reputation: 39,049

Post » Sat Jul 20, 2013 11:42 am

Lots of small text objects are more efficient than one large text object in the WebGL renderer. In WebGL mode whenever a text object changes it has to update a texture the size of the text object. If you have lots of small text objects, the ones which don't change won't need to update their textures, only the changing ones.
Scirra Founder
B
382
S
222
G
84
Posts: 23,984
Reputation: 189,245

Post » Sat Jul 20, 2013 1:35 pm

Also you could make pages or make system whit events that to only show what you need.
B
33
S
9
G
3
Posts: 517
Reputation: 5,181

Post » Sat Jul 20, 2013 6:22 pm

oh oh oh... That's what i liked to hear :D
I was almost sure that a text object whould be treated in similar ways like a normal sprite. Good to know that the "more easy way" for me is also the right way.

Thanks to clarify this! Time to go back to the board :D
B
31
S
4
G
4
Posts: 110
Reputation: 4,593


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 2 guests