• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android Low fps when blending

O

oreygore

Guest
Hi all,

I have a problem when exporting my game to android devices.

The game has a 5000x5000 room with a view and port of 1280x720p

Without blending (for lighting effect, room dark and only one zone visible) the fps is good and reach 60fps (room limit). But when I enable blending (create a surface of wview/hview, fill with black.. etc...) the fps on a Samsung Galaxy S4 drops to 20/25 fps.

I tried in another android devices and no one reach more than 35fps. (60fps on PC).

Is there any problem with blending on Android?

Another way to make the effect?

I tried to reduce the resolution of the view by a half (640x360p) but the problem continues.

Regards, and dorry for poor English.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
First off, how many times are you calling the blending functions and how many surface sets/resets do you have? On all platforms these are slow and break the vertex batching... On android it's more noticeable due to the lower power of these devices. For blending you really want to have a controller object and set the blend mode only once in that then draw everything that needs drawing before resetting the blend mode. So you'd have something like:

Code:
// CONTROLLER DRAW
draw_set_blend_mode(bm_add);
with (obj_Player)
{
// draw stuff
}
with (obj_Effects)
{
// draw stuff
}
//etc...
draw_set_blend_mode(bm_normal);
In this way you are only switching blend modes once for everything. As for surfaces, only set/reset them when necessary. For example, in my Aura engine I only change the surface contents if the player moves or if one of the objects that casts shadow changes position. In this way the surfaces are only actually changed once or twice a second. You can also bypass the default GMS shader that is used and take control of the draw pipeline using a custom shader, which gives quite a boost to performance, although it does require more work to use (see here: http://www.yoyogames.com/blog/49)
 
O

oreygore

Guest
Hi,

I have a object to control the blend drawing. There is only one surface and I tried to deactivate the application_surface auto-draw to only draw one surface with blending effect done.

I think the problem is about the blend-control-object. Because every step he is drawing the blend-surface.

The option to only draw when moving is not good in this case, because my player is 95% of time moving.


Regards,
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Have you run the game in debug mode and checked what's really causing the issue in the profiler? http://www.yoyogames.com/blog/44 Could you maybe post the code that you think is causing the issue? If you only change blend modes and only draw to a surface once per step, that shouldn't make too much of an impact. I do wonder what the REAL FPS is when blending is off. you say it reaches the 60FPS, but what's the uncapped figure? Like if the real fps is only 65/70 then yes, I can see how adding in blending would drop it to about 35... but if the real fps is around 200+ then it shouldn't.

Basically, profile the game and see if the issue isn't actually somewhere else, and aim for a real fps of at least three times the room speed (so if the room is 60 steps per second, you ideally want a real FPS of about 180+ to give you overhead for poorer devices etc...).
 
O

oreygore

Guest
Hi,

I tried some techniques readed here (http://www.yoyogames.com/blog/49) but in android still not works good.

I print the fps_real in screen and get a value of 1120 more/less

Here are screenshots of debug mode:



any idea?

regards!
 
O

oreygore

Guest
Yesterday I tried to make the room smaller, but the problem not solved.

I know that rooms dont matters, because the view only draws part of the room, but I dont know what more I can try.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
From that profiler view the bottleneck appears to be the script pl_update. Look at optimising there?
 
Top