Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Poor performance when using backgrounds — Gideros Forum

Poor performance when using backgrounds

cvieiracvieira Member
edited September 2012 in General questions
Hi all, i'm getting a loss of performance just by using a background image... i'm doing like everybody else i think:

local bg = Bitmap.new(Texture.new("background.png"))
stage:addChild(bg)

If i don't set any background image, the performance of the game is fine... once i put an image (even low-res ones), the performance is clearly affected... any ideas of what may be wrong?

I can see this running the app using Gideros Player on the phone...

Thanks!

Comments

  • ar2rsawseenar2rsawseen Maintainer
    edited September 2012
    @cvieira That's interesting.
    How do you measure the performance to see its decreasing?
    And how much does it decrease?
  • cvieiracvieira Member
    edited September 2012
    Hi @ar2rsawseen, i've not measured yet (fps will do the basic test, thought)... it's just empirical... take it for example Ninja Soup example from @atilim (i think)... i play it without background... it runs smooth...if i put the background again everything stays much slower. It even takes longer to respond to touch actions. But i experience this in every app...
  • atilimatilim Maintainer
    @cvieira what's your device? Also can you player other games (e.g. Angry Birds) smoothly with it?
  • cvieiracvieira Member
    edited September 2012
    Hi @atilim, my device is a Huawei U8230 running android 2.2. Angry Birds is one of the games that does not run Ok on my device... too slow in fact.

    I can run smoothly for example "Farm Tower", done with AndEngine. I use it too in my apps ("Cute Balance" for example, and it runs Ok) till now that i've found Gideros.

    Ok, my device is not the best on earth :D but it should run an app like Ninja Soup very very smoothly... maybe the problem is related with the player on my device. Maybe if i export the .apk and install it, it runs Ok - i remember a while ago i've tried the .apk of some helicopter game (don't remember the name, but it was made by someone from the community), and it ran Ok... very smoothly indeed.

    Do you think it can be the gideros player in the specific device? The player demands for a better device?

    Thanks!
  • atilimatilim Maintainer
    I think, it won't change anything if you export as .apk. @GregBug developed the helicopter game and from then till now we haven't changed the graphics engine radically.

    I remembered that @GregBug open sourced the game. If possible, can you test that game with the current version of Gideros?
  • Ok, i will do the test and then post the result here.

    Regards,
  • @cvieira on my Huawei 8650 (amrv6 600Mhz) Gidhelix run smooth... even on my ipod 2 (armv6 400Mhz? i think)

    and Gidhelix is my first try to "code" with gideros so is not optimized... and is not well coded.

    even my upcoming lib (collision system) in the examples/test files i use a background (320x400 tnt collision logo) but i can't notice differences if i put background or not.. (huawei 8650) ...

    some time ago i tested a private beta of "super daddio 2" that use a "massive" background and paralax system and run smooth on my huawei device (it's the slower device that i have togheter with ipod 2^gen ... and i test everything on this devices...)


    let me know how run Gidhelix...

    i'm curious now... :)


    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • BTW you Huawei specs:


    OS Android OS, v2.1 (Eclair)
    Chipset Qualcomm MSM7200A
    CPU 528 MHz ARM 11
    GPU Adreno 130


    so not should be so bad:

    Supported APIs:
    OpenGL ES 1.1
    OpenVG 1.1
    EGL 1.3
    Direct3D Mobile
    SVGT 1.2
    Direct Draw
    GDI
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • atilimatilim Maintainer
    @cvieira on my Huawei 8650 (amrv6 600Mhz) Gidhelix run smooth... even on my ipod 2 (armv6 400Mhz? i think)
    Did you used the current version of Gideros?
  • @atilim
    no... but i can try (as soon as i go home from work)
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • I've made the test, and gidhelix pass the test with distinction :) it runs very smoothly... so i can't understand what the problem is with my code or in Soup Ninja, etc... i'm using version v2012.08.4.
  • cvieiracvieira Member
    edited September 2012
    Hmm, i've made some further tests on my app and with Soup Ninja... if i set orientation to portrait (since both are originally landscape), then the problem is gone!!! Does this makes any sense?
  • GregBUGGregBUG Guru
    edited September 2012





    Gidhelix running on my Huawei 8650... :)
    using version v2012.08.4.

    Likes: atilim

    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
    +1 -1 (+1 / -0 )Share on Facebook
  • atilimatilim Maintainer
    edited September 2012
    @GregBUG you're the one!

    @cvieira hmm.. it doesn't make sense at all. (maybe after changing landscape to portrait, only half of the background image is visible and OpenGL doesn't fill the region outside)
  • cvieiracvieira Member
    edited September 2012
    @atilim yes, that's true... but i've tested gidehlix again and changed from portrait to landscape (in this case OpenGL does not fill the region that stays outside), and FPS slow down. With portrait mode i have an average ~25FPS, and in landscape the average is close to ~18FPS, getting even some values < 10FPS, what does no happen in portrait mode...
  • cvieiracvieira Member
    edited September 2012
    @GregBUG there is another game made with Gideros that i've installed other day - "Mashballs" i think... can you test in your device? On my device it's not smooth at all... far from that... it's landscape also...
  • GregBUGGregBUG Guru
    edited September 2012
    @GregBUG there is another game made with Gideros that i've installed other day - "Mashballs" i think... can you test in your device? On my device it's not smooth at all... far from that... it's landscape also...
    just tested and it run fine...

    if for the authors is ok i can upload a video... (@ar2rsawseen ?)

    :)

    may be a GFX HW limitation/BUG of your device ?
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • Thanks @GregBUG... yes, it might have some limitation, but it does not happen with many games made with other engines... that's the weird thing...
  • ar2rsawseenar2rsawseen Maintainer
    edited September 2012
    @GregBUG sure.

    We are actually optimizing it right now to get more performance, but on the other hand adding more animations and small details to make it more polished, so in the end I don't think there would be a difference. :)

  • ChangChang Member
    edited September 2012
    Hey guys, using 1 large background (320 x 480) compared to 4 small backgrounds (320 x 120), does it make any difference?

    I remember reading from somewhere about splitting large image into small images leads to slight increased performance, or at least shorter loading time?
  • here is it...



    Mashballs run really fine on my U8650 :)
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • Hi @Chang, well, it worth trying it... i'll make a test and post the results here...

    @GregBug - Thanks for the testing!
  • cvieiracvieira Member
    edited October 2012
    @Chang, i've made the tests and there is no improvement in performance... there is no doubt that using landscape orientation with an image as background, the performance is quite bad... but it seems that is something related to my device... it seems that this is the only explanation :(
  • @cvieira maybe you should now try on other devices :)
  • ScouserScouser Guru
    edited October 2012
    @cvieira: I was under the impression that when using a background image whether it is 320 x 480 (or 320 x 120) there will be some speed problem due to the fact that the bitmaps (textures) are not a power of 2 wide (2, 4, 8, 16, 32, 64, 128, 256, 512) which means they have to be expanded into a buffer before they are transferred to the hardware. I may be wrong & if I am then I'm sure someone will be along soon to say so :)

    I tend to now put all my images onto a packed texture (using Gideros Texture Packer) but I also tend to create a tilemap of my backgrounds and add this image to the texture to save image space and time due to less texture transfers. If all of your images will fit onto one packed texture then you only have to transfer 1 correctly sized texture to the GPU. :)
  • Hi @Scouser... in fact the images that i'm using are not power of 2... but why this happens only on landscape mode... i'm using the same image as in portrait (but flipped of course, to fill all the screen)? I also tried with packed textures already... minutes ago i was trying a simple application with only a background and a box2d object moving... runs perfectly in portrait... the same app runs almost with a half FPS in landscape mode...

    Maybe in a better device than mine this happens also (decreased performance - measured in FPS - in landscape with background image), but because it runs much faster user does not experience great difference...

    Maybe someone can make that test so we can have no doubts... if you have any time available to do the test with some of your games, or a template one (such as soup ninja from @atilim or Gidhelix from @GregBUG), i will be appreciated!

    Thanks!
  • Same with my Lenovo K10, here in 2016 year. Whats the problem ?
    vk.com/yan_alex
Sign In or Register to comment.