[Performance Question] Rendering on mobile

Discussion and feedback on Construct 2

Post » Wed Apr 16, 2014 3:19 pm

Fimbul wrote:The problem is, if I'm getting 5fps in a mobile, that means the device is doing a ton of work.

True, the user probably doesn't care, but his battery will notice for sure. Especially since this is a visual novel, so it's supposed to be experienced in long stretches.

Also, just throwing this out there, if the most frequent bottleneck on mobiles is fill rate, why not limit the redrawing to only the parts that change? Yes it's impossible in some types of games, and yes you get a bigger hit on the CPU, but on the other hand the GPU will have less work to do.


EDIT: I wonder if drawing this picture into a separate canvas (through the canvas plugin) would mean that the canvas itself would not be redraw on screen, and so help for that.
Last edited by Aphrodite on Wed Apr 16, 2014 3:23 pm, edited 1 time in total.
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 » Wed Apr 16, 2014 3:21 pm

The text changes.
B
36
S
8
G
8
Posts: 532
Reputation: 6,903

Post » Wed Apr 16, 2014 3:24 pm

Fimbul wrote:The text changes.


I edited my post just after posting it, but it was too late:

I meant drawing this picture into a separate canvas.
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 » Wed Apr 16, 2014 4:22 pm

@Fimbul, what device are you testing on? If you're remaking that screenshot, there's a lot of overdraw going on, as remember even fully transparent pixels in a texture are still drawn by the gpu, and semi-transparent ones take a lot more work to draw, so you might try making the text background fully opaque. Also, are you using normal text or sprite text? I seem to recall some people talking about normal text having worse performance. Otherwise, the only ideas I have are to check your CPU use, or as mentioned, pasting everything except the text to an instance of the canvas or paster object.
Moderator
B
95
S
34
G
33
Posts: 3,006
Reputation: 27,874

Post » Wed Apr 16, 2014 4:32 pm

The screen uses more battery than the CPU or GPU in modern phones, so even if the game is inefficient it will be less important than simply how long the user has their screen on and its brightness level.

Only redrawing small sections of the screen is surprisingly complicated to implement properly, and will actually involve a fair amount of CPU work to correctly calculate the changed region. GPUs are often so fast that it could actually be slower in some cases than just redrawing the whole screen anyway. Simple approaches are often fast ones.
Scirra Founder
B
397
S
236
G
88
Posts: 24,422
Reputation: 194,558

Post » Thu Apr 17, 2014 1:54 am

Fimbul wrote:But surely there are scenarios where a big image has to be used, and you cannot compose, right?


Under such a scenario, even a weak mobile will run your game at 40fps+, try it, make a quick background and one character sprite and updating SpriteFont, compile and test on your device. Should be silk smooth with the text update.

The only problem is multiple pictures like that compiled with CocoonJS will destroy even modern devices in terms of memory usage. CocoonJS loads ALL your graphics into memory on startup, even if you do not require it on your current layout. It's the bane for larger games.

But if you do it, use Intel XDK, it will only load the assets required for that one layout. So such a scene, with a 720p background, a large sprite etc, wouldn't take more than 50mb of ram. It then frees the ram when you change layout into a another scene.

I drew about 30 different 720p backgrounds for my Ninja Legacy (first) game, since I was clueless about good game design and about CJS's inability to handle layout loading... I ended up using about 11 BGs only and cut back on character animation frames. Still, the game used 450MB of ram with CJS. Same game with Crosswalk/XDK, only 240MB peak in a busy scene with lots of enemies.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,614

Post » Thu Apr 17, 2014 2:02 pm

@Silverforce Did you try Crosswalk? does it load partial memory for one layout?


EDIT: I'm curiosity about the sprites, if a sprite has more than 20 animations does it affect memory usage?

This sprite has 20 animations each 5 animations are used for color, eg. 5 are blue, 5 are red, etc.

Is recommended to create new object as sprites with 5 animations instead of 20 animations?
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Fri Apr 18, 2014 9:10 am

Joannesalfa wrote:Is recommended to create new object as sprites with 5 animations instead of 20 animations?


No. It's more efficient to fill a single spritesheet instead of splitting your animations between more objects.
This blog post may clear your doubts.

https://www.scirra.com/blog/87/under-the-hood-spritesheets-in-construct-2
B
11
S
3
Posts: 224
Reputation: 2,028

Post » Fri Apr 18, 2014 12:24 pm

@Joannesalfa Definitely Crosswalk/XDK does layout-per-layout loading of art into memory. The difference in startup times and memory usage is massive. My big game with CJS took 40 seconds to load even on beefy devices, uses 450mb of ram. On Crosswalk, takes about 10 seconds to load, uses 240mb ram.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,614

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: mihirolover and 12 guests