performance difference between text & spritetext

0 favourites
  • 9 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • 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 :)

  • 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...

  • 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.

  • FiRST thnx for your answers<img src="smileys/smiley1.gif" border="0" align="middle" />

    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...es, 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 <img src="smileys/smiley1.gif" border="0" align="middle" />

    Don't use phonegap. It doesn't have hardware acceleration so it's nowhere near as fast as cocconJS.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 <img src="smileys/smiley2.gif" border="0" align="middle" />

    lso 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. 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).

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • Don't use phonegap. Don't use phonegap. Don't use phonegap. It's not really an option anymore.

  • 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.

  • on't use phonegap. Don't use phonegap. Don't use phonegap. It's not really an option anymore.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.........

    enerally 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.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 <img src="smileys/smiley1.gif" border="0" align="middle" /> )

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)