Lost Focus Causes Keyboard Persistence...

Bugs will be moved here once resolved.

Post » Tue Aug 26, 2014 11:27 pm

Problem Description
When player is holding down a key on the keyboard and something takes the focus away from the game. Either an errant click outside of the game window, a right click outside of the game window, a steam alert popping up over the game, etc the game 'remembers' the key that was down and persists with pushing it even though window is not in focus. when returning to the game window, the key will continue to be pushed, even if it's not actually being pushed... the only way to 'fix' the issue is to hit that key again, causing it's state to reset.

Attach a Capx
http://d.pr/f/bIZl/5MQjp5Xu

Description of Capx
Simple 8 direction movement via arrow keys...

Steps to Reproduce Bug
  • Preview CAPX
  • Use arrow keys to control player.
  • While holding a direction, right click a 'non-game' area... click the 'search' bar of the browser window, alt-tab away from the game, etc.
  • While focus is lost, release the arrow key you were holding.
  • Upon returning to the game, notice the direction key is still 'held' indefinitely.
  • "Fix" the issue by re-touching the arrow key that the game 'thinks' is down. This will reset the state.

Observed Result
Above

Expected Result
Lose focus to game = key pressed / touch states are forced to 'let go'.

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)
  • Internet Explorer: (YES)

Operating System and Service Pack
Windows 7

Construct 2 Version ID
Construct 178
Made Cosmochoria - www.cosmochoria.com
Currently working on Slayaway Camp - www.slayawaycamp.com
B
27
S
8
G
3
Posts: 384
Reputation: 5,020

Post » Tue Aug 26, 2014 11:31 pm

i thought perhaps if there was even a 'release all keys' option in the keyboard object i could simply do it via an action like "On Suspend: Release Keys" or something but "On Suspend" doesnt seem to apply to something like a 'right click', so I dont know if this is fixable...
Made Cosmochoria - www.cosmochoria.com
Currently working on Slayaway Camp - www.slayawaycamp.com
B
27
S
8
G
3
Posts: 384
Reputation: 5,020

Post » Wed Aug 27, 2014 1:56 pm

I believe this happens to all keyboard input when it comes to loosing focus. In my case, any event that uses [When Key is down] will cause the key to constantly hold when looses focus even when the key isn't physically held down any more.


EDIT* It may happen to consoles too
B
40
S
9
G
5
Posts: 177
Reputation: 6,805

Post » Wed Aug 27, 2014 3:14 pm

Is there some workaround for this, you think? other than checking every tick for all keys and releasing if theyre not actually down?! (Isnt it already doing that?)
Made Cosmochoria - www.cosmochoria.com
Currently working on Slayaway Camp - www.slayawaycamp.com
B
27
S
8
G
3
Posts: 384
Reputation: 5,020

Post » Wed Aug 27, 2014 4:19 pm

I don't think this is a C2 issue.
B
56
S
15
G
13
Posts: 826
Reputation: 17,665

Post » Wed Aug 27, 2014 6:28 pm

Well I appreciate that, and Im certainly not trying to argue or be offensive, but it's an issue in that games created with C2 have this problem, even when built as standalone executables. Other commercial games and applications do not have this issue.

If i had the capabilities to code my game from scratch, this is something I would try to resolve. Because I'm relying on C2 and have no way to resolve (to my knowledge) using the tools within C2, i'm reporting it as a bug.
Made Cosmochoria - www.cosmochoria.com
Currently working on Slayaway Camp - www.slayawaycamp.com
B
27
S
8
G
3
Posts: 384
Reputation: 5,020

Post » Wed Aug 27, 2014 8:47 pm

Sorry, I don't think there is anything we can do about this. If the browser loses focus then the browser does not fire the key up event. I think some native apps are affected by this too, as well as any other engine/framework running in a browser. It's more to do with how the OS deals out events to different apps.
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,671

Post » Wed Aug 27, 2014 9:05 pm

dang, thats a bummer.. A couple testers have said it can be annoying and i haven't even done the full release / passed keys to all kickstarter backers yet. (small sample size)
Made Cosmochoria - www.cosmochoria.com
Currently working on Slayaway Camp - www.slayawaycamp.com
B
27
S
8
G
3
Posts: 384
Reputation: 5,020


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 4 guests