Game stops receiving any touch events

Hello,

I reporting a possible bug. I consider adding it to GitHub, but first I want to ask you opinion. Thank you for consideration.

I use Phaser CE 2.12.0 + Cardova Android. Testing on Android 8 (real device).

The game sometimes stops receiving any touch events. Nothing is touchable, although all the rest of the app (animation, etc) continue working. The problem resolved after collapse/restore the app.

After digging into Phaser source code, I find out that initial events _onMSPointerDown and _onMSPointerUp continue dispatching fine, but it never get propagated to my code. I was able to figure out the reason.

It seems that pointer up event sometimes get missed. If this happens, the game stops receiving any subsequent touch events.

The sequence is the following:

  1. The game receiving _onMSPointerDown event
  2. Pointer locks in active state. The event.identifier stored in pointer1.identifier.
  3. The up event with the same identifier lost (probably due of processor load)
  4. Any further pointer down events ignored because pointer is in active state (it’s awaiting for up event)
  5. Any further pointer up events also ignored because new event identifier doesn’t match the stored one.
  6. All touch events locked now.

Source for #4:
Line 39558: if (!this.pointer1.active) <-- this now never true (the same for pointer2)

Source for #5:
Line 39634: if (this.pointer1.active && this.pointer1.identifier === event.identifier) <-- identifiers doesn’t match, the touch never stops (the same for pointer2)

The problem is reproducible, but random. Happens more often when device is slower or debugger attached. I want to emphasis that problem happens on real device testing in release version without any debugger attached. The debugger just make the problem much worse and easier to reproduce.

** UPDATE **

After some digging more, I find out that instead of _onMSPointerUp I’m getting _onMSPointerOut. I found the following solution (a hack), which seems to works for now, but more testing is coming up:

game.input.mouse.mouseOutCallback = function (event) {
console.log('Mouse out callback: ’ + event);
game.input.pointer1.stop(event);
game.input.pointer2.stop(event);
};

Thank you,
Mike

Hi,

Thank you for reporting this bug Mike Keskinov, it should be interesting to open an issue on the Phaser CE repository for it so we can do a code review all together with @samme and the other code reviewers

I think that a copy past of this forum entry should be just fine because it’s not automatically that it is a bug known by the community and the reviewers are not all the time reading the entries of the forum because there is a lot of questions about the use of Phaser its self not a reporting of a bug for instance and you also have described the problem you faced very well

So thx again, we’ll check this all together on the repository with the workflow process of a bug report then a code review process

Thank you, will do now

1 Like

Hi Mike,

Have you found a workaround? I have the exact same problem; ie the input.pointer1.active is stuck at true state for some reason and the input stops functioning. I mainly observe this on IOS though. Android seems to be working fine for some reason…

Thanks,

Doug