phaserjs / phaser-ce

Phaser CE is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.

Home Page:http://phaser.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Game "freezing" on Sharp AQUOS devices with ScrollAuto feature - problem with pointers

SBCGames opened this issue · comments

This Issue is about a bug in the API. In fact, maybe not bug but not handling specific mobile device feature...

We got reports from clients, that our game freezes on Sharp AQUOS devices. These devices are popular in Japan and has feature ScrollAuto (look at page 58/59 http://help.mb.softbank.jp/aquos-r/pdf/aquos-r_en_userguide.pdf) which activates after long drag and makes page to scroll automatically.
We found, that users are accidently activating this feature. On image below you can see, how it looks - if user drags finger slowly up, arrow in circle appears and when user clicks it (releases finger on it), feature is activated.

ScrollAuto

Our game is not scrolling anywhere, but after user clicks arrow two (important) times, game stops to respond to further touches. Sponsor purchased one of these devices (unfortunately, I can't debug directly on device, so everything is inspected through on screen debug output for now) and after several tries, we found, that game only looks frozen and Phaser engine still gets pointer up/down events, unfortunatelly, it is not passing it into game.
I tried Phaser game made by another developer, which does not need long drags to play. I made long drag and game looked frozen after one arrow click.

I also found, that releasing finger on arrow or clicking it fires onPointerDown, but there is no pointer up event. And here is probably problem. By default Phaser has 2 pointers, Our game is not changing it, so it takes two clicks on arrow to use all pointers. That another game had Input.maxPointers set to 1, so it took only one click to "freeze" game.
So, engine still gets pointer up/down events, but as it is out of pointers (consumed by ScrollAuto), it does not send input into game.

So far it looks, like pointers are set into state "active", but never stopped/deactivated. Not sure, if ScrollAuto simply does not send pointer up event or there is some mess in pointer identifiers (probably first, as there is no pointer up event). We will investigate further to see, if it is possible to distinguish somehow clicks on ScrollAuto controls from clicks into game or to find some way how to cancel/get rid of these clicks.

I wrote it here to make these findings public and also would be happy if someone who was already solving this has solution...

commented

Can you screenshot https://cdpn.io/samme/debug/gKqgbB?

May be similar to #663

Thanks for answer. I will add screenshots in next few days (I have no direct access to device).

Not sure, it is similar/the same as mentioned issue. I have experience, that iOS often does not call onResume (randomly when opening/closing other tabs, ending incoming call, etc.) and game remains paused (which looks like it is frozen), but it is different issue.

We checked your test case. Things are even more crazy - in attachment is video, what is happening:

  • video starts when user is dragging slowly up to let AQUOS show ScrollAuto arrow (poiner1 - ID 2),
  • when finger is lift over this arrow, pointer 1 is released and immediately acquired by device with ID 3. It also starts to move up. Pointer 1 is then never released...,
  • after pointer 1 is auto scrolled up out of the screen, next pointer down event is spawned. It acquires pointer 2 with ID 4 and nevere releses it too,
  • now test case looks like frozen as it can't accept any further user input.

AQUOS_Pointers2.zip

Next, I would like to test, if there is some way, how to distinguish these ScrollAuto events from normal game clicks. For this I need to inspect device, so we plan connecting device to PC of owner and then remote access from my PC to PC of owner...

We made tests on target device and below is image of regular pointer event in beginning of onPointerDown() function and also pointer event generated by AQUOS on-screen controls.

Events from on-screen controls have all these properties set to true: altKey, ctrlKey, metaKey, shiftKey.

Now, question is: is it hack from Sharp developers or is there any meaning when these properties are set on mobile device? I did not find any answer on Google. It looks like this can be used to filter out events from on-screen controls. They are ugly, as they do not fire up event, which consumes all Phaser pointers...

Events_differences

I ended with this solution: Added this short function into MSPointer.js

    eventSmells: function(event) {
    
        if (!this.game.device.desktop && (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey)) {
            return true;
        }
        
        return false;    
    },

And the this check into the beginning of onPointerDown():

    onPointerDown: function (event)
    {
        if (this.eventSmells(event)) {
            event.preventDefault();
            return;
        }
          :
          :
commented

You could also try

this.input.mspointer.capture = true;

Hmmm... but it will only prevent default, but not exit onPointerDown? In fact, I added preventDefault, but key is the return statement, so execution never gets to startPointer() and smelly events are skipped.

commented

Ah, you're right of course.

commented

You could try phaser-test.js.gz to see if it makes a difference.

I will report results from testing next week (I do not have direct access to device).

I got results from testing. It seems to work! Person who tested it reports no freeze.