Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Touch event causes drop in frame rate — Gideros Forum

Touch event causes drop in frame rate

ChangChang Member
edited October 2012 in Bugs and issues
Hey guys,

I'm not sure if you guys have encountered this or not. I've tried this on iOS (iPhone 4), for Android (Nexus 7) I didn't catch this issue, maybe because the device hardware is greater.

I've tested on two sample apps: 1) With Mouseclick-began / Touch-began events; 2) Without any touch event.

When I touch the screen repeatedly, I can see drops in fps, even if the app does not have any touch event registered. For example, the sample "demo_8" of tnt particle engine shows drop in fps when you touch the screen repeatedly. This only happens when you first touch the screen. Moving your finger on the screen and leaving your finger off the screen do not produce this issue.

In a game that I've planned to develop, it requires rapid and repeated touches on the screen, so this is now a show stopper for me. Are there any workaround or configuration that I've missed? Thanks.
+1 -1 (+1 / -0 )Share on Facebook

Comments

  • How great is the drop of FPS?
    Because even with older Android and Ipod touch 4gen I don't see anything noticeably different
  • ChangChang Member
    edited October 2012
    Instead of drop I would say that the frame seems to pause for 1-3 frames on touch. As soon as the 'pause' is gone, the frame rate is back to normal.

    EDIT: You have to compare the motion of the particles without touching the screen vs touching the screen repeatedly. You can notice the difference in smoothness.
  • i can confirm this it is also happening in my optimus one but only when there are lots of objects on the screen (approx 60-70) and it will not happen or totally not noticeable when number of objects are less say approx 30

    :)
  • ChangChang Member
    edited October 2012
    I use the Xcode debugger to view the FPS. Without touching anything, the FPS stays at 60. When I touch the screen repeatedly, it drops to 59,57,55,59. It shows increase in frame time for CPU.

    I've tried this with less than 30 objects. But with some objects constantly moving.
  • Sounds like lot's of garbage is being generated.

    Try adding a collectgarbage("collect") call in your main onEnterFrame handler - that should hopefully smooth out the collection process and stop too much garbage being generated.

    Careful use of a mesh might also help performance as if you only had one mesh in the scene there wouldn't be so many objects to filter the touch events to.
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • I've tried collectgarbage("collect") and the result is same as before.

    Another problem now is, even when the app does not have any touch event registered, touches on the screen still drops the frame rate.
  • Touch events are still passed to all objects even if you don't supply handlers (I think), how many objects do you have off screen - check the number of objects actually added to the stage and potentially remove ones not in use
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • If you stop the propagation of an event earlier on will that save the overhead of sending it to every object?
  • ChangChang Member
    edited October 2012
    @techdojo There are no offscreen objects in my sample app.

    @zvardin I've stopped the propagation but it's the same.

    I use the Jumping Ball example, it is the same. Even without touches, the bouncing motion of the balls sometimes seems to suffer once in a while. This is the issue I've reported before: http://www.giderosmobile.com/forum/discussion/808/most-efficient-way-to-move-objects

    I don't think it has anything to do with garbage collection also as I've tried forcing garbage collection on every frame.

    When I use device with higher spec (Nexus 7), this problem seems to go away. But the problems I have now are tested on iPhone 4 and iPod Touch 4.
  • I have played all day with this, adding dummy listeners to hundreds of objects, adding listeners to large objects (big dimensions), adding listeners to parents with a lot of children. But could not catch anything noticable on my Ipod4gen and LG Optimus P500.
  • GregBUGGregBUG Guru
    edited October 2012
    tested demo_8 of tnt_engine and jumping balls
    no problems with my old iPod 2^nd gen.
    U8650 (Andorid) Pad 1^st gen iPod 4th.gen and my Samsung Galaxy S3...

    :-/
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • Really? :-/ Did you guys test on 60 FPS? Since @hgvyas123 also encounters this, I think its good to update to this thread if anyone notice the similar problem.

  • atilimatilim Maintainer
    edited October 2012 Accepted Answer
    Handling of touch/mouse/key events is not optimized (but ENTER_FRAME event is). This may cause problems with slow devices. Let me optimize it (most probably with the next release).
    If you stop the propagation of an event earlier on will that save the overhead of sending it to every object?
    exactly!
  • phongttphongtt Guru
    edited October 2013
    Touch events are still passed to all objects even if you don't supply handlers (I think), how many objects do you have off screen - check the number of objects actually added to the stage and potentially remove ones not in use
    Sorry to dig up this topic.

    @atilim / @ar2rsawseen

    Is it true that "Touch events are still passed to all objects even if you don't supply handlers" ? Any exception such as unless they're not visible?
  • ar2rsawseenar2rsawseen Maintainer
    edited October 2013
    Touch/Mouse/Key events were optimized since version 2012.09.2 ;)
    so no, they are passed only to the objects with handles, that are attached to stage tree
Sign In or Register to comment.