Hi,
I am developing my new game with Gideros after 3 games in Corona. I gave up Corona because of android performance issues.
I have tested game on android tablets and some android phones, performance is really fine. But, when I started to test on iPhone, there is observable touch latency problem. Android can detect touch perfectly, but ios detects in half second. I have used EVENT.MOUSE_DOWN, EVENT.MOUSE_UP events. Is there any difference between "touch" and "mouse" events ? Please help me, I have finished everything with gideros. I like that very much. So I do not want to move to other development platforms and rewrite code.
Comments
I don't remember since which version, but there was an optimization for mouse/touch events.
Earlier mouse events were for desktop and touch events for mobiles, now you can select in project properties to dispatch events on both. So there should not be any huge difference.
One thing to try you can put event:stopPropagation() in all you touch/mouse events to stop events and prevent them form dispatching on other elements.
I thought, converting mouse events to touch event can cause performance issue so I changed mouse events to touch. But both has same problem.Also I'm using event:stopProgation().
Is there any other way to optimize touch events performace ?
well the problem is, that I don't know any other who would experience performance issues with touch events on IOS platform.
Is it through the Gideros player or exported app? Maybe you have older Gideros player?
Maybe it's some specifics you do inside touches, what exactly you do in them?
I have tested in gideros player, android tablet and an old android phone with player and built apk. All has perfect performance.
With gideros player(on device) and exported built has poor touch performance on IOS device. I have tested on Xcode native ios simulator now. That works well because of computers CPU.
If issue causes because of specifics inside touches, same problems should occur on android devices too ?
in corona
I think this can cause the problem. Does gideros needs some core code optimization ? or am I doing something wrong. Is there anything to check in my code ?
I have not experienced any latency issue with Gideros and iOS. Are you using a particularly old (i.e. slow) device? There should be no problem searching 56 objects for a touch location - this should occur almost instantly.
Are you sure there are only 56 objects on the stage? Previously people who have experienced performance issues have inadvertently been adding far more objects than they think they have.
Also, your code looks slightly odd to me. Is Engine a class of which there is a single global instance or are there 56 of them. Perhaps you are registering all 56 objects with your single engine class? If this is the case then your onMouseDown() function is hit testing against the engine and not the target of the touch.
best regards
Basically touch/mouse event is called on all objects that registered to it. Then inside it you can check using hitTestPoint was this touch meant for specific element.
This gives you a flexability of, for example, increasing touch area of small images/buttons, or checking that specific image on top or bottom received the event.
but once you are inside if self:hitTestPoint ...
then it means you have found what you needed and you can call event:stopPropagation() so it will not be dispatched further.
I hope @atilim could shed more light on the issue, in the meantime, it might be useful to prepare a small example of a slowdown that you could share with others to test.
I have box and engine classes. I am creating 56 boxes from box class and add to engine sprite class. I am adding touch/mouse eventlistener for all boxes. I didnt create touch events in box class, because box needs interaction with other boxes. I am counting max 30-35 touch calls until hittest returns true.
May be my code needs optimization. But as I said before, I just want that should work like on my andorid device( 2 years old HTC Desire). I am testing on IPhone4. I will test on blank project only for touch performance.
Thank you very much for your answers
best regards
@bowerandy, I change to event.target. Nothing changed.
Android is ok, but ios still has noticiable latency. I will test with blank project tomorrow. I hope I will solve the problem.
best regards
Likes: atilim
As a result, sounds caused my problem. I am using mp3. What am I supposed to do for better sound performance? I attached test code with sounds.
thank you all, for your helps
Hope it helps.
www.tntengine.com
best regards