Spritefont horrific lag on mobile, Ejecta, CocoonJS

Bugs will be moved here once resolved.

Post » Sun Aug 03, 2014 8:13 pm

damjancd wrote:I can't disable webgl in construct for Ejecta. It reads it as enabled... although I use latest unstable build of Ejecta.
In terms of FPS, webgl is supposed to help you run your game faster, but there is a bug with spritefont on mobile, and it runs bigger spritefont texts awfully.


can you sen me the link of lastest ejecta unstable ?
thanks in advance
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Mon Aug 04, 2014 12:45 am

@matrixreal here you go https://github.com/phoboslab/Ejecta/archive/master.zip Latest development build. same way you use Ejecta 1.5 :)
B
37
S
6
G
1
Posts: 301
Reputation: 2,865

Post » Tue Aug 05, 2014 4:04 pm

The problem is the sprite font of the size in your project has 30,000 characters, meaning every frame must render 30,000 quads, which is far beyond the budget of most mobile devices.

I've optimised the Sprite Font plugin for the next build so it only renders the on-screen characters. This substantially boosts performance for your given project, but won't do much to help if it's slow with the entire sprite font on-screen. (On iOS Safari this is probably solely down to lack of WebGL support which is supported in iOS 8.)

Sprite Font+ obviously isn't fixed because it's a third party plugin, and this is one of the disadvantages of using unofficial plugins, but if you ask the dev then they may be able to diff the runtime scripts and add the optimisation to the third party plugin as well.

I'd still recommend splitting the object up in to smaller paragraph-sized objects if at all possible, regardless of whether you use sprite fonts or text objects. This allows the engine to quickly skip entire offscreen objects without having to determine whether individual lines/characters are within the viewport.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,600

Post » Tue Aug 05, 2014 5:29 pm

@Ashley , I suspected that it's something like that, that it was rendering them separately and not only onscreen ones. THANK YOU for the optimisation, I'm going to go with text object though, but others will surely benefit. I have yet to find an automated method to load in the massive text quantity that we have. So we are just adding continue or choices along the way to break it up. I can't have more paragraph sized objects since there is really big amounts of text. It's practically a whole novel :)
B
37
S
6
G
1
Posts: 301
Reputation: 2,865

Post » Tue Aug 05, 2014 6:02 pm

I don't understand why you can't have separate objects. Of course it's a lot of text, you just need to break it up in to separate objects, so instead of one object with 100 paragraphs, you have 100 objects with one paragraph, positioned in the right places for appropriate text layout. That will probably be far more performant no matter which object you use, since word and glyph layout and rendering only happens on a paragraph level, not on a novel-length level.

One other thing to try if you really must have extreme-sized text objects is to disable WebGL mode. Rendering text in WebGL mode requires an intermediate texture which caps you at the device maximum texture size, which is sometimes as low as 2048x2048 and commonly 4096x4096. Rendering text in canvas2d mode can be done directly and the maximum texture size (probably, depending on browser implementation) does not apply. Even so each time you draw text the browser may need to do a full text reflow to calculate word wrapping, kerning etc., so it will still be a significant benefit to break it up in to separate objects.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,600

Post » Tue Aug 05, 2014 6:45 pm

@Ashley I'd have to load each paragraph separately, and gauge how many words the paragraphs have before loading. Right now, I either AJAX load the text into the text.object or manually via action, but I load a big chunk of text, about 1500 words.

If I load separate paragraphs, I'd have to go through the whole novel (which branches, a LOT) and cut separate pieces and stick them in the project. I'm the only one doing the implementation of the assets, everybody else is working on other aspects of the game.

About WebGL, I tried turning it off, but ejecta (unstable build, because I need lazyloading) doesn't read the switch to no WebGL, and plays everything in WebGL no matter what I select.

Also I tried using no WebGL in CocoonJS, just to test it, and it runs slow. So I guess I need the speed bump. It's still an interactive visual novel :) So it has a lot of other aspects that take up CPU GPU.

Regardless, the project is moving forward well, and apart from a small lag on release date, we will be on schedule :)
B
37
S
6
G
1
Posts: 301
Reputation: 2,865

Post » Tue Aug 05, 2014 7:42 pm

hi
really its difficult for me
i don't understand what ashley and damjancd speak about

iam using sprinte font to set score every 1 secondes (and webgl desabled) ...

if i will use ashley's new beta or text font ... it will optimise some lagging ?

thanks
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Tue Aug 05, 2014 8:47 pm

matrixreal wrote:hi
really its difficult for me
i don't understand what ashley and damjancd speak about

iam using sprinte font to set score every 1 secondes (and webgl desabled) ...

if i will use ashley's new beta or text font ... it will optimise some lagging ?

thanks

If i get it right, next beta or stable release. But if you use it only for score, you will not notice any lags, lags appear only if you had 500+ or more characters.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Wed Aug 06, 2014 3:55 am

i don't understand why for exemple .... iphone 4 can run complicated games in appstore faster and very playable
and my games made by c2 are little slow ... is it because using ejecta and wrapper ? or there is something i forget ?
any one can give us an exemple of complicated game running good on iphone 4 ?
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Wed Aug 06, 2014 11:04 am

matrixreal wrote:i don't understand why for exemple .... iphone 4 can run complicated games in appstore faster and very playable
and my games made by c2 are little slow ... is it because using ejecta and wrapper ? or there is something i forget ?
any one can give us an exemple of complicated game running good on iphone 4 ?

I guess this is because iphone 4, the device is very weak for html5.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

PreviousNext

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests