Spritefont horrific lag on mobile, Ejecta, CocoonJS

0 favourites
From the Asset Store
Sound effects of monsters, ghosts, beasts and more
  • Problem Description

    Making a 300+ word Spritefont object in C2, (that of course loads once, not every tick or second), makes my ipad mini in CocoonJS die a slow low FPS death. The same happens with my Ejecta export tests.

    PC and Mac Browsers seem perfectly fine, and webkit too.

    on a 1000+ word spritefont, it literally goes to 2 FPS.

    I've tried every combination possible and known to man and women equally. Nothing works. I speculate (probably badly) that C2 on mobile loads ALL the sprites, and not just the ones that are on screen.. or prerenders them as separate objects.

    Attach a Capx

    Description of Capx

    It's just a capx of a big spritefont, make it a big bigger, and you'd see massive FPS drop.

    Steps to Reproduce Bug

    • Export as CocoonJS or Ejecta
    • Play on mobile
    • Can't play because FPS is terrible

    Observed Result

    Low framerate, terrible, horrific one indeed.

    Expected Result

    Optimised as browsers

    Affected Browsers

    • Chrome: (NO)
    • FireFox: (NO)
    • Internet Explorer: (NO)
    • CocoonJS Yes
    • Ejecta Yes

    Operating System and Service Pack

    Win7 latest update

    Construct 2 Version ID

    Newest one

  • In addition to that, i'm having a fps lowering with giant spritefonts in cjs too. But, when i try to open the projects in a default mobile browser and chrome mobile, fps is stable 60. So maybe that's not a bug in c2, just a way cjs and ejecta works, but maybe Ashley can somehow optimize spritefonts to make it work normally?

  • I would immediately buy another copy of Construct 2 if that helps

    Sisyphus ,that sounds very promising if it works well on mobile if it's in a browser. There might be a workaround or fix of this lag then

  • Ahh, I see. While it may not be a bug, it is crazy slow. Is it a necessity to use the Sprite Font? I can't stand the thing personally, so I find myself using sprites of texts, or even the standard text.

  • AnD4D Well it's a textual game with very long texts, so I can't use sprites of texts It has to be some kind of a fixable thing, if it runs fine on mobile browsers. GiveYourFontsMono works perfectly for my needs, except that spritefont does this awful lag on mobile.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The problem seems to be that SpriteFont is rendering per tick.

    If you have a large SpriteFont with no text then there is no speed problem. ie not a problem of size.

    If you have lots of text, but in a small SpriteFont object then there is no problem.

    If you have a large sprite font with lot's of text. Then you get the lag. This indicates that SpriteFont might be rendering onto the render object everytick. Where SpriteFont should only render onto the image ctx on change and first time run.

    I found even 3000 characters on a full size screen to be a problem. So Ashley may want to look into this.

    However why do you need 30k characters? what do you need that much text for?

  • jayderyu It's a visual novel, you drag it up and down, and it's set up on half the screen on an iPad. I couldn't find an alternative. I used for an example, rexrainbows cool behaviour where you can scroll the text to a percentage and line, but it too started to lag when I used bigger texts or bigger texbox sizes (spritefont and text object both lagged in this instance)

    I need about 3500 words per textbox or spritefont object, that's the maximum it would get.

    For the text object, it doesn't lag if I have massive text, but unfortunately on ipad and mac, it doesn't allow me to have a higher object than about 4500 height. It just shows a black text. I was told that this isn't a problem, so I tried to find a workaround since then.

  • One partial solution would be eventually to use multiple spritefonts placed one after another so only one need to be rendered at a time, but that is of course a workaround and not a viable solution, it is just in case you cannot progress because of that.

  • Aphrodite Thanks for the tip. But I have to fill about 1/3 of the screen of an ipad with text.. it will still lag I'm looking for a way maybe to load with AJAX , separate pieces of a LARGE txt file. Maybe that will be a viable workaround.

  • Well I agree that some performance problem should be examined here is my suggestion.

    AJAX or local files. You should parse the text into paragraphs. create a spritefont for the paragraph. Then move them in groups. When the top moves to high destroy it and bring int he next paragraph. And reverse when scrolling the other direction. I might even suggest pre parsing and modifyin the text file store paragraph id. Of course if this is ajax then your pre break them up into numerous smaller files.

    I agree though the program shouldn't be having a performance hit at 50% of the screen filled with text.

  • jayderyu Unfortunately I can't do that since even with static text, if it's filled with 40% screen text, it lags horrendously. I managed to scale up a layer where it holds the text, I made the text much smaller font, so the height is actually much less and then it's blown up by scale, but on Ejecta it doesn't even show the text if I use scale, and on CocoonJS it still has the same 4096 limit on some devices.

    If I can find a behaviour or effect that just zooms in (scales) certain objects, that would be ideal, since I can zoom the text 3 times, and have the size 3 times smaller, enabling me 3 times the text amount of a textobject, and that's it. I would actually pay for someone to do that, I've been struggling with this error, trying to find a way around it for the last 3 months. And release date is approaching. Of course I can do it manually, but it would take a LOT of time separating all texts, and the players would benefit from a smoother experience.

  • +1 Same problem here , I am making a Word Game using SpritFont and SpriteFont+ the performance is really slow on mobile even with the phone like iPhone 5S on CocoonJS.

    Ashley , Please help

  • I think the answer here might help your issue, it helped for my project.

  • I think the answer here might help your issue, it helped for my project.

    Aha, that's why it's not laggy on a default mobile browser, the webgl is just not supported there

  • Sisyphus WebGL is supported on Safari Chrome Firefox

    , thanks for the idea, but it doesn't work in Ejecta unfortunately. I don't think that Construct 2 can tag a project to be exported as nonwebgl in Ejecta.

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