touch delay on WP ( Lumia 930 )

Yeap, I thought about that and tested my app without Visual Studio debugger, but buttons still delayed after a few minutes of playing.

I would try to build and test some simple apps and games to check if it was caused by the WP problems or my game’s performance issues. I’m not sure it was due to performance issues, because the game still responds to accelerometer immediately, and I didn’t feel fps drop too much. Only touches delayed T_T

My Game uses physics, so I will try to check on some other apps without it. I will be back with more information.

I just ran the newest daily build of CoronaCards for WP8 and touch events worked pretty smoothly for me.  I ran it with the following “main.lua” file…

system.activate( "multitouch" ) local touchCircles = {} local function onTouch(event) if (event.phase == "began") then local circle = display.newCircle(event.x, event.y, display.contentWidth \* 0.2) touchCircles[event.id] = circle elseif (event.phase == "moved") then local circle = touchCircles[event.id] if circle then circle.x = event.x circle.y = event.y end elseif (event.phase == "ended") or (event.phase == "canceled") then local circle = touchCircles[event.id] if circle then touchCircles[event.id] = nil circle:removeSelf() end end end Runtime:addEventListener("touch", onTouch) display.newText("Touch Me", display.contentCenterX, display.contentCenterY, nil)

And the following “config.lua” file (don’t forget to set it to 60 FPS)…

application = { content = { fps = 60, width = 320, height = 480, scale = "letterbox", }, }

Can you try the above on you device too please?  If it runs smoothly on your device as well, then I suspect something else is the cause of the performance issue.

 Thank for your advice. I will try more and back with some information

 Hi Joshua, I’m done with some tests. 

 You codes ran smoothly on devices without any delaying touch. I tried another widget sample from Corona SDK and it had nice respone, too. Maybe you’re right, the problem’s due to performance issue.

 But I didn’t feel any fps drop, my game still run smoothly. Animation, player’s move, accelerometor event etc were still working perfectly. But only touchs delayed !

 Do you wanna try to play my game and tell me what happens with it? I could send you a demo version of windows phone. Please send me your email address if possible.

 Btw, here is the Android version:

https://play.google.com/store/apps/details?id=com.rubycell.game.bunnyjump.wow

 It can run okay without any problem on devices like: Galaxy Note 3, Nexus 7, Galaxy S3 etc. No touch delays at all.

You can send us your project by clicking the “Report a Bug” link at the top of this webpage.  But we’ll probably won’t have time to look into it this week since we have a major holiday (Thanksgiving) this week.  So, let’s see if we can narrow it down.

>> But I didn’t feel any fps drop, my game still run smoothly.

Hmm… that’s interesting.  I’ve never seen that before.  Just to confirm, would you mind adding the following code to your “main.lua” file please?  This will print the average FPS once a second to your Visual Studio “Output” panel.  Double check to see if dragging your finger onscreen is causing any large dips in the framerate.  If it’s not, then yeah, it sounds like touch events are being delivered late on the Microsoft Silverlight side.

local lastEnterFrameTime = nil local durationCollectionSize = 60 local durationCollectionIndex = 1 local durationCollection = {} for index = 1, durationCollectionSize do durationCollection[index] = 0 end local function onEnterFrame(event) local currentTime = system.getTimer() -- If this is the first frame, then fetch the current time and exit out. if (lastEnterFrameTime == nil) then lastEnterFrameTime = currentTime return end durationCollection[durationCollectionIndex] = currentTime - lastEnterFrameTime lastEnterFrameTime = currentTime if (durationCollectionIndex \< durationCollectionSize) then durationCollectionIndex = durationCollectionIndex + 1 return end local averageDuration = 0 for index = 1, durationCollectionSize do averageDuration = averageDuration + durationCollection[index] end averageDuration = averageDuration / durationCollectionSize local averageFps = 1000 / averageDuration print("Average FPS = " .. tostring(averageFps) .. ", Average Duration = " .. tostring(averageDuration)) durationCollectionIndex = 1 end Runtime:addEventListener("enterFrame", onEnterFrame)

If the touch delay is coming from the .NET side for whatever reason, some feature that your app is using must be causing it.  Are you using any 3rd party libraries such as AdMob?  I remember AdMob would cause some random lag, but it was to the main UI thread as a whole which affected the framerate too.  You might want to try commenting out features like that to see if that’s where the issue is coming from.

 Regarding the 3rd party, I’ve just started to port my Game, so I’ve not used any 3rd party yet. The only non-ingame module is Gg Analytics with http request.
 I’ve done with your test. The average FPS is between 55->60. And buttons delays about 100 -> 500 ms. This only happens after a few minutes of playing. But my game run smooth so I don’t think about leak :frowning:

Does your app do anything with the touch event’s timestamp?  (ie: The “event.time” property?)

I ask because I’ve noticed that the touch event’s timestamp don’t match what we’ve documented.  They’re not in milliseconds since app startup.  That shouldn’t cause a delay though.  But it might screw up a calculation somewhere.

And you said this is only an issue with widget buttons?  It’s not an issue in your own code?  It takes about 100-500ms for button tap to register?

 I did nothing with touch event’s timestamp.

 My game ran on android perfectly so I think it is not caused by logic code. Guess that as you said, st happened in Microsoft Silverlight side.

 Sorry for my misunderstanding, let me make it clearer. I tried my own custom buttons, but here comes the same result. I pressed on a button, and it changed to ‘pressedState’ after ‘delayTime’. I ‘released’ the button, and it was back to ‘defaultState’ after ‘delayTime’. Touches delayed in all of my game. The buttons include widget button or my custom buttons.

I don’t think this is a touch event issues since we’ve proved that my code up above works fine on your devices.

I don’t think this is a performance issue either since your app I running at 60 FPS just fine.

So, I’m thinking this must be timer related.  That would explain why there is a delay but no impact on framerate.  Although our widget button code doesn’t use any timers that I know of.

In daily build #2755, we made changes to the Win32 and WP8 versions of Corona to provide much more accurate timers and timestamping.  Are you using daily build #2755 or newer?  If so, then trying using daily build #2754 and see if that gets rid of the delay.

   https://developer.coronalabs.com/release/2015/2754/

You’ll need to uninstall the CoronaCards extension from Visual Studio in order to go back a version.  We provide instructions on how to uninstall here…

   https://docs.coronalabs.com/daily/coronacards/wp8/uninstall.html

  Recently I’ve used CoronaCard build #2775.

  I don’t know how the enginer works, so I can’t guess what the problem is. But for my own custom buttons, i only use a simple code which looks like:

button:addEventListener("touch",function(event) if event.phase == "began" then button:setDisplayState("over") else --other logic end end)

 Hi Joshua.

 Did you comeback from Thanksgiving :slight_smile:

At this point, I’m  not sure how to help you further.  We’ve proved that the touch events are not actually delayed.  And that you’re not running into a performance issue.  So, it must be whatever the touch event is triggering in Lua.  Try adding your button to the multitouch code I posted up above.  See if you can reproduce it with a much simpler app.  That’ll make it easier to isolate.

 Okay. My project is too big to be used in an issue report.

 I will try to reproduce it with a much simpler app.