performance difference between text & spritetext

Discussion and feedback on Construct 2

Post » Fri Feb 01, 2013 8:47 pm

Hey there,
is there really such an advantage by using spritefont/spritetext instead of graphics? I really wonder because i always thought, that images are (normally)bigger and take more cpu-power to be calculated.
Im not talkign about an epic text-based adventure. Just the texts you will need for most common jump`n`runs, shooter etc. .I`m asking because i`m working on 1-2 small games and the framerate is horrible on my mobile. The games are exported to phonegaps onlinecompiler and after that the games have framerates by 1~15 instead of 50~60 (on my pc). So, i really thought it was a good idea to use as little amount of images as possible, then i read about the spritefont plug-in. I`m a bit confused :)dformer2013-02-01 21:04:34
B
17
S
3
G
5
Posts: 71
Reputation: 4,401

Post » Fri Feb 01, 2013 9:07 pm

Do your games perform better on mobile if you remove the text? Just asking to see if the text is really the peice that is causing your performance loss...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Fri Feb 01, 2013 9:54 pm

Mobile hardware is way, way weaker than desktop. There are a lot of things that could be contributing to the frame rate problem, including overdraw (the graphics card redrawing pixels multiple times, like if something is drawn over the background - I read somewhere that on average current mobile hardware can only redraw the entire screen about three times in a 60th of a second), intensive stuff like usage of physics, too many collision checks, etc.

As mentioned, you can find out what's causing the problem by backing up your project, then deactivating code or deleting objects and trying again to find out what's causing the hit.

Don't use phonegap. It doesn't have hardware acceleration so it's nowhere near as fast as cocconJS.

Also keep in mind C2's preview/preview over LAN is way slower than C2's exported HTML. If you want to see C2 at full speed, export rather than preview.Arima2013-02-01 21:55:30
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Fri Feb 01, 2013 10:29 pm

@first thnx for your answers
[quote]
Do your games perform better on mobile if you remove the text? Just asking to see if the text is really the peice that is causing your performance loss...[/quote]yes, i have to test this, but befor i do,i thought, maybe the more experienced users say: "no, it doeset make a difference anyway with this little amount of text." Actually, im not in to the spritefont-plugin now. Will try it

[quote] Don't use phonegap. It doesn't have hardware acceleration so it's nowhere near as fast as cocconJS.[/quote] As i own an htc desire (non-rooted/jailbreaked/flashed/whatever...) with os 2.2 on it, it neither doesnt work with the cocoon prebuilder nor with their onlineservice for me. Sad, but true *sniff*
So, i read that their is also another way to work with phonegap, using eclipse ans some kind of more basic stuff of phonegap/cordova, but i just read a few lines about that. Dont really know, if its worth taking time to learn about it, because i dont know, if it would be a win for me. So, for now, im happy that some things work on my mobile, but yes, the framerate is damn low. Ans audio is also a bit scary. Sometimes sounds work, others of the same format dont.Maybe its about inner samplerates, dont know....Ans yes, i`m aware that there a more possibilities why the game is slow, it also could be the way i use the code, I guess there is some kind of redundance in it, who knows
[quote]Also keep in mind C2's preview/preview over LAN is way slower than C2's exported HTML. If you want to see C2 at full speed, export rather than preview.[/quote], yes, i do. what i get by phonegap is an debug-apk(as far as i dont add a key, otherwise it could be an official app).
dformer2013-02-01 22:44:59
B
17
S
3
G
5
Posts: 71
Reputation: 4,401

Post » Mon Feb 04, 2013 3:18 pm

@dformer I ran a little comparison test project comparing text objects to sprites a while ago. I think my sprites were about 128px square (sorry I can't be a bit more scientific with my benchmark).

Running on a desktop I was getting about 10-12 times as many sprites as text objects for the same frame rate. So a graphic object is much better than a text object if you can pre-make the graphics.

For things like "Score: " , "Time: ", "Player 1", "Game Over" etc, then making a single graphic is definitely much better than a text object.

It's very possible to build words dynamically either with a font graphic and your own events system or with the SpriteFont plugin. What you should do depends on the size of your text. If your texts are more than 12 characters long, the text object is better (if you build words character by character).

The Spritefont plugin might be a bit better than my 10-12 character rule because its written deeper with the javascript SDK. I haven't done a comparison with the actual SpriteFont plugin so don't know how its performance compares. I'd just put your phrases on single graphics if you only have a limited number and they aren't dynamic.

The last time I checked the SpriteFont plugin didn't work with CocoonJS so I used my own events based spritefont system, which was great for prototyping because I had a lot of short texts (single words). In the end though, it was much more efficient to create all the words where possible as graphics and just use my own spritefont system for the dynamic stuff like the digits in scores and timers etc.

Basically large bodies of text need a text object if dynamically produced, but for single words produced dynamically or for large bodies that you can prepare on a single graphic, graphics are better.
Nathan2013-02-04 15:25:48
B
29
S
8
G
4
Posts: 61
Reputation: 6,205

Post » Tue Feb 05, 2013 11:37 am

@Nathan: thank you for your long answer. As im struggling with a lot of options in making games, every Information concerning those is highly appreciated and useful for me.
B
17
S
3
G
5
Posts: 71
Reputation: 4,401

Post » Tue Feb 05, 2013 11:46 am

Don't use phonegap. Don't use phonegap. Don't use phonegap. It's not really an option anymore.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,390

Post » Tue Feb 05, 2013 2:52 pm

Generally people choose between sprite fonts and normal text based on the typefaces and appearances that can be achieved, rather than the performance. There's either not much difference, or the sprites in your game take up a lot more rendering power, making the question irrelevant.Ashley2013-02-05 14:52:56
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Tue Feb 05, 2013 3:08 pm

[quote]Don't use phonegap. Don't use phonegap. Don't use phonegap. It's not really an option anymore.[/quote] well, yes, thats what im starting to think at the moment too. Its beaucse of the lack of direct-canvas-support, right? I`m actually a bit overwhelmed by the possible options to export, like ludei/cocoon(which doesnt work for me,`cause of android 2.2.2 device isnt supported), appmobi, phonegap, cordova/eclipse......Other possibilities for exporting when an android-app is wanted? AAAArrrrrgggghhhh, just wanna make funny games.........
[quote]Generally people choose between sprite fonts and normal text based on the typefaces and appearances that can be achieved, rather than the performance. There's either not much difference, or the sprites in your game take up a lot more rendering power, making the question irrelevant.[/quote] ok, if its just about the styling i understand it, as not everyone has the same fonts on their system. And of course, puttin in a 2mb jpg to the project will slow down more than normal text can do.
..So, thanks for answering anyways...every answer is very welcomed (sorry for my english, i know its not the best )dformer2013-02-05 15:13:31
B
17
S
3
G
5
Posts: 71
Reputation: 4,401


Return to Construct 2 General

Who is online

Users browsing this forum: akash15, Colludium, Lof and 10 guests