Spritefont horrific lag on mobile, Ejecta, CocoonJS

Bugs will be moved here once resolved.

Post » Fri Jul 25, 2014 5:54 am

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
download/file.php?id=4012

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
B
38
S
6
G
1
Posts: 306
Reputation: 2,902

Post » Fri Jul 25, 2014 10:12 am

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?
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Fri Jul 25, 2014 10:55 am

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 :)
B
38
S
6
G
1
Posts: 306
Reputation: 2,902

Post » Fri Jul 25, 2014 10:58 am

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.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
82
S
14
G
7
Posts: 975
Reputation: 11,037

Post » Fri Jul 25, 2014 11:01 am

@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.
B
38
S
6
G
1
Posts: 306
Reputation: 2,902

Post » Sat Jul 26, 2014 2:44 am

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?
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,038

Post » Sat Jul 26, 2014 3:55 am

@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.
B
38
S
6
G
1
Posts: 306
Reputation: 2,902

Post » Sat Jul 26, 2014 10:13 am

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.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sat Jul 26, 2014 10:20 am

@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.
B
38
S
6
G
1
Posts: 306
Reputation: 2,902

Post » Sat Jul 26, 2014 4:54 pm

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.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,038

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest